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
Resource | Path | Method | Description |
---|---|---|---|
/topic/config |
SUBSCRIBE |
||
/user/topic/source-market-data/{algo_id} |
SUBSCRIBE |
||
/user/topic/target-market-data/{algo_id} |
SUBSCRIBE |
||
/user/topic/hedger-market-data/{algo_id} |
SUBSCRIBE |
||
/user/topic/fx-market-data/{algo_id} |
SUBSCRIBE |
||
/topic/trading-statistics |
SUBSCRIBE |
||
/topic/risk-statistics |
SUBSCRIBE |
||
/topic/alerts |
SUBSCRIBE |
||
/user/topic/orders/{algo_id} |
SUBSCRIBE |
||
/user/topic/trades/{algo_id} |
SUBSCRIBE |
||
/topic/balances/{algo_id} |
SUBSCRIBE |
2.3. Data Types
Type | Description |
---|---|
Config Message |
|
L2 action. |
|
Represents L2 entry. |
|
Represents L2 package for the specified symbol. |
|
Type of the L2 package. |
|
Trading Statistics of Bot |
|
Trading Statistics of Bot |
|
Alert Message |
|
Order Message |
|
Trade Message |
|
Balance Message |
|
Config Update Message |
|
Config Update Action |
|
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
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
media type | data type | description |
---|---|---|
application/json |
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
name | type | description | constraints |
---|---|---|---|
destination |
header |
Destination path. |
required |
id |
header |
Subscription identifier. |
required |
Message Body
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
name | type | description | constraints |
---|---|---|---|
destination |
header |
Destination path. |
required |
id |
header |
Subscription identifier. |
required |
Message Body
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
name | type | description | constraints |
---|---|---|---|
destination |
header |
Destination path. |
required |
id |
header |
Subscription identifier. |
required |
Message Body
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
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
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
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
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
name | type | description | constraints |
---|---|---|---|
destination |
header |
Destination path. |
required |
id |
header |
Subscription identifier. |
required |
Message Body
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
name | type | description | constraints |
---|---|---|---|
destination |
header |
Destination path. |
required |
id |
header |
Subscription identifier. |
required |
Message Body
media type | data type | description |
---|---|---|
application/json |
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
Value | Description |
---|---|
trade |
|
update |
|
insert |
|
delete |
|
delete_from |
|
delete_through |
2.5.2. L2EntryDto
Represents L2 entry.
Properties
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 |
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
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 |
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
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
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
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
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
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
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
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
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
Value | Description |
---|---|
REMOVED |
|
UPDATED |
2.5.13. ConfigType
Values
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
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of the bot. Set null to create new instance, or provide valid ID to modify existing instance. |
|
|
Trading instrument. |
|
|
Target (quoting) exchange. |
|
|
Source exchange names list. Comma or space separated. |
|
|
Underlying instrument, should be used in combination with FX leg. |
|
|
FX pair used for quote price conversion from term currency of underlying to term currency of instrument. |
|
|
FX exchange names list. Comma or space separated. |
|
|
User comments to the bot. |
|
|
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
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of the bot. |
|
|
Array of sizes of buy quoting orders (bids). Whitespace or comma separated. |
|
|
Array of sizes of sell quoting orders (asks). Whitespace or comma separated. |
|
|
Array of margins/markdowns for buy quotes (in bps). Whitespace or comma separated. |
|
|
Array of margins/markups for sell quotes (in bps). Whitespace or comma separated. |
|
|
BEST_AGGREGATED, BEST_SINGLE, WORST_SINGLE, BBO, MID_PT, REPLICATION |
|
|
BBO |
|
|
Minimal change of quote price (in bps). |
|
|
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 parameter. Take Out parameter can be specified in the following format: 'distance bps [quantity]'. For example: '8 bps [10]'. |
|
|
Multiplier for the bid quote price: BidQuotePrice = RoundTickDown(BaseBidPrice * BidPriceFactor * (1.0 – BuyMarginBps / 10,000)); |
|
|
Multiplier for the ask quote price: AskQuotePrice = RoundTickUp(BaseAskPrice * AskPriceFactor (1.0 + SellMarginBps / 10,000)); |
|
|
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. |
|
|
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. |
|
|
Minimal change of quote size (in bps). |
|
|
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. |
|
|
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
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of the bot. |
|
|
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. |
|
|
LIMIT |
|
|
LEAN, PASSIVE, CROSS_MARKET |
|
|
Comma or whitespace separated list of exchanges to execute hedge order. |
|
|
Hedging volume will be executed by parts, if this parameter value is less than volume to hedge. |
|
|
Time interval between two subsequent child orders of hedging algorithm (in milliseconds). |
|
|
Hedging instrument. |
|
|
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). |
|
|
Trading bot Current Position (CP) calculation if Hedge Qty Factor is explicitly specified: CP = QuoterNetQty + HedgeQtyFactor*HedgerNetQty, where QuoterNetQty = QuoterBOTQty – QuoterSLDQty; HedgerNetQty = HedgerBOTQty – HedgerSLDQty; |
|
|
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. |
|
|
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. |
|
|
|
|
|
Status of hedger (running or stopped). |
{
"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
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of the bot. |
|
|
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. |
|
|
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. |
|
|
|
|
|
|
|
|
The minimum time (in milliseconds) to keep the buy side order on the market. |
|
|
The minimum time (in milliseconds) to keep the sell side order on the market. |
|
|
This parameter controls max day loss (in term currency units) for the bot. If current loss hits the limit, trading bot will be stopped. |
{
"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
Path | Type | Description |
---|---|---|
|
|
Algorithm key. |
|
|
Account currency. |
|
|
Cutoff timestamp (in milliseconds since midnight). |
|
|
Last cutoff timestamp (Unix time). |
{
"algo_key" : "MM",
"account_currency" : "BTC",
"cutoff_time" : 57600000,
"last_reset_time" : 0
}
RISK_CURRENCY
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency. |
|
|
Currency name. |
|
|
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. |
{
"currency" : "ADA",
"currency_id" : 3,
"algo_key" : "MM",
"exchange_algo_id" : "3"
}
CURRENCY_RISK_LIMITS
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency. |
|
|
This parameter limits worst case long currency exposure calculated as a sum of current currency exposure and open quantity placed to the market. |
|
|
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
Path | Type | Description |
---|---|---|
|
|
Market Maker algorithm key. |
|
|
Unique ID of currency. Set null to create new currency, or provide valid ID to modify existing currency. |
|
|
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. |
|
|
LIMIT |
|
|
LEAN, PASSIVE, CROSS_MARKET |
|
|
Comma or whitespace separated list of exchanges to execute hedge order. |
|
|
Hedging volume will be executed by parts, if this parameter value is less than volume to hedge. |
|
|
Time interval between two subsequent child orders of hedging algorithm (in milliseconds). |
|
|
Hedging instrument. |
|
|
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). |
|
|
|
|
|
|
|
|
Status (running or stopped). |
{
"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"
}