Hoppa till huvudinnehållet

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

"cmd"

"login".

"args"

See below.

Args:

Key Mandatory Description

"session_key"

Yes.

See HTTP POST login request.

"service"

Yes.

Should always be "NEXTAPI".

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

"type"

"heartbeat".

"data"

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

"type"

"err".

"data"

See below.

The data field contains details about the error.

Key Value

"msg"

Message describing the error.

"cmd"

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

"type"

"order".

"data"

See HTTP GET orders request.

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

"type"

"trade".

"data"

See HTTP GET trades request.

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

"cmd"

"subscribe" or "unsubscribe".

"session_key"

The session key from the HTTP login.

"args"

See below.

Args:

Key Mandatory Value

"t"

Yes.

Type: "price", "depth", "trade", "indicator", "news" or "trading_status".

"m"

No.

The tradable market_id or indicator src. Used for "price", "depth", "trade", "indicator" and "trading_status". If the type is an "indicator" the field is a string otherwise it is an integer.

"i"

No.

The tradable or indicator identifier. Used in "subscribe" commands for "price", "depth", "trade", "indicator" and "trading_status".

"s"

No.

News source. Only used in "subscribe" commands for "news".

"delay"

No.

(Deprecated) true if delayed news are accepted. Default is false. Used only in "subscribe" commands for "news".

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

"type"

"price", "depth", "trade", "indicator", "news", "trading_status" or "heartbeat".

"data"

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

"i"

The identifier of the tradable.

"m"

The market_id of the tradable.

"delayed"

Delay of the priceinformation in seconds for the tradable. Only sent if it is greater than 0.

"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.

"low"

Lowest price for a trade today.

"open"

Opening price.

"vwap"

Volume Weighted Average Price.

"turnover"

Turnover value today. The currency is the orderbook currency.

"turnover_volume"

Turnover volume today.

"ep"

Equilibrium price. Only sent during auction on the Nordic markets.

"paired"

The paired quantity of shares at the equilibrium price. Only sent during auction on the Nordic markets.

"imbalance"

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

"i"

The identifier of the tradable.

"m"

The market_id of the tradable.

"trade_timestamp"

The time of the trade.

"price"

The price of the trade in the default currency of the orderbook.

"volume"

Volume traded.

"broker_buying"

Buying participant. Not supported on all markets.

"broker_selling"

Selling participant. Not supported on all markets.

"trade_id"

The exchange trade identifier. Not supported on all markets.

"trade_type"

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

"i"

The identifier of the tradable.

"m"

The market_id of the tradable.

"tick_timestamp"

The timestamp of this update.

"bid1"

Bid price on level 1.

"bid_volume1"

Bid volume on level 1.

"bid_orders1"

Number of bid orders on level 1.

"ask1"

Ask price on level 1.

"ask_volume1"

Ask volume on level 1.

"ask_orders1"

Number of ask orders on level 1.

"bid2"

Bid price on level 2.

"bid_volume2"

Bid volume on level 2.

"bid_orders2"

Number of bid orders on level 2.

"ask2"

Ask price on level 2.

"ask_volume2"

Ask volume on level 2.

"ask_orders2"

Number of ask orders on level 2.

"bid3"

Bid price on level 3.

"bid_volume3"

Bid volume on level 3.

"bid_orders3"

Number of bid orders on level 3.

"ask3"

Ask price on level 3.

"ask_volume3"

Ask volume on level 3.

"ask_orders3"

Number of ask orders on level 3.

"bid4"

Bid price on level 4.

"bid_volume4"

Bid volume on level 4.

"bid_orders4"

Number of bid orders on level 4.

"ask4"

Ask price on level 4.

"ask_volume4"

Ask volume on level 4.

"ask_orders4"

Number of ask orders on level 4.

"bid5"

Bid price on level 5.

"bid_volume5"

Bid volume on level 5.

"bid_orders5"

Number of bid orders on level 5.

"ask5"

Ask price on level 5.

"ask_volume5"

Ask volume on level 5.

"ask_orders5"

Number of ask orders on level 5.

Trading Status Events

Key Value

"i"

The identifier of the tradable.

"m"

The market_id of the tradable.

"tick_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.

"halted"

The halted reason if available from the market.

Indicator Events

Key Value

"i"

Index identification.

"m"

Index source.

"tick_timestamp"

Timestamp of the last update

"high"

Highest price today.

"low"

Lowest price today.

"last"

Last price.

"close"

Last close price.

News Events

Key Value

"news_id"

News item identifier can be used in the news rest service to get the whole news item.

"lang"

The language of the news.

"timestamp"

The time of the news.

"source_id"

News source identifier.

"headline"

Headline of the news.

"instruments"

Array of instruments involved in the news. This is only set if the news source provides the information.

"type"

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.

© 2024 Nordnet Bank AB.
Nordnet | Box 30099 | 104 25 Stockholm