Basket Trading Import Format

Top  Previous  Next

Basic text format

The import format consists of a pure text, ASCII format with:

Optional comments and blank lines
A single header
One or more orders

 

The format is line-based, each line is terminated with a carriage return/line feed combination (CR/LF, ASCII #13/#10). The header and order lines have each name and value separated with tabular characters (Tab, ASCII #9).

Comments and blank lines

Any line in the import file can be an empty line or a comment line prefixed by a # character. Empty and comment lines are completely ignored during import, but can be useful to document the file for humans.

Header

The first non-empty, non-comment line in the import file is interpreted as the header. The header consists of order property names separated by tab characters. The actual basket order values must follow the same order as the corresponding property names in the header.

Legal property names are:

Market, FeedID, Ticker, ISIN, Currency, ExchangeID, Position, Volume, OpenVolume, PriceSource, PriceDelta, Price, OrderType, Portfolio, ValidDays, Comment, ClientRef, Included, Weight, Custom1, Custom2, Custom3, Custom4, Custom5, Custom6

The specific format and legal values for each property will be listed below.

Order values

Below the header comes the list of orders and their values. Each order is listed on a separate line and with values for each property in the header, separated by tab characters. Empty values are ignored.

The following describes the format for each of the possible properties.

Symbol identification fields

A valid order must at least contain a combination of symbol identification fields. There are four different combinations of symbol identification fields that allow the system to find a specific symbol.

FeedID and Ticker

Together the FeedID and Ticker fields identify a symbol uniquely. This is the primary identification method in the system and can be used even if the symbols have not been pre-created in the client (by opening a Market window, for instance). FeedID is the three-letter abbreviation of the feed name that you will see in the Market window caption or in the Composite window’s Feed column. For instance, FeedID of the Oslo Stocks feed is OSS, Stockholm Stocks is SSE and Nasdaq Stocks is NSQ.

The internal numeric value may also be used - for instance, 18187 for Oslo Stocks or 17921 for Stockholm Stocks. Ticker is the alphanumeric primary symbol code within a feed. For instance Norsk Hydro’s ticker is NHY, Ericsson B-shares is ERIC B and Microsoft is MSFT. Examples of valid values for FeedID and Ticker:

FeedID Ticker
OSS NHY
SSE ERIC B
NSQ MSFT

If the system you are importing from does not have or support FeedIDs or Ticker codes, you can use one of the alternative forms below.

FeedID and ISIN

One alternative set of identification fields is FeedID and ISIN. FeedID is described above. ISIN is an International Securities Identifying Number, a unique international code which identifies a securities issue. Because the same company can be traded at several exchanges using the same ISIN, we still need the FeedID field. For example, Norsk Hydro has the ISIN NO0005052605, Ericsson B-shares is ISIN SE0000108656 and Microsoft is US5949181045. Examples of valid values for FeedID and ISIN:

OSS NO0005052605
SSE SE0000108656
NSQ US5949181045

 

Market, ISIN and Currency

Another alternative is to use the combination of three fields; Market (aka marketplace), ISIN and Currency.

Marketplace is a general description of the trading platform that may span multiple feeds. For instance, a Market called ”r;Saxess” might span trading on the feeds Oslo Stocks, Stockholm Stocks and Copenhagen Stocks. Note that the exact names of the market names may vary depending on the trading provider you use.

To uniquely identify a symbol within a marketplace ISIN (see description above) must be combined with the symbol’s trading Currency. Currency is a three-letter abbreviation such as NOK for Norwegian Kroner, SEK for Swedish Kroner or USD for United States Dollar. Examples of valid values for Market, ISIN and Currency:

Market ISIN Currency
Saxess NO0005052605 NOK
Saxess SE0000108656 SEK
AKJ US5949181045 USD

Market and ExchangeID

Finally, an imported symbol can be identified by the combination of Market (aka. marketplace) and ExchangeID (aka. Code or ExchSym). As explained above Market is the name of the trading place (such as Saxess). ExchangeID is a (normally numeric) trading-specific ID that uniquely identifies a symbol within the trading place. For example, the ExchangeIDs for NHY and ERIC B is 15613 and 101, respectively. Note that not all markets and feeds support or use ExchangeIDs. Examples of valid values for Market and ExchangeID:

Market ExchangeID
Saxess 15613
Saxess 101

 

Volume and position fields

The following three fields define the direction of the order (buy or sell), the total volume and the market-visible (open) volume.

Position

This property defines the order as a buy-order or a sell-order. If this property is not present, the sign of the Volume field determines the position.

Legal values for Position are: pBuy, pSell

Volume

The Volume property is a numeric field that determines the number of shares or instruments that will be traded. Unless the Position field has been explicitly provided, the sign of the Volume field will decide if this is a buy or a sell order. Positive volumes are buy orders, negative volumes are sell orders.

OpenVolume

If present, OpenVolume sets the open volume of the order - the amount of the Volume that will be visible in the market at any time. Open volume is always given as a positive number that must be equal or less than Volume.

Price fields

There are several flexible ways of determining the price that should be used for each order. The three following fields define the possibilities.

Price

This is the explicit price of the order. This is used when PriceSource is set to psCustom.

PriceDelta

When you use a PriceSource other than psCustom, you can include a PriceDelta of how the calculated price should differ from the market price.

PriceSource

If you don’t provide a specific Price, you must provide a PriceSource to get the price value calculated from the current market price of the symbol. The possible values and their meaning are:

psCustom The default value. The explicitly provided Price field will be used (PriceDelta is ignored)
psLast The current Last value of the symbol. If Last is not available, LastValidPrevClose will be used
psBid The current Bid value of the symbol.
psAsk The current Ask value of the symbol.
psMid The current Mid value of the symbol (the average of Bid and Ask)
psVWAP The current VWAP (Volume Weighted Average Price) value of the symbol.

Other order fields

OrderType

This field determines the type of the order. The default is a Normal (limit) order. The possible legal values depends on what order types your trading provider supports for the given symbol / feed.

The total list of possible order types are:

otNormal, otFillAndKill, otFillOrKill, otAllOrNothing, otCrossOrder, otBestPossible, otAtMarket, otMarket, otLimit, otMarketToLimit, tAtMarketAndKill, otRequestQuote, otFunari, otStopLimit, otStopLoss, otContingent, otFlex, otInterest, otAccept, otParent

Portfolio

This is the name of the portfolio the order will be inserted into. If the Trading login has a single available portfolio, that will be used as default. Otherwise the portfolio configured under Tools | Trading will be used as default. Note that the Trading login must have access to the portfolio given by this property.

ValidDays

This field gives the valid until date for the order, specified in relative days. The default or 0 is today, 1 is until tomorrow, 2 is two days and so on. The import only supports relative dates. Using absolute dates would quickly make the dates invalid (as they would become in the past).

Comment

This is a text field containing a comment for the order.

ClientRef

This is a text field containing a client reference for the order.

Custom order fields

A specific trading provider may choose to define a number of custom trading fields for each marketplace. These fields may be used to define odd-lot orders, special order handling, etc. The number, names and valid values for these fields are defined in the trading server at the discretion of the trading provider.

The Basket Trading window and the import function supports up to 6 such custom fields, named Custom1, Custom2, Custom3, Custom4, Custom5 and Custom6. In general these fields accept strings of the form ”r;Name=Value”, where Name is the descriptive name of the custom field (identical to the label shown for the custom field in the New Order window) and Value is one of the drop-down values or a free-text input value or numeric value.

Note that the available custom fields are often different for different marketplaces. For instance, the available fields and valid values may be different for the Nordic and the American markets.

The easiest way to see the available custom fields and valid values is to:

Add an order to the Basket Trading window
Use the Edit Order command (or press Ctrl+Enter)
Set the relevant custom fields
Press OK
Look in the Custom#1-Custom#6 fields for the correct values.

 

The Custom fields can be added as columns in the Basket Trading window by:

Right-click the columns
Select the Field Chooser menu item.
Drag-and-drop the Custom fields to the grid

Basket order specific fields

The following fields are not used when sending the order to the market, instead they are used as helper fields when defining the orders in the basket itself.

Included

This is a Boolean value (True/False or 1/0) that indicates if the order will be included in the basket when the basket is executed or not.

Weight

This is a numeric value defining the weight of the order. The value is used when manually distributing a total value to all the orders in the Basket Trading window.

Error handling

If the file you try to import contains unknown property names (or the header is missing) or invalid values, you will be informed by a dialog box listing the errors. Even if an order has an invalid value for one property, the other values will be imported.

Examples of import files

The following section will list some examples of valid import files.

Example #1

This example shows the minimum set of three values that can be imported into valid orders:

FeedID Ticker Price Volume
OSS NHY 783.00 200
SSE ERIC B 27.00 1200
NSQ MSFT 27.00 800

 

Example #2

This is an example that shows blank lines, comments and additional columns:

# This is a comment
# Blank lines are allowed
# Here is the header followed by the orders, one order per line
# The names and the values must be separated using tabs
FeedID Ticker PriceSource PriceDelta Volume Position ValidDays
OSS NHY psBid 0.20 200 pSell 0
SSE ERIC B psLast 0.20 1200 pSell 1
NSQ MSFT psAsk -0.20 800 pBuy 2



Mail us feedback on this topic! 

01/02/2017