Private order and trade feed Revision 1.15

Introduction

The publisher sends all private trade and order notifications to all connected processes. The publisher has no support for recovery or retransmission. To be able to get the current state of orders and trade a query has to be sent to a service.

Private orders and trades are trades and orders belonging to the connecting session.

The private order and trade notifications are sent as JSON messages. The field "type" is used as indicator if this is an order or a trade. Other message types can be added later so the client must be able to handle unexpected JSON messages and not documented fields.

All communication on the feed is using SSL.

The client must be able to handle not documented fields and messages. The client should never have more than one connection open at any time. A heartbeat is sent from the server every 30 second.

All messages sent to the public and prive feeds must be ended by newline.

Subscription requests

Connect to the server with a socket login with the session cookie. The session cookie is used for identification.

Subscribe message format:

Key Value
"cmd" Login
"session_key" The session key from the login.
"service" The application id (same as the service in the REST login).

Example of requests

{"cmd":"login", "args":{ "session_key":"ABC123", "service":"MY_APP" }}

Feeds

Heartbeat

Key Value
"type" "heartbeat"
"data" empty hash

Order notifications

Key Value
"type" "order"
"data" Subgroup {Order information}

Trade notifications

Key Value
"type" "trade"
"data" Subgroup {Trade information}

Subgroup Order information

Key Value
"exchangeOrderID" The orderid used by the exchange.
"orderID" The orderid used internally in the Nordnet systems.
"activationCondition" Subgroup {Activation condition}
"regdate" The date when the order is registred in the Nordnet system. Not when it enters the market.
"priceCondition" "LIMIT" or "AT_MARKET".
"price" Subgroup {Price}
"volumeCondition" "NORMAL" - All types of fills are accepted.
"ALL_OR_NOTHING" - Partial fills not accepted.
"volume" Remaining order volume.
"side" "BUY" or "SELL".
"tradedVolume" Total volume of all trades of the order.
"accno" The Nordnet account number.
"instrumentID" Subgroup {Instrument}
"validity" Subgroup {Validity}
"orderState" DELETED - Order is deleted.
LOCAL - Order is offline/local and eligible for activation.
ON_MARKET - Order is active on market.
"modDate" Nordnet timestamp for the modification.
"actionState" DEL_FAIL - Delete request failed and the order is still active on market.
DEL_PEND - Delete request in progress and unconfirmed from the market.
DEL_CONF - Delete confirmed by market.
DEL_PUSH - Deleted by market
INS_FAIL - Insert failed.
INS_PEND - Pending insert.
INS_CONF - Confirmed insert.
MOD_FAIL - Modification failed and the previous order values are still valid.
MOD_PEND - Modification in progress and waiting confirmation from market.
MOD_PUSH - Modified by market.
INS_WAIT - Insert waiting for market open.
MOD_WAIT - Modification of order on market waiting for market open.
DEL_WAIT - Delete of order on market waiting for market open.
MOD_CONF - Modification confirmed by the market.
"statusText" Status message from the exchange/market.

Subgroup Trade information

Key Value
"accno" The Nordnet account number.
"orderID" The Nordnet orderid of the traded order.
"instrumentID" Subgroup {Instrument}.
"volume" The volume of the trade.
"price" Subgroup {Price}.
"side" "BUY" or "SELL".
"tradeID" The exchange tradid.
"counterparty" The trade counterparty.
"tradetime" The exchange time of trade.

Subgroup Activation condition

Key Value
"type" "NONE"
"DATE" - The order is activated on a certain day and time.
"TRIGGER_ON_PRICE" - The order is activated when the market price of the instrument reaches a trigger price.
"date" The date to activate the order - only set when type is "DATE"
"price" Subgroup {Price} - only set when type is "TRIGGER_ON_PRICE"

Subgroup Price

Key Value
"curr" The currency.
"value" The price.

Subgroup Instrument

Key Value
"marketID" The Nordnet market identifier.
"identifier" The exchange specific identifier (feedcode, orderbookid or similar)

Subgroup Validity

Key Value
"type" Validity period "DAY", "UNTIL_DATE", "UNTIL_CANCELLED" or "IMMEDIATE"
"date" Cancel date, only used when type is "UNTIL_DATE"

Examples

An order is traded

The order information before the trade:
{"type":"order","data":{"exchangeOrderID":"245134","orderID":7324,"activationCondition":{"type":"NONE"},"regdate":1264089189023,"priceCondition":"LIMIT","volume":1.0,"price":{"curr":"SEK","value":80.0},"side":"BUY","tradedVolume":0.0,"accountNumber":6006688,"instrument":{"marketID":11,"identifier":"100"},"validity":{"type":"DAY"},"state":"On_market"}}

The order change information due to the trade:
{"type":"order","data":{"exchangeOrderID":"245134","orderID":7324,"activationCondition":{"type":"NONE"},"regdate":1264089189023,"priceCondition":"LIMIT","volume":0.0,"price":{"curr":"SEK","value":80.0},"side":"BUY","tradedVolume":1.0,"accountNumber":6006688,"instrument":{"marketID":11,"identifier":"100"},"validity":{"type":"DAY"},"state":"Deleted"}}

The trade:
{"type":"trade","data":{"accno":6006688,"orderID":7324,"instrumentID":{"marketID":11,"identifier":"100"},"volume":1.0,"price":{"curr":"SEK","value":80.0},"side":"BUY","tradeID":"B923152","counterparty":"MCF","tradetime":1264089189000}}

The public trade and price feed

The feed service sends the public trades and price information to the connected processes. The client can subscribe to six different feeds. Each subscription is related to one entity (one instrument or one news source). The client can have multiple subscriptions started at the same time.

The six different feeds:

  • Trade - all trade on the market.
  • Price - latest, best bid, best ask and so on.
  • Depth - the orderbook price depth in five levels.
  • Trading status - the state of an orderbook (e.g continuous trading, stopped, etc).
  • Index - price information of indices.
  • News - news in realtime (if the user has the right to see it)

NOTE: Not all feeds are available from all markets.

All communication on the feed is using JSON.

The application must use the login command before any subscriptions can be requested. If the login fails or a subscription is made before the login the connection will be closed.

If the client application can't read from the feed and the feed starts to buffer the connection will be closed.

The client must be able to handle not documented fields and messages. The client should never have more than one connection open at any time.

A heartbeat is sent from the server every 5:th second.

Subscribe and unsubscribe requests

All requests must end with linefeed (ASCII 10). The requests are on JSON format.

Key Value
"cmd" "subscribe", "unsubscribe", "login"
"args" Subgroup {Subscribe request}

Subgroup Subscribe request

Key Value
"t" Type - "price", "depth", "trade", "index" or "trading_status".
"i" Instrument identification. If the type is index the index id should be used.
"m" Market - the Nordnet marketplace identification. When type is index the index source should be used.
"session_key" The session key for login. Only used at login.
"s" News source. Only used for news
"delay" Only used for news. True if delayed news are accepted. Default is false.

Examples of requests

Login
{"cmd":"login", "args":{ "session_key":"ABC123"}}

Subscribe to Nordnet B (identifier 1869) on Burgundy (marketplace 30).

Price tick:
{"cmd":"subscribe", "args":{"t":"price", "i":"1869", "m":30}}

Order Depth:
{"cmd":"subscribe", "args":{"t":"depth", "i":"1869", "m":30}}

Trades:
{"cmd":"subscribe", "args":{"t":"trade", "i":"1869", "m":30}}

Trading status:
{"cmd":"subscribe", "args":{"t":"trading_status", "i":"1869", "m":30}}

Index:
{"cmd":"subscribe", "args":{"t":"index", "i":"SIX-IDX-DJI", "m":"SIX"}}

News:
{"cmd":"subscribe", "args":{"t":"news", "s":2}}

Feeds

The feeds are on JSON format.

Feed

Feed message

Key Value
"cmd" "price", "depth", "trade", "index", "news", "trading_status", "heartbeat"
"args" Subgroup {Feed args}

Price Feed

Key Value
"i" Instrument identification
"m" Marketplace - The Nordnet marketplace identification
"t" Type - always "price".
"trade_timestamp" Timestamp of the last trade - the time when last and turnover fields are updated.
"tick_timestamp" The timestamp of this update.
"bid" Best bid price.
"bid_volume" Total volume of the best bid price.
"ask" Best ask price.
"ask_volume" Total volume of the best ask price.
"close" Closing price.
"high" Highest price for a trade today.
"last" Last paid.
"last_volume" Volume of the last trade.
"lot_size" The round lot size of the orderbook
"low" Lowest price for a trade today.
"open" Opening price.
"turnover" Turnover value today. The currency is the orderbook currency.
"turnover_volume" Turnover volume today.

Trade Feed

Key Value
"i" Instrument identification.
"m" Marketplace - The Nordnet marketplace identification
"t" Type - always "trade".
"trade_timestamp" The time of the trade.
"price" The price of the trade. Currency is the default currency of the orderbook.
"volume" Volume traded.
"baseprice" Previous last price.
"broker_buying" Buying participant. Not supported on all markets.
"broker_selling" Selling participant. Not supported on all markets.
"trade_type" The exchange trade type - different on different markets.
"isin" Instrument isin code - Deprecated do not use this. This field will be removed.

Depth feed

Key Value
"i" Instrument identification.
"m" Marketplace - The Nordnet marketplace identification.
"t" Type - always "depth".
"tick_timestamp" The timestamp of this update.
"bid1" Bid price on level 1
"bid_volume1" Bid volume on level 1
"ask1" Ask price on level 1
"ask_volume1" Ask volume on level 1
"bid2" Bid price on level 2
"bid_volume2" Bid volume on level 2
"ask2" Ask price on level 2
"ask_volume2" Ask volume on level 2
"bid3" Bid price on level 3
"bid_volume3" Bid volume on level 3
"ask3" Ask price on level 3
"ask_volume3" Ask volume on level 3
"bid4" Bid price on level 4
"bid_volume4" Bid volume on level 4
"ask4" Ask price on level 4
"ask_volume4" Ask volume on level 4
"bid5" Bid price on level 5
"bid_volume5" Bid volume on level 5
"ask5" Ask price on level 5
"ask_volume5" Ask volume on level 5

Trading status feed

Key Value
"i" Instrument identification.
"m" Marketplace - The Nordnet marketplace identification.
"t" Type - always "trading_status".
"timestamp" Timestamp of the update
"status" The Nordnet trading status of an orderbook.
"C" - Continuous trading.
"R" - Receiving orders but trading is disabled.
"D" - Temporarily disabled.
"X" - Permanently disabled.
"U" - Unknown state.
"source_status" The marketplace orderbook state.

Index feed

Key Value
"i" Index identification.
"m" Index source.
"t" Type - always "index".
"tick_timestamp" Timestamp of the last update
"high" Highest price today.
"low" Lowest price today.
"last" Last price.
"close" Last closeprice.

News feed

Key Value
"itemid" News itemid can be used in the news rest service to get the whole news item.
"lang" The language of the news (this is set by the source)
"datetime" The time of the news.
"sourceid" News source id.
"headline" Headline of the news
"instruments" Array of instruments involved in the news. This is only set if the news source provides the information.

Examples of feeds

Price feed:

{
    "cmd": "price",
    "args": {
        "i": "1843",
        "m": 30,
        "t": "price",
        "trade_timestamp": "2010-01-22 16:17:23",
        "tick_timestamp": "2010-01-22 16:18:42",
        "bid": "0.00",
        "bid_volume": 0,
        "ask": 101.00,
        "ask_volume": 200,
        "close": 101.00,
        "high": 101.00,
        "last": 101.00,
        "last_volume": 200,
        "lot_size": "1",
        "low": 101.00,
        "open": 0.00,
        "turnover": 6605400,
        "turnover_volume": 65400
    }
}

Depth feed:

{
    "cmd": "depth",
    "args": {
        "i": "2188",
        "m": 30,
        "t": "depth",
        "tick_timestamp": "2010-01-22 16:22:06",
        "bid1": 0.00,
        "bid_volume1": 0,
        "ask1": 120.00,
        "ask_volume1": 200,
        "bid2": 0.00,
        "bid_volume2": 0,
        "ask2": 0.00,
        "ask_volume2": 0,
        "bid3": 0.00,
        "bid_volume3": 0,
        "ask3": 0.00,
        "ask_volume3": 0,
        "bid4": 0.00,
        "bid_volume4": 0,
        "ask4": 0.00,
        "ask_volume4": 0,
        "bid5": 0.00,
        "bid_volume5": 0,
        "ask5": 0.00,
        "ask_volume5": 0
    }
}

Trade feed:

{
    "cmd": "trade",
    "args": {
        "i": "1843",
        "m": 30,
        "t": "trade",
        "trade_timestamp": "2010-01-22 16:24:04",
        "price": 101.00,
        "volume": 200,
        "baseprice": 101.00,
        "broker_buying": "ZCFT",
        "broker_selling": "ZCFT" 
    }
}

Trading status:

{
    "cmd": "trading_status",
    "args": {
        "i": "4208",
        "m": 11,
        "t": "trading_status",
        "timestamp": "2010-01-25 09:00:00",
        "status": "C",
        "source_status": "ContinuousTrading" 
    }
}

Index:

{
    "cmd": "index",
    "args": {
        "i": "SIX-IDX-DJI",
        "m": "SIX",
        "t": "index",
        "tick_timestamp": "2010-09-24 07:01:58",
        "last": 10662.4199,
        "high": 10761.9404,
        "low": 10640.9199,
        "close": 10739.31
    }
}

News:

{
    "cmd": "news",
    "args": {
        "itemid": 40705006,
        "lang": "da",
        "datetime": "2010-12-08 22:15:00",
        "sourceid": 6,
        "headline": "Amerikanske aktieindeks kl. 22:15",
        "instruments": [{
            "identifier": "101",
            "marketID": "11" 
        }]
    }
}