Nordnet External Feeds
Nordnet External Feeds (Feeds) are real-time feeds to be used together with the Nordnet External API (API). There are two feed components: Public Feed and Private Feed. Public Feed allows a client to receive a stream of market data in real-time for all markets and products available on the Nordnet platform. Private Feed is an event stream where order and trade notifications are sent. For more information please visit the Nordnet External API product page.
A client interacts with the Feeds by sending commands to a Feed specific hostname and port (see below). The client sets up an SSL connection to the host and port for the Feed that it wishes to receive events from and can then send commands over this connection. All commands sent to Feeds must be JSON-encoded and terminated by a linefeed (ASCII 10) character.
In order to protect from overload situations there are limits enforced for the number of commands per second and the number of commands per 30 seconds. When a first threshold is reached the server will send an error event to the client and start to drop incoming messages. If the client surpasses a second threshold the connection will be closed by the server. While the exact limits are not specified, a client wishing to send many thousand commands in a short period of time should spread them out in time so that no more than a few hundred are sent per second.
Logging In to a Feed
To get access to Feeds the client has to perform a successful login to the API.
For complete instructions on how to login, see /api/2/login
.
The response on a successful login will contain hostnames and ports to use for interacting with the Feeds.
It also contains a session_key
which is needed when sending commands to the Feeds.
In order to start using a Feed the user needs to send a login
command over the connection to it.
Login request format:
Key | Value |
---|---|
|
|
|
See below. |
Args:
Key | Mandatory | Description |
---|---|---|
|
Yes. |
|
|
Yes. |
Should always be |
Here is an example of a login request:
{
"cmd": "login",
"args": {
"session_key": "ABC123",
"service": "NEXTAPI"
}
}
Note that all requests sent must be terminated by a linefeed (ASCII 10) character.
Heartbeat Events
A heartbeat is sent when no events are published on the stream, at an interval of five seconds.
Key | Value |
---|---|
|
|
|
Empty. |
For example:
{
"type": "heartbeat",
"data": {}
}
Error Events
When the processing of a command results in an error, an error event is sent to the client.
Key | Value |
---|---|
|
|
|
See below. |
The data
field contains details about the error.
Key | Value |
---|---|
|
Message describing the error. |
|
The client command that failed. |
For example:
{
"type":"err",
"data": {
"msg":"Not authorized.",
"cmd": {
"cmd":"subscribe",
"args": {
"t":"price",
"m":111,
"i":"101"
}
}
}
}
Private Feed
Private Feed is an event stream which pushes notifications for the various events described below. All events related to a user account will be sent. The following sections describe the structure of the messages sent over Private Feed.
Order Notification Events
An order notification is sent when an order on one of the client’s accounts is sent, deleted, or modified. These will always be sent once the user has logged in to the Private Feed, no subscription is necessary.
Key | Value |
---|---|
|
|
|
For example:
{
"type": "order",
"data": {
"volume": 111.0,
"price": {
"value": 132.55,
"currency": "SEK"
},
"volume_condition": "NORMAL",
"order_id": 202178767,
"reference": "ABC132",
"tradable": {
"market_id": 11,
"identifier": "101"
},
"validity": {
"type": "DAY",
"valid_until": 1613061300000
},
"accno": 123123,
"accid": 1,
"side": "BUY",
"modified": 1612955053717,
"activation_condition": {
"type": "NONE"
},
"order_state": "LOCAL",
"action_state": "INS_PEND",
"order_type": "LIMIT"
}
}
Trade Notification Events
A trade notification is sent when a trade is completed.
Key | Value |
---|---|
|
|
|
Public Feed
Public Feed is a real-time market data feed.
In order to get events from Public Feed the client must first send subscribe
commands.
There are six message types a client can subscribe to.
-
Trade - all trades on the market.
-
Price - last, 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).
-
Indicator - price information of indicators.
-
News - news items in real-time.
Subscribe/Unsubscribe Requests
Subscribe requests allows a client to ask for a stream related to an instrument, indicator etc.
Key | Value |
---|---|
|
|
|
The session key from the HTTP login. |
|
See below. |
Args:
Key | Mandatory | Value |
---|---|---|
|
Yes. |
Type: |
|
No. |
The tradable |
|
No. |
The tradable or indicator identifier.
Used in |
|
No. |
News source.
Only used in |
|
No. |
(Deprecated) |
For example, in order to subscribe to price events for the instrument with identifier "101"
in market 11 the following command should be sent:
{
"cmd": "subscribe",
"args": {
"t": "price",
"m": 11,
"i": "101"
}
}
See below for more examples.
Public Feed Events
The messages sent from the server have the following structure
Key | Value |
---|---|
|
|
|
Depends on type. |
Price Events
In the first message after a subscription, all available fields are sent to the client.
In subsequent events only the "m"
, "i"
and changed fields are sent.
In other words, first a full tick is sent which is followed by delta ticks only.
Note that all fields are not available on all markets.
Key | Value |
---|---|
|
The identifier of the tradable. |
|
The market_id of the tradable. |
|
Delay of the priceinformation in seconds for the tradable. Only sent if it is greater than 0. |
|
Timestamp of the last trade - the time when last and turnover fields are updated. |
|
The timestamp of this update. |
|
Best bid price. |
|
Total volume of the best bid price. |
|
Best ask price. |
|
Total volume of the best ask price. |
|
Closing price. |
|
Highest price for a trade today. |
|
Last paid. |
|
Volume of the last trade. |
|
Lowest price for a trade today. |
|
Opening price. |
|
Volume Weighted Average Price. |
|
Turnover value today. The currency is the orderbook currency. |
|
Turnover volume today. |
|
Equilibrium price. Only sent during auction on the Nordic markets. |
|
The paired quantity of shares at the equilibrium price. Only sent during auction on the Nordic markets. |
|
The quantity of shares not paired at the equilibrium price. Positive quantity indicates buy imbalance. Negative quantity indicates sell imbalance. Only sent during auction on the Nordic markets. |
Trade Events
The trade feed contains public trade information.
Key | Value |
---|---|
|
The identifier of the tradable. |
|
The market_id of the tradable. |
|
The time of the trade. |
|
The price of the trade in the default currency of the orderbook. |
|
Volume traded. |
|
Buying participant. Not supported on all markets. |
|
Selling participant. Not supported on all markets. |
|
The exchange trade identifier. Not supported on all markets. |
|
The exchange trade type - differs between markets. |
Order Depth Events
In the first message after a subscription all available fields are sent to the client.
After that only the "m"
, "i"
and changed fields are sent.
Key | Value |
---|---|
|
The identifier of the tradable. |
|
The market_id of the tradable. |
|
The timestamp of this update. |
|
Bid price on level 1. |
|
Bid volume on level 1. |
|
Number of bid orders on level 1. |
|
Ask price on level 1. |
|
Ask volume on level 1. |
|
Number of ask orders on level 1. |
|
Bid price on level 2. |
|
Bid volume on level 2. |
|
Number of bid orders on level 2. |
|
Ask price on level 2. |
|
Ask volume on level 2. |
|
Number of ask orders on level 2. |
|
Bid price on level 3. |
|
Bid volume on level 3. |
|
Number of bid orders on level 3. |
|
Ask price on level 3. |
|
Ask volume on level 3. |
|
Number of ask orders on level 3. |
|
Bid price on level 4. |
|
Bid volume on level 4. |
|
Number of bid orders on level 4. |
|
Ask price on level 4. |
|
Ask volume on level 4. |
|
Number of ask orders on level 4. |
|
Bid price on level 5. |
|
Bid volume on level 5. |
|
Number of bid orders on level 5. |
|
Ask price on level 5. |
|
Ask volume on level 5. |
|
Number of ask orders on level 5. |
Trading Status Events
Key | Value |
---|---|
|
The identifier of the tradable. |
|
The market_id of the tradable. |
|
Timestamp of the update |
|
The Nordnet trading status of an orderbook.
|
|
The marketplace orderbook state. |
|
The halted reason if available from the market. |
Indicator Events
Key | Value |
---|---|
|
Index identification. |
|
Index source. |
|
Timestamp of the last update |
|
Highest price today. |
|
Lowest price today. |
|
Last price. |
|
Last close price. |
News Events
Key | Value |
---|---|
|
News item identifier can be used in the news rest service to get the whole news item. |
|
The language of the news. |
|
The time of the news. |
|
News source identifier. |
|
Headline of the news. |
|
Array of instruments involved in the news. This is only set if the news source provides the information. |
|
The type of the news. |
Tick types
There are two types of ticks: delta and full. The full tick is the full JSON Object with every field present. This is in contrast to a delta tick for which the JSON Object will only include changed fields.
Examples of Subscribe Commands and Corresponding Events
Price Subscription
{
"cmd": "subscribe",
"args": {
"t": "price",
"m": 78,
"i": "F00000X27D"
}
}
Corresponding event:
{
"type": "price",
"data": {
"delayed": 900,
"i": "F00000X27D",
"m": "SIX",
"tick_timestamp": 1560168002590,
"high": 0.5,
"low": 1,
"close": 213.94,
"last": 253.94
}
}
Order Depth Subscription
{
"cmd": "subscribe",
"args": {
"t": "depth",
"i": "1869",
"m": 30
}
}
Corresponding event:
{
"type": "depth",
"data": {
"i": "1869",
"m": 30,
"tick_timestamp": 1560168002590,
"bid1": 21,
"bid_volume1": 100,
"bid_orders1": 1,
"ask1": 35,
"ask_volume1": 300,
"ask_orders1": 1
}
}
Indicator Subscription
{
"cmd": "subscribe",
"args": {
"t": "indicator",
"i": "SIX-IDX-DJI",
"m": "SIX"
}
}
Corresponding event:
{
"type": "indicator",
"data": {
"delayed": 900,
"i": "SIX-IDX-DJI",
"m": "SIX",
"tick_timestamp": 1560168002590,
"high": 0,
"low": 0,
"close": 25983.94,
"last": 25983.94
}
}
News Subscription
{
"cmd": "subscribe",
"args": {
"t": "news",
"s": 1
}
}
Corresponding event:
{
"type": "news",
"data": {
"news_id": 1000729440,
"source_id": 1,
"headline": "IDL BIOTECH: HOPPAS KUNNA BEHALLA TILLVAXTTAKT PÅ 20% - VD",
"lang": "sv",
"type": "NEWS",
"timestamp": 1560173163000,
"instruments": [
17513784
]
}
}
Disclaimer
There can be changes made to the structure and naming in the data provided, and this can happen at any time without any prior notice. For more information visit the product page.