api

This section contains full documentation of the API available for external Algorithmic Trading Platform interaction.

Algorithmic Trading Platform

Basic message structure

Example

Every JSON message sent across the system is composed as follows:

{
  "header" : {
    "request_timestamp" : 1547947124000000000,
    "response_timestamp" : 1547947125000000000,
    "status" : false,
  },
  "body" : [
  ]
}

Details

The fields inside the header are described as follows:

SECTION NAME DESCRIPTION
header request_timestamp the field should be populated by the client, containing high resolution timestamp (nanoseconds) of the request.
  response_timestamp the field should be populated by the service, containing high resolution timestamp (nanoseconds) of the response shortly before it is sent back to the client.
  status the field should contains true/false status which should correspond to success of failure of the operation
body array[] the field is expected to contain one or more individual models returned from the query or submitted in request

Accounts API

REST

URI METHOD REQUEST RESPONSE DESCRIPTION
/accounts OPTIONS None None Preflight support for CORS queries
  GET None []Account Returns collection of accounts from the system
  PUT []Account None Replace the entire collection with another collection
  POST Account None Inserts new element into the collection.
  DELETE None None Delete entire collection
/accounts/:account_id GET None Account Returns single account matching the :account_id
  PATCH Account None Update account model identified by :account_id parameter
  DELETE None None Cascade delete element identified by :account_id parameter
/accounts/by-name/:name GET None []Account Returns collection of accounts from the system matching :name parameter
  PUT Account None Replaces entire collection with top element identified by :name parameter
  PATCH Account None Update account model identified by :name parameter
  DELETE None None Cascade delete element identified by :name parameter

Account model description

Example

Details

The fields inside the model are described as follows:

ALVIS API

Input

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/alvis OPTIONS None None Preflight support for CORS queries
  POST ALVIS []ALVIS Returns historical profit and loss numbers

ALVIS model description

{
  "accounts" : ["string"],
  "start_date" : "string",
  "stop_date" : "string",
  "frequency": 60-3600,
  "pvs" : 0
}
FIELD VALUE DESCRIPTION
accounts string[] required, list of accounts to query the PNL for
start_date string optional, ISO formatted string representing date: YYYY-MM-DD HH:MM:SS, defaults to TODAY 00:00:00
stop_date string optional, ISO formatted string representing date: YYYY-MM-DD HH:MM:SS, defaults to TODAY NOW()
frequency int Deliver snapshot every X seconds, values can range from every minute to every hour
pvs bitmask Represented by a bitmask to indicate whether return data for production, simulation or both
  bit 0 PRODUCTION
  bit 1 SIMULATION

Reponse

{
    "account" : "string",
    "date" : "string",
    "time" : "string",
    "production" : {
        "trading" : 0.0,
        "fees" : 0.0,
        "price_effect" : 0.0
    },
    "simulation" : {
        "trading" : 0.0,
        "fees" : 0.0,
        "price_effect" : 0.0
    }
}
FIELD VALUE DESCRIPTION
account string always, the name of an account
date string ISO formatted string representing date: YYYY-MM-DD
time string ISO formatted string representing date: HH:MM:SS
production object Snapshot of available production PNL
  trading SUM of all position entries of trading PNL for a given account within the snapshot
  fees SUM of all position entries of fees for a given account within the snapshot
  price_effect SUM of all position entries of fees for a given account within the snapshot
simulation object Snapshot of available simulation PNL
  trading SUM of all position entries of trading PNL for a given account within the snapshot
  fees SUM of all position entries of fees for a given account within the snapshot
  price_effect SUM of all position entries of fees for a given account within the snapshot

EventBus

{
    "positions" : "bdfe6cef-80f9-4c70-bec8-0c8efa414a3c",
    "trading_pnl" : 0.0,
    "price_effect" : 0.0,
    "fees" : 0.0
}

HEMROD API

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/hemrod/trades GET None []TRADES Returns collection of trades for the current trading day
  PUT []HEMROD None Replaces collection of trades for the current trading day
  POST []HEMROD None Inserts new trade for the current trading day
  DELETE None None Removes all trades for the current trading day
/hemrod/trades/:year/:month/:day/:trade_id GET None []TRADES Returns collection of trades for the date filtered by the request onwards until the last trade.
  PUT []HEMROD None Replaces all trades in the given scope.
  POST []HEMROD None Appends to the trades of the defined scope.
  DELETE None None Removes all trades from the given scope

NSQ Event Bus

{
    "position_id" : "bdfe6cef-80f9-4c70-bec8-0c8efa414a3c",
    "today" :0,
    "yesterday" : 0,
    "traded_equity" : 0,
    "fees" : 0.0,
    "trading_day" : "2019-01-01",
    "account_id" : "ea14e7c5-f14c-430e-8fbd-3a6b86881f10",
    "instrument_id": "cfcc922f-a9bb-4925-93aa-a5b0c5bec4b3",
    "update_time": ""
}

TradeSink Event Bus

{
  "trade_id" : "cfcc922f-80f9-4c70-bec8-0c8efa414a3c",
  "account_id" : "ea14e7c5-f14c-430e-8fbd-3a6b86881f10",
  "instrument_id": "cfcc922f-a9bb-4925-93aa-a5b0c5bec4b3",
  "trader_id" : "VNR001",
  "trading_day" : "2019-01-01",
  "price": 118250000000000,
  "quantity": 2,
  "flags": 0
}

HEMROD trade model

{
    "instrument_id": "cfcc922f-a9bb-4925-93aa-a5b0c5bec4b3",
    "account_id": "ea14e7c5-f14c-430e-8fbd-3a6b86881f10",
    "price": 118250000000000,
    "flags": 0,
    "trader_id": "CT01",
    "transact_time": 1579789800000000000,
    "quantity": 2
}
FIELD VALUE DESCRIPTION
instrument_id uuid UUID of traded instrument
account_id uuid UUID of mapped account
price int64 Traded price in int64 normalized format
trader_id string ID of the traded who made this trade
transact_time uint64 Original transaction time (provided by exchange)
quantity int64 Traded quantity
flags bit 1 1=OUTRIGHT
flags bit 2 1=SPREAD
flags bit 3 1=MANUAL
flags bit 4 1=ALGORITHM

Instruments API

NJORD API

Input

REST

EventBus

MIMIR API

Input

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/mimir/ticks OPTIONS None None Preflight support for CORS queries
  POST MIMIR []MIMIR returns MIMIR historical data

EventBus

Mimir model description

Request

{
    "security_ids" : ["string"],
    "start_date" : "string",
    "stop_date" : "string",
    "mode" : "RAW|LPT|MP",
    "frequency": 300
}

Response

{
    "bucket":"2017-09-04T06:01:10Z",
    "open":16493000000,
    "close":16493000000,
    "high":16494000000,
    "low":16493000000,
    "volume":498,
    "count":283
}

Response RAW

Details

Ticker response definition
FIELD VALUE DESCRIPTION
security_id uuid security id from instruments database
local_received_ts uint64 local received timestamp
exchange_release_ts uint64 exchange release timestamp
bid int64 price on the bid
bid_size int64 quantity on the bid
bid_contrib int32 number of orders on the bid
ask int64 price on the offer
ask_size int64 quantity on the offer
ask_contrib int32 number of orders on the offer
last_price int64 last traded price
last_qty int64 last traded quantity
flags bit 1 1=OPEN, opening price of a day
  bit 2 1=HIGH, high price of a day
  bit 3 1=LOW, low price of a day
  bit 4 1=CLOSE, close price of a day
  bit 5 1=SETTLE, settlement price of a day
  bit 6 1=PNTL_AUC_PRC, potential auction price
  bit 7 1=PNTL_AUC_QTY, potential auction qty
  bit 16 1=PRE_OPN, pre-opening state
  bit 17 1=PRE_CRS, pre-crossing state
  bit 18 1=CRS, crossing state
  bit 19 1=NEW_PRC_IND, new price indication trading state
  bit 20 1=TRD, regular trading state
  bit 21 1=NA, not available for trading state
  bit 22 1=CLS, close state
  bit 23 1=PST_CLS, post close state
  bit 24 1=VOL, vol interrupt state
Depth response definition
FIELD VALUE DESCRIPTION
security_id UUID security id from instruments database
sequence int64 daily sequence number per instrument, starts with 0
number_of_updates int32 number of market updates per exchange update
local_publish_ts uint64 local published timestamp
local_received_ts uint64 local received timestamp
exchange_release_ts uint64 exchange release timestamp
exchange_aggressor_ts uint64 exchange aggressor timestamp
exchange_enter_ts uint64 exchange enter timestamp
price int64 price of an update
size int64 size per price level
number_of_contributors int64 number of orders per price level, 0 for level=0
level int32 price level update, 0-last, 1…n market update
flags bit 0 0=BID, 1=ASK, side of the update
  bit 1 1=OPEN, opening price of a day
  bit 2 1=HIGH, high price of a day
  bit 3 1=LOW, low price of a day
  bit 4 1=CLOSE, close price of a day
  bit 5 1=SETTLE, settlement price of a day
  bit 6 1=PNTL_AUC_PRC, potential auction price
  bit 7 1=PNTL_AUC_QTY, potential auction qty
  bit 16 1=PRE_OPN, pre-opening state
  bit 17 1=PRE_CRS, pre-crossing state
  bit 18 1=CRS, crossing state
  bit 19 1=NEW_PRC_IND, new price indication trading state
  bit 20 1=TRD, regular trading state
  bit 21 1=NA, not available for trading state
  bit 22 1=CLS, close state
  bit 23 1=PST_CLS, post close state
  bit 24 1=VOL, vol interrupt state
Candle response definition
SECTION NAME DESCRIPTION
json security_ids list of security ids
  start_date start date in the string from. eg. “2009-01-01”
  stop_date stop date in the string from. eg. “2009-01-01”
  mode Mode of query: RAW - return raw ticker, LPT - return last traded price based candles, MP - return midpoint based candles
  frequency only valid in candle mode, in milliseconds, durtion of the candle
  bucket start time of the candle
  open open price of the candle
  close close price of the candle
  high high price of the candle
  low low price of the candle
  volume total volume inside candle
  count number of updates inside candle

ODIN API

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/odin OPTIONS None None Preflight support for CORS queries
  GET   []ODIN  
/odin/:id GET   []ODIN  
  PATCH ODIN -  

EventBus

{
    "instance_id" : "string",
    "trade_interval" : 10,
    "no_trades" : 10,
    "verbosity" : 1,
    "groups" : [{
      "id" : "string",
      "max_position" : 100
    }],
    "instruments" : [{
      "id" : "string",
      "group" : "string",
      "params" : {
        "max_position" : 100,
        "max_allowed_orders_per_level": 10,
        "max_allowed_levels" : 10,
        "layer_tolerance":5,
        "cooldown" : 100,
        "max_orders" : 100,
        "max_qty" : 100,
      }
    }],
    "state" : "up/paused/trading/down"
}

Odin model description

Request

{
    "instance_id" : "string",
    "trade_interval" : 10,
    "no_trades" : 10,
    "verbosity" : 1,
    "groups" : [{
      "id" : "string",
      "max_position" : 100
    }],
    "instruments" : [{
      "id" : "string",
      "group" : "string",
      "params" : {
        "max_position" : 100,
        "max_allowed_orders_per_level": 10,
        "max_allowed_levels" : 10,
        "layer_tolerance":5,
        "cooldown" : 100,
        "max_orders" : 100,
        "max_qty" : 100,
      }
    }],
    "state" : "up/paused/trading/down"
}

Response

{
    "instance_id" : "string",
    "trade_interval" : 10,
    "no_trades" : 10,
    "verbosity" : 1,
    "groups" : [{
      "id" : "string",
      "max_position" : 100
    }],
    "instruments" : [{
      "id" : "string",
      "group" : "string",
      "params" : {
        "max_position" : 100,
        "max_allowed_orders_per_level": 10,
        "max_allowed_levels" : 10,
        "layer_tolerance":5,
        "cooldown" : 100,
        "max_orders" : 100,
        "max_qty" : 100,
      }
    }],
    "state" : "up/paused/trading/down"
}

HEIMDALL API

Input

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/auth OPTIONS None None Preflight support for CORS queries
  POST HEIMDALL []HEIMDALL If authenticated properly with HEIMDALL body

EventBus

Heimdall model description

Request

{
    "username" : "string",
    "password" : "",
    "certificate" : ""
}

Response

{
    "authorization_token" : "",
    "expiration_date" : 1547947125
}

Details

The fields inside the model are described as follows:

SECTION NAME DESCRIPTION
body username Assigned username
  password Assigned password
  certificate BASE64 encoded public certificate
  authorization_token System assigned authorization token
  expiration_date Time and date when the token expires

VALI API

Input

REST

URI METHOD REQUEST RESPONSE DESCRIPTION
/vali GET None []VALI Returns collection of configured strategies in the system
  DELETE None None (asynchronous operation), reset all connections and reestablish them
/vali/:strategy_id GET None []COMMANDS Returns result of “status” command issued to the strategy
  POST []COMMANDS []COMMANDS Send updated set of commands
  PATCH []COMMANDS []COMMANDS Send updated set of commands
  DELETE None None (asynchronous operation), reset connection and reestablish it

VALI model description

{
    "id" : "string",
    "host" : "string",
    "port" : "port",
    "instruments" : ["string"],
    "connected" : true
}

VALI COMMANDS description

{
    "command" : "value",
    "scope"  : "string",
    "status" : "OK|FAILED"
}

EventBus

{
    "request_type" : "POST|GET|DELETE",
    "id" : "string",
    "commands" : [{
        "command" : "value",
        "scope" : "string",
        "status" : "OK|FAILED"
    }
    ]
}

Positions API

REST

Traders API

REST

TYR API

Input

REST

METHOD REQUEST REQUEST BODY RESPONSE BODY DESCRIPTION
/tyr OPTIONS None None Preflight support for CORS queries
/tyr/:instrument_id/:order_type/:trader_id GET TYR []TYR Returns collection of orders from the system if order_id: is not present, or refreshes existing order based on order_id:
/tyr/:order_id PATCH TYR None Update existing order based on :order_id
/tyr/:order_id PUT TYR None Replace existing order based on :order_id with new order
/tyr/:order_id DELETE None None Deletes order based on :order_id collection
/tyr POST TYR TYR Inserts new order.

Request

{
    "instrument_id" : "",
    "order_type" : "LIMIT",
    "tif" : "GTC",
    "qty" : 10,
    "price" : 10,
    "trader_id":"VNR001",
    "expiration" : "2019-01-01",
    "order_id" : ""
}

Response

{
    "instrument_id" : "uuid",
    "order_type" : "LIMIT",
    "tif" : "GTC",
    "qty" : 10,
    "price" : 10,
    "trader_id":"VNR001",
    "expiration" : "2019-01-01",
    "if_fill" : false,
    "last_filled_qty" : 1,
    "filled_qty" : 10,
    "order_id" : "b70fae6c"
}

Details

SECTION NAME DESCRIPTION
body instrument_id Valid instrument id
  order_type “LIMIT”,”STOP”,”MARKET”,”ICEBERG”,”BOC”,”AUCTION”,”ALGO”,”VALI” order type.
  qty Visible quantity of order in the market, positive number indicates BUY, negative - SELL, 0 - DELETE.
  price price of an order, if order type is LIMIT, it is a LIMIT price, if order type is stop, it is a STOP price, MARKET, AUCTION order type ignores it, USER_01 uses it as a reference price.
  tif Time in force: default GTD, GTC, IOC, FOK
  trader_id Internal trader id value.
  expiration order expiration date (if applicable)
  if_fill is it fill information only flag
  last_filled_qty last filled quantity
  filled_qty total filled quantity
  order_id Internal order id

EventBus [ /:trader_id ]

{
    "instrument_id" : "uuid",
    "order_type" : "LIMIT",
    "tif" : "GTC",
    "qty" : 10,
    "price" : 10,
    "trader_id":"VNR001",
    "expiration" : "2019-01-01",
    "if_fill" : false,
    "last_filled_qty" : 1,
    "filled_qty" : 10,
    "order_id" : "b70fae6c"
}

NSQ

{
       "instrument_id" : "uuid",
       "order_type" : "LIMIT",
       "tif" : "GTC",
       "qty" : 10,
       "price" : 10,
       "trader_id":"VNR001",
       "expiration" : "2019-01-01",
       "if_fill" : false,
       "last_filled_qty" : 1,
       "filled_qty" : 10,
       "order_id" : "b70fae6c"
}

AI Laboratory

VANIR API

REST

EventBus