C2 Market Maker Websocket API Documentation

1. Authentication

The purpose of authentication and authorization is to deny public access to private resources and minimize the possibility of access leak.

1.1. Tokens

Our security model uses two types of tokens: access token and refresh token. This is the default security model for Spring MVC.

Access token is used to sign each REST API request and websocket STOMP CONNECT request. Requests without access token or with expired access token will be denied with AccessDenied error code. Access token is usually valid only for a short period of time, so that if someone who has stolen it could not use it for a long period of time.

Refresh token is used for retrieving new access token, once previous was expired. Refresh token is usually valid for a long period of time, since it cannot be updated. Expiration of the refresh token will result in user logout.

Since websocket works over a single TCP connection we suppose that it is secured enough and it’s messages don’t need to be signed, once the first authentication succeeds. That is why we only require STOMP CONNECT request to be signed by a valid access token. This request is sent each time a new websocket connection is established, so on reconnecting you need to make sure you have a valid access token, and update it using refresh token if needed.

Tokens can be requested via REST API (see REST API documentation).

1.2. Connect

The connection endpoint path is /websocket/v0 (ex, ws://localhost:8990/websocket/v0)

Websocket requires authentication token after connection. To use: add authentication token (access_token) for CONNECT STOMP message to headers. For example:

CONNECT
authorization:f99b9f57-cf69-4715-ad42-5d6c92d23e06
accept-version:1.0,1.1,1.2
heart-beat:10000,10000

Field accept-version is required by STOP specification. Supported versions are 1.0, 1.1 and 1.2.

Field heart-beat specifies outgoing and incoming heart-beats rate (the smallest number of milliseconds between heart-beats). If this is not specified, websocket connection can be disconnected if no outgoing/incoming messages are send during a significant amount of time. 10000 is default and it is advisable not to set timeouts less than that.

If Access Denied error is received, client should update access token, using provided refresh token and recreate websocket connection, since any STOMP ERROR breaks the connection.

1.3. Keep Alive

In websocket session is kept alive by STOMP HEARTBEAT messages. Since default timeout for HEARTBEAT websocket messages is 10 seconds it is strongly advised not to set keepalive timeout less then 10 seconds.

Why not use refresh token validity time for this purpose? On the one hand, we don’t want to logout active users too often, so refresh token timeout is usually wanted to be large - at least several days, or even months. On the other hand, we don’t want to keep user’s data in memory during such long period of time. Usually logouting user that left several hours or even minutes ago won’t have any negative effects.

2. Websocket API

2.1. General principles

STOMP messaging protocol is used for websocket communication. STOMP versions 1.0, 1.1 and 1.2 are supported by backend.

All per-user subscriptions are sent to /user/…​ channels.
All broadcast subscriptions are sent to /topic/…​ channels.

In case of request error, STOMP MESSAGE will be returned with header status containing 4xx HTTP error code.
In case of server error, STOMP MESSAGE will be returned with header status containing 5xx HTTP error code.

2.2. Resources

Table 1. Resources
Resource Path Method Description

Config Updates

/topic/config

SUBSCRIBE

Source Market Data

/user/topic/source-market-data/{algo_id}

SUBSCRIBE

Target Market Data

/user/topic/target-market-data/{algo_id}

SUBSCRIBE

Hedger Market Data

/user/topic/hedger-market-data/{algo_id}

SUBSCRIBE

FX Market Data

/user/topic/fx-market-data/{algo_id}

SUBSCRIBE

Trading Statistics

/topic/trading-statistics

SUBSCRIBE

Risk Statistics

/topic/risk-statistics

SUBSCRIBE

Alerts

/topic/alerts

SUBSCRIBE

Orders

/user/topic/orders/{algo_id}

SUBSCRIBE

Trades

/user/topic/trades/{algo_id}

SUBSCRIBE

Balances

/topic/balances/{algo_id}

SUBSCRIBE

2.3. Data Types

Table 2. Data Types
Type Description

ConfigDto

Config Message

L2Action

L2 action.

L2EntryDto

Represents L2 entry.

L2PackageDto

Represents L2 package for the specified symbol.

L2PackageType

Type of the L2 package.

TradingStatisticsDto

Trading Statistics of Bot

RiskStatisticsDto

Trading Statistics of Bot

AlertDto

Alert Message

OrderDto

Order Message

TradeDto

Trade Message

BalanceDto

Balance Message

ConfigUpdateDto

Config Update Message

ActionType

Config Update Action

ConfigType

Config Update Type

2.4. Resources details

2.4.1. Source Market Data

/user/topic/source-market-data/{algo_id}
Subscription for source market data updates.

Snapshots and incremental updates intervals are controlled by Market Maker Backend configuration and specified corresponding to 2 and 1 seconds by default.

Request Parameters
Table 3. Request Parameters of Source Market Data
name type description constraints

algo_id

number

Bot ID updates are for.

required

id

header

Subscription identifier.

required

destination

header

Destination path.

required

Message Body
Table 4. Message body of Source Market Data
media type data type description

application/json

L2PackageDto

L2 snapshot or update.

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/source-market-data/1

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/source-market-data/1

Message:

MESSAGE
status:200
destination:/user/topic/source-market-data/1
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-14697
content-length:5128

{
  "timestamp" : 12345,
  "security_id" : "BTCUSD",
  "type" : "snapshot_full_refresh",
  "entries" : [ {
    "price" : "1234",
    "quantity" : "1234",
    "side" : "sell",
    "action" : "delete_through",
    "level" : 12345,
    "number_of_orders" : 12345
  }, {
    "price" : "1234",
    "quantity" : "1234",
    "side" : "sell",
    "action" : "update",
    "level" : 12345,
    "number_of_orders" : 12345
  } ],
  "sequence_number" : 12345
}

2.4.2. Target Market Data

/user/topic/target-market-data/{algo_id}
Subscription for target market data updates.

The API is the same as Source Market Data.

2.4.3. Hedger Market Data

/user/topic/target-market-data/{algo_id}
Subscription for hedger market data updates.

The API is the same as Source Market Data.

2.4.4. FX Market Data

/user/topic/fx-market-data/{algo_id}
Subscription for FX market data updates.

The API is the same as Source Market Data.

2.4.5. Market Maker Quotes

/topic/quotes/{algo_id}
Subscription for market maker quotes updates.

The API is the same as Source Market Data.

2.4.6. Trading Statistics

/topic/trading-statistics
Subscription for trading statistics.

Request Parameters
Table 5. Request Parameters of Source Market Data
name type description constraints

destination

header

Destination path.

required

id

header

Subscription identifier.

required

Message Body
Table 6. Message body of Source Market Data
media type data type description

application/json

array of TradingStatisticsDto

Snapshot of statistics for all bots

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/topic/trading-statistics

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/topic/trading-statistics

Message:

MESSAGE
status:200
destination:/topic/trading-statistics
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-14697
content-length:5128

[
    {
        "algo_key":"MM",
        "algo_id":1,
        "start_time":1552918573463,
        "open_buy_qty":"1234.1234",
        "open_sell_qty":"1234.1234",
        "quoter_bot_qty":1234.1234,
        "hedger_bot_qty":1234.1234,
        "quoter_sld_qty":1234.1234,
        "hedger_sld_qty":1234.1234,
        "quoter_net_qty":"1234.1234",
        "hedger_net_qty":"1234.1234",
        "current_position_size":"1234.1234",
        "position_cost":1234.1234,
        "position_market_price":1234.1234,
        "pnl":1234.1234,
        "account_pnl":1234.1234,
        "net_pnl":1234.1234,
        "fees":1234.1234
    },
    {
        "algo_key":"MM",
        "algo_id":2,
        "start_time":1552918573463,
        "open_buy_qty":"1234.1234",
        "open_sell_qty":"1234.1234",
        "quoter_bot_qty":1234.1234,
        "hedger_bot_qty":1234.1234,
        "quoter_sld_qty":1234.1234,
        "hedger_sld_qty":1234.1234,
        "quoter_net_qty":"1234.1234",
        "hedger_net_qty":"1234.1234",
        "current_position_size":"1234.1234",
        "position_cost":1234.1234,
        "position_market_price":1234.1234,
        "pnl":1234.1234,
        "account_pnl":1234.1234,
        "net_pnl":1234.1234,
        "fees":1234.1234
    }
]

2.4.7. Risk Statistics

/topic/risk-statistics
Subscription for risk statistics of currency.

Request Parameters
Table 7. Request Parameters of Source Market Data
name type description constraints

destination

header

Destination path.

required

id

header

Subscription identifier.

required

Message Body
Table 8. Message body of Source Market Data
media type data type description

application/json

array of RiskStatisticsDto

Snapshot of risk statistics for all currencies

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/topic/risk-statistics

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/topic/risk-statistics

Message:

MESSAGE
destination:/topic/risk-statistics
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-51228
content-length:655

[
    {
        "algo_key":"MM",
        "currency_id":1,
        "open_buy_qty":1234.1234,
        "open_sell_qty":1234.1234,
        "current_position_size":1234.1234
    },
    {
        "algo_key":"MM",
        "currency_id":2,
        "open_buy_qty":1234.1234,
        "open_sell_qty":1234.1234,
        "current_position_size":1234.1234
    }
]

2.4.8. Alerts

/topic/alerts
Subscription for alerts.

Request Parameters
Table 9. Request Parameters of Alerts Subscription
name type description constraints

destination

header

Destination path.

required

id

header

Subscription identifier.

required

Message Body
Table 10. Message body of Alerts
media type data type description

application/json

array of AlertDto

List of recent alerts

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/topic/alerts

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/topic/alerts

Message:

MESSAGE
destination:/topic/alerts
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-51228
content-length:655

[
    {
        "symbol":"BTCJPY",
        "exchange":"SHIFTFX",
        "level":"WARNING",
        "timestamp":1552988041288,
        "description":"Self Prevention: BTCJPY SELL 1.5 @ 441284.435",
        "action":"Ignore Order",
        "algo_id":24,
        "correlation_order_id":null,
        "duration":null,
        "color":null,
        "sequence":46258
    },
    {
        "symbol":"BTCJPY",
        "exchange":"SHIFTFX",
        "level":"WARNING",
        "timestamp":1552988041288,
        "description":"Self Prevention: BTCJPY SELL 1.5 @ 441284.435",
        "action":"Ignore Order",
        "algo_id":24,
        "correlation_order_id":null,
        "duration":null,
        "color":null,
        "sequence":46257
    }
]

2.4.9. Orders

/user/topic/orders/{algo_id}
Subscription for orders of bot.

Request Parameters
Table 11. Request Parameters of Orders Subscription
name type description constraints

algo_id

number

Bot ID updates are for.

required

id

header

Subscription identifier.

required

destination

header

Destination path.

required

Message Body
Table 12. Message body of Orders
media type data type description

application/json

array of OrderDto

List of recent orders

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/orders/1

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/orders/1

Message:

MESSAGE
status:200
destination:/user/topic/orders/1
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-51228
content-length:655

[
    {
        "algo_id":1,
        "timestamp":1552983850864,
        "source":"BITTREX",
        "side":"BUY",
        "exchange":"BITTREX",
        "initiator":"QUOTER",
        "size":"20",
        "executed_size":"0"
        "price":"0.01466406",
        "correlation_id":"1552560824721",
        "symbol":"LTCBTC",
        "order_type":"LIMIT",
        "time_in_force":"GOOD_TILL_CANCEL",
        "order_status":"CANCELED",
        "text":"",
    },
    {
        "algo_id":1,
        "timestamp":1552981182635,
        "source":"BITTREX",
        "side":"SELL",
        "exchange":"BITTREX",
        "initiator":"QUOTER",
        "size":"20",
        "executed_size":"0"
        "price":"0.0148962",
        "correlation_id":"1552560820122",
        "symbol":"LTCBTC",
        "order_type":"LIMIT",
        "time_in_force":"GOOD_TILL_CANCEL",
        "order_status":"CANCELED",
        "text":"",
    }
]

2.4.10. Trades

/user/topic/trades/{algo_id}
Subscription for trades of bot.

Request Parameters
Table 13. Request Parameters of Trades Subscription
name type description constraints

algo_id

number

Bot ID updates are for.

required

id

header

Subscription identifier.

required

destination

header

Destination path.

required

Message Body
Table 14. Message body of Trades
media type data type description

application/json

array of TradeDto

List of recent trades

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/trades/1

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/user/topic/trades/1

Message:

MESSAGE
status:200
destination:/user/topic/trades/1
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:41-51228
content-length:655

[
    {
        "algo_id":1,
        "timestamp":1552973135413,
        "order_source":"BITTREX"
        "side":"BUY",
        "exchange":"BITTREX",
        "execution_id":"1234",
        "order_correlation_id":"1234",
        "symbol":"LTCBTC",
        "execution_size":"20",
        "execution_price":"0.01467796",
    },
    {
        "algo_id":1,
        "timestamp":1552973135589,
        "order_source":"BINANCE"
        "side":"SELL",
        "exchange":"BINANCE",
        "execution_id":"4567",
        "order_correlation_id":"4567",
        "symbol":"LTCBTC",
        "execution_size":"17.31",
        "execution_price":"0.014774",
        "text":"",
    }
]

2.4.11. Balances

/topic/balances
Subscription for balances.

Request Parameters
Table 15. Request Parameters of Balances Subscription
name type description constraints

destination

header

Destination path.

required

id

header

Subscription identifier.

required

Message Body
Table 16. Message body of Trades
media type data type description

application/json

array of BalanceDto

List of current balances

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/topic/balances

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/topic/balances

Message:

MESSAGE
destination:/topic/balances
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:76713aed-31db-83fc-51c6-6b87ed6ac10c-4
content-length:100

[
    {
        "ccy":"BTC",
        "src":"BINANCE",
        "ts":1564665686887,
        "am":10,
        "av":10,
        "fr":10,
        "mr":10,
        "mra":10
    },
    {
        "ccy":"USD",
        "src":"BINANCE",
        "ts":1564665686887,
        "am":1000,
        "av":1000,
        "fr":1000,
        "mr":1000,
        "mra":1000
    }
]

2.4.12. Config Updates

/topic/config
Subscription for configuration updates.

Request Parameters
Table 17. Request Parameters of Config Updates Subscription
name type description constraints

destination

header

Destination path.

required

id

header

Subscription identifier.

required

Message Body
Table 18. Message body of Trades
media type data type description

application/json

ConfigUpdateDto

Example

Subscribe:

SUBSCRIBE
ack:auto
id:sub-0
destination:/topic/config

Unsubscribe:

UNSUBSCRIBE
ack:auto
id:sub-0
destination:/topic/config

Message:

MESSAGE
destination:/topic/config
content-type:application/json;charset=UTF-8
subscription:sub-0
message-id:4-18708
content-length:217

{
    "action_type":"UPDATED",
    "config_type":"INSTRUMENT",
    "config": {
        "instrument":"BTCJPY",
        "exchange":"DLTXMM",
        "underlyings":"BTCUSD",
        "running":false,
        "algo_id":2,
        "algo_key":"MM",
        "source_exchange":"KRAKEN",
        "fx_leg":"USDJPY",
        comments:""
    }
}

2.5. Data Types Details

2.5.1. L2Action

L2 action.

Values
Table 19. L2 Action data type
Value Description

trade

update

insert

delete

delete_from

delete_through

2.5.2. L2EntryDto

Represents L2 entry.

Properties
Table 20. L2 Entry data type
Name Data Type Description

exchange_id

string

Unique identifier of the exchange this entry is from. Absent if sending exchange id if forbidden in security settings for the user.

price

decimal

Price of this entry.

quantity

decimal

Quantity of this entry.

side

buy/sell

Side of this entry.

action

L2Action

Action of this entry.

level

number

Level of this entry.

number_of_orders

number

Number of active orders on this entry level.

Example
{
  "price" : "1234",
  "quantity" : "1234",
  "side" : "sell",
  "action" : "delete_through",
  "level" : 12345,
  "number_of_orders" : 12345
}

2.5.3. L2PackageDto

Represents L2 package for specified symbol.

Properties
Table 21. L2 Package data type
Name Data Type Description

sequence_number

number

Serial number of this package.

timestamp

number

Time of this update.

security_id

string

Implementation-specific security identifier of the security this snapshot is for.

type

L2PackageType

Type of this package.

entries

array of L2EntryDto

Entries of this package.

Example
{
  "timestamp" : 12345,
  "security_id" : "...",
  "type" : "snapshot_full_refresh",
  "entries" : [ {
    "price" : "1234",
    "quantity" : "1234",
    "side" : "sell",
    "action" : "delete_through",
    "level" : 12345,
    "number_of_orders" : 12345
  }, {
    "price" : "1234",
    "quantity" : "1234",
    "side" : "sell",
    "action" : "update",
    "level" : 12345,
    "number_of_orders" : 12345
  } ],
  "sequence_number" : 12345
}

2.5.4. L2PackageType

Type of the L2 package.

Properties
Table 22. L2 Type of Package data type
Value Description

snapshot_full_refresh

Full refresh of the available snapshot.

incremental_update

Incremental change in the available snapshot.

2.5.5. TradingStatisticsDto

Trading statistics of bot.

Properties
Table 23. Trading statistics of bot
Name Data Type Description

fees

decimal

algo_key

string

Algorithm name (MM)

algo_id

number

Unique ID of Bot

start_time

number

open_buy_qty

string

open_sell_qty

string

quoter_bot_qty

decimal

hedger_bot_qty

decimal

quoter_sld_qty

decimal

hedger_sld_qty

decimal

quoter_net_qty

string

hedger_net_qty

string

position_cost

decimal

current_position_size

string

position_cost

decimal

position_market_price

decimal

pnl

decimal

account_pnl

decimal

net_pnl

decimal

Example
{
    "algo_key":"MM",
    "algo_id":1,
    "start_time":1552918573463,
    "open_buy_qty":"1234.1234",
    "open_sell_qty":"1234.1234",
    "quoter_bot_qty":1234.1234,
    "hedger_bot_qty":1234.1234,
    "quoter_sld_qty":1234.1234,
    "hedger_sld_qty":1234.1234,
    "quoter_net_qty":"1234.1234",
    "hedger_net_qty":"1234.1234",
    "current_position_size":"1234.1234",
    "position_cost":1234.1234,
    "position_market_price":1234.1234,
    "pnl":1234.1234,
    "account_pnl":1234.1234,
    "net_pnl":1234.1234,
    "fees":1234.1234
}

2.5.6. RiskStatisticsDto

Risk statistics of currency.

Properties
Table 24. Trading statistics of bot
Name Data Type Description

current_position_size

decimal

algo_key

string

Algorithm name (MM)

algo_id

number

Unique ID of Currency

open_buy_qty

decimal

open_sell_qty

decimal

Example
{
    "algo_key":"MM",
    "currency_id":1,
    "open_buy_qty":1234.1234,
    "open_sell_qty":1234.1234,
    "current_position_size":1234.1234
}

2.5.7. AlertDto

Properties
Table 25. Alert message
Name Data Type Description

sequence

number

algo_id

number

Unique ID of bot

timestamp

number

symbol

string

exchange

string

color

string

description

string

action

string

duration

number

correlation_order_id

string

Example
{
    "symbol":"BTCJPY",
    "exchange":"SHIFTFX",
    "level":"WARNING",
    "timestamp":1552988041288,
    "description":"Self Prevention: BTCJPY SELL 1.5 @ 441284.435",
    "action":"Ignore Order",
    "algo_id":24,
    "correlation_order_id":null,
    "duration":null,
    "color":null,
    "sequence":46258
}

2.5.8. OrderDto

Properties
Table 26. Order message
Name Data Type Description

text

string

algo_id

number

Unique ID of bot

timestamp

number

exchange

string

symbol

string

source

string

side

BUY/SELL

initiator

string

size

decimal

executed_size

decimal

price

decimal

correlation_id

string

order_type

string

time_in_force

string

order_status

string

Example
{
    "algo_id":242,
    "timestamp":1552983850864,
    "source":"BITTREX",
    "side":"BUY",
    "exchange":"BITTREX",
    "initiator":"QUOTER",
    "size":"20",
    "executed_size":"0"
    "price":"0.01466406",
    "correlation_id":"1552560824721",
    "symbol":"LTCBTC",
    "order_type":"LIMIT",
    "time_in_force":"GOOD_TILL_CANCEL",
    "order_status":"CANCELED",
    "text":"",
}

2.5.9. TradeDto

Properties
Table 27. Trade message
Name Data Type Description

order_correlation_id

string

algo_id

number

Unique ID of bot

timestamp

number

exchange

string

symbol

string

order_source

string

side

BUY/SELL

execution_id

string

execution_size

decimal

execution_price

decimal

Example
{
        "algo_id":1,
        "timestamp":1552973135413,
        "order_source":"BITTREX"
        "side":"BUY",
        "exchange":"BITTREX",
        "execution_id":"1234",
        "order_correlation_id":"1234",
        "symbol":"LTCBTC",
        "execution_size":"20",
        "execution_price":"0.01467796",
}

2.5.10. BalanceDto

Properties
Table 28. Trade message
Name Data Type Description

mra

number

Margin Available

ccy

string

Currency

src

string

Exchange

ts

number

Timestamp

am

number

Amount

av

number

Available

fr

number

Frozen

mr

number

Margin

Example
{
    "ccy":"BTC",
    "src":"BINANCE",
    "ts":1564665686887,
    "am":10,
    "av":10,
    "fr":10,
    "mr":10,
    "mra":10
}

2.5.11. ConfigUpdateDto

Properties
Table 29. Config update message
Name Data Type Description

config

ConfigDto

action_type

ActionType

config_type

ConfigType

Example
{
    "action_type":"UPDATED",
    "config_type":"INSTRUMENT",
    "config": {
        "instrument":"BTCJPY",
        "exchange":"DLTXMM",
        "underlyings":"BTCUSD",
        "running":false,
        "algo_id":2,
        "algo_key":"MM",
        "source_exchange":"KRAKEN",
        "fx_leg":"USDJPY"
    }
}

2.5.12. ActionType

Values
Table 30. Config Update Action Type
Value Description

REMOVED

UPDATED

2.5.13. ConfigType

Values
Table 31. Config Update Action Type
Value Description

RISK_HEDGER

INSTRUMENT

PRICER

HEDGER

RISK_LIMITS

RISK

RISK_CURRENCY

CURRENCY_RISK_LIMITS

2.5.14. ConfigDto

Update Configuration depends on ConfigType:

INSTRUMENT
Table 32. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

algo_id

Number

Unique ID of the bot. Set null to create new instance, or provide valid ID to modify existing instance.

instrument

String

Trading instrument.

exchange

String

Target (quoting) exchange.

source_exchange

String

Source exchange names list. Comma or space separated.

underlyings

String

Underlying instrument, should be used in combination with FX leg.

fx_leg

String

FX pair used for quote price conversion from term currency of underlying to term currency of instrument.

fx_exchange

String

FX exchange names list. Comma or space separated.

comments

String

User comments to the bot.

running

Boolean

Trading status of the bot (running or stopped).

{
  "instrument" : "ADAETH",
  "exchange" : "BITTREX",
  "underlyings" : "ADABTC",
  "running" : false,
  "algo_id" : 3,
  "algo_key" : "MM",
  "source_exchange" : "BINANCE",
  "fx_leg" : "ETHBTC",
  "fx_exchange" : "KRAKEN",
  "comments" : null
}
PRICER
Table 33. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

algo_id

Number

Unique ID of the bot.

buy_quote_sizes

String

Array of sizes of buy quoting orders (bids). Whitespace or comma separated.

sell_quote_sizes

String

Array of sizes of sell quoting orders (asks). Whitespace or comma separated.

buy_margins

String

Array of margins/markdowns for buy quotes (in bps). Whitespace or comma separated.

sell_margins

String

Array of margins/markups for sell quotes (in bps). Whitespace or comma separated.

source_aggregation

String

BEST_AGGREGATED, BEST_SINGLE, WORST_SINGLE, BBO, MID_PT, REPLICATION

fx_aggregation

String

BBO

min_price_change

String

Minimal change of quote price (in bps).

min_spread

String

Minimal spread for buy and sell quotes. Minimal spread parameter can be specified in the following format: 'spread_value bps [bid_shift_weight]'. For example: '6 bps [30]'.

take_out

String

Take Out parameter. Take Out parameter can be specified in the following format: 'distance bps [quantity]'. For example: '8 bps [10]'.

bid_price_factor

String

Multiplier for the bid quote price:

BidQuotePrice = RoundTickDown(BaseBidPrice * BidPriceFactor * (1.0 – BuyMarginBps / 10,000));

ask_price_factor

String

Multiplier for the ask quote price:

AskQuotePrice = RoundTickUp(BaseAskPrice * AskPriceFactor (1.0 + SellMarginBps / 10,000));

max_bid

String

Specifies the worst price the trading bot can buy on the market. If quote bid price is above the limit, the order corresponding to this quote is immediately cancelled.

min_ask

String

Specifies the worst price the trading bot can sell on the market. If quote ask price is below the limit, the order corresponding to this quote is immediately cancelled.

min_size_change

String

Minimal change of quote size (in bps).

aggressive_mode

Boolean

This mode will allow sending only aggressive orders to an exchange when the take-out rule is triggered. Note, that it works only if take out value is specified for bot.

running

Boolean

Status of pricer (running or stopped).

{
  "running" : false,
  "algo_id" : 3,
  "algo_key" : "MM",
  "buy_quote_sizes" : "10000",
  "sell_quote_sizes" : "10000",
  "buy_margins" : "100",
  "sell_margins" : "100",
  "source_aggregation" : "BBO",
  "fx_aggregation" : "BBO",
  "min_price_change" : "5.0",
  "min_size_change" : null,
  "min_spread" : "1 bps",
  "take_out" : null,
  "bid_price_factor" : "1",
  "ask_price_factor" : "1",
  "max_bid" : "10",
  "min_ask" : "10",
  "aggressive_mode" : false
}
HEDGER
Table 34. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

algo_id

Number

Unique ID of the bot.

position_max_norm_size

String

Whitespace separated pair: max and normal position (in base units). When current position exceeds max limit and hedger is turned on, hedging algorithm will start working and will reduce current position size to the “normal” level.

hedge_strategy

String

LIMIT

execution_style

String

LEAN, PASSIVE, CROSS_MARKET

venues_list

String

Comma or whitespace separated list of exchanges to execute hedge order.

max_order_size

String

Hedging volume will be executed by parts, if this parameter value is less than volume to hedge.

resend_time

Number

Time interval between two subsequent child orders of hedging algorithm (in milliseconds).

hedge_instrument

String

Hedging instrument.

max_offset

String

This parameter controls max limit price of hedging algorithm. Specified as a distance (in term currency units or bps) from a first price, which is either a passive price (one tick distance from LEAN, PASSIVE), or lean price (LEAN, CROSS_MARKET).

hedge_qty_factor

String

Trading bot Current Position (CP) calculation if Hedge Qty Factor is explicitly specified:

CP = QuoterNetQty + HedgeQtyFactor*HedgerNetQty, where QuoterNetQty = QuoterBOTQty – QuoterSLDQty; HedgerNetQty = HedgerBOTQty – HedgerSLDQty;

max_bid

String

Specifies the worst price the trading bot can buy on the market. If quote bid price is above the limit, the order corresponding to this quote is immediately cancelled.

min_ask

String

Specifies the worst price the trading bot can sell on the market. If quote ask price is below the limit, the order corresponding to this quote is immediately cancelled.

custom_order_parameters

String

running

Boolean

Status of hedger (running or stopped).

Example
{
  "running" : false,
  "algo_id" : 3,
  "algo_key" : "MM",
  "position_max_norm_size" : "2000 0",
  "hedge_strategy" : "LIMIT",
  "execution_style" : "CROSS_MARKET",
  "venues_list" : "BINANCE",
  "max_order_size" : "10000",
  "resend_time" : 500,
  "hedge_instrument" : "ADABTC",
  "max_offset" : "20 bps",
  "hedge_qty_factor" : "1",
  "max_bid" : null,
  "min_ask" : null,
  "custom_order_parameters" : null
}
RISK_LIMITS
Table 35. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

algo_id

Number

Unique ID of the bot.

max_long_exposure

Number

This parameter limits worst case position calculated as sum of current position (in base units) of the bot and open buy quantity placed to the market.

max_short_exposure

Number

This parameter limits worst case position calculated as sum of current position (in base units) of the bot and open sell quantity placed to the market.

max_quoter_position_size

String

max_hedger_position_size

String

min_buy_quote_active_time

String

The minimum time (in milliseconds) to keep the buy side order on the market.

min_sell_quote_active_time

String

The minimum time (in milliseconds) to keep the sell side order on the market.

max_day_loss

Number

This parameter controls max day loss (in term currency units) for the bot. If current loss hits the limit, trading bot will be stopped.

Example
{
  "algo_id" : 3,
  "algo_key" : "MM",
  "max_long_exposure" : 11000.0,
  "max_short_exposure" : 11000.0,
  "max_quoter_position_size" : "100",
  "max_hedger_position_size" : "100",
  "min_buy_quote_active_time" : "300",
  "min_sell_quote_active_time" : "300",
  "max_day_loss" : 0.0
}
RISK
Table 36. Message fields
Path Type Description

algo_key

String

Algorithm key.

account_currency

String

Account currency.

cutoff_time

Number

Cutoff timestamp (in milliseconds since midnight).

last_reset_time

Null

Last cutoff timestamp (Unix time).

Example
{
  "algo_key" : "MM",
  "account_currency" : "BTC",
  "cutoff_time" : 57600000,
  "last_reset_time" : 0
}
RISK_CURRENCY
Table 37. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

currency_id

Number

Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency.

currency

String

Currency name.

exchange_algo_id

String

If null or empty value, risk limits/hedge logic will be applied to aggregate currency position/quantities. If exchange name is specified, risk limits/hedge logic will be applied to particular currency/exchange combination. If algorithm ID is specified, risk limits/hedge logic will be applied to particular currency/algorithm ID combination.

Example
{
  "currency" : "ADA",
  "currency_id" : 3,
  "algo_key" : "MM",
  "exchange_algo_id" : "3"
}
CURRENCY_RISK_LIMITS
Table 38. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

currency_id

Number

Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency.

max_long_exposure

Number

This parameter limits worst case long currency exposure calculated as a sum of current currency exposure and open quantity placed to the market.

max_short_exposure

Number

This parameter limits worst case short currency exposure calculated as a sum of current currency exposure and open quantity placed to the market.

Example

{
  "currency_id" : 3,
  "algo_key" : "MM",
  "max_long_exposure" : 11000.0,
  "max_short_exposure" : 11000.0
}
RISK_HEDGER
Table 39. Message fields
Path Type Description

algo_key

String

Market Maker algorithm key.

currency_id

Number

Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency.

position_max_norm_size

String

Whitespace separated pair: max and normal position (in base units). When current position exceeds max limit and hedger is turned on, hedging algorithm will start working and will reduce current position size to the “normal” level.

hedge_strategy

String

LIMIT

execution_style

String

LEAN, PASSIVE, CROSS_MARKET

venues_list

String

Comma or whitespace separated list of exchanges to execute hedge order.

max_order_size

String

Hedging volume will be executed by parts, if this parameter value is less than volume to hedge.

resend_time

Number

Time interval between two subsequent child orders of hedging algorithm (in milliseconds).

hedge_instrument

String

Hedging instrument.

max_offset

String

This parameter controls max limit price of hedging algorithm. Specified as a distance (in term currency units or bps) from a first price, which is either a passive price (one tick distance from LEAN, PASSIVE), or lean price (LEAN, CROSS_MARKET).

max_bid

String

min_ask

String

running

Boolean

Status (running or stopped).

Example
{
  "running" : false,
  "currency_id" : 3,
  "algo_key" : "MM",
  "position_max_norm_size" : "100 0",
  "hedge_strategy" : "LIMIT",
  "execution_style" : "CROSS_MARKET",
  "venues_list" : "BINANCE",
  "max_order_size" : "10000",
  "resend_time" : 500,
  "hedge_instrument" : "ADABTC",
  "max_offset" : "30 bps",
  "max_bid" : "300",
  "min_ask" : "300"
}