C2 Market Maker REST 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.

Each private REST API endpoint requires authentication token and token type. To use: add combination of token type (token_type) and access token (access_token) to request headers. For example:

Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167

1.2. Get authentication token

request
POST /oauth/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic bW13ZWJ1aTptbQ==
Host: localhost:8990

grant_type=password&username=admin&password=admin&scope=public

Where username and password is a user credentials.

curl request
curl 'http://localhost:8990/oauth/token' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Authorization: Basic bW13ZWJ1aTptbQ==' \
    -d 'grant_type=password&username=admin&password=admin&scope=public'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "access_token": "cd6b2fbb-4dbc-4399-803c-250a15b04167",
    "expires_in": 10079,
    "refresh_token": "3b4d5a82-bc3d-4b19-a188-2721f7171a45",
    "scope": "public",
    "token_type": "bearer"
}
Table 1. response parameters
Name Description

expires_in

Access token validity time (in seconds).

1.3. Refresh authentication token

request
POST /oauth/token
content-Type: application/x-www-form-urlencoded
authorization: Basic bW13ZWJ1aTptbQ==
Host: localhost:8990

grant_type=refresh_token&refresh_token=3b4d5a82-bc3d-4b19-a188-2721f7171a45
curl request
curl 'http://localhost:8990/oauth/token' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Authorization: Basic bW13ZWJ1aTptbQ==' \
    -d 'grant_type=refresh_token&refresh_token=3b4d5a82-bc3d-4b19-a188-2721f7171a45'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8

{
    "access_token": "f99b9f57-cf69-4715-ad42-5d6c92d23e06",
    "expires_in": 10079,
    "refresh_token": "3b4d5a82-bc3d-4b19-a188-2721f7171a45",
    "scope": "public",
    "token_type": "bearer"
}
Table 2. response parameters
Name Description

expires_in

Access token validity time (in seconds).

2. Algorithms

2.1. List of supported algorithms

Get a list of algorithms running on the server.

request
GET /api/v0/config/algorithms HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/algorithms' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 55
Content-Type: application/json;charset=UTF-8

[ {
  "name" : "C2 Market Maker",
  "key" : "MM"
} ]
Table 3. response fields
Path Type Description

[].name

String

Name of algorithm.

[].key

String

Unique algorithm key.

2.2. Full algorithm configuration

Get description of configurations of trading bots running by algorithm. Every bot has a unique algo ID assigned to it.

All configuration parameters are grouped into:

Instrument, Pricer, Hedger, and Risk Limits sections.

For more details, see CryptoCortex Market Maker User Guide [1]

request
GET /api/v0/config/algorithm/MM HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/algorithm/MM' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 4. /api/v0/config/algorithm/{algo_key}
Parameter Description

algo_key

Unique algorithm key.

response
HTTP/1.1 200 OK
Content-Length: 3819
Content-Type: application/json;charset=UTF-8

{
  "algorithm" : {
    "name" : "C2 Market Maker",
    "key" : "MM"
  },
  "configurations" : [ {
    "instrument_config" : {
      "instrument" : "ETHBTC",
      "exchange" : "BITTREX",
      "underlyings" : null,
      "running" : false,
      "algo_id" : 1,
      "algo_key" : "MM",
      "source_exchange" : "BINANCE",
      "fx_leg" : null,
      "fx_exchange" : null,
      "comments" : ""
    },
    "pricer_config" : {
      "running" : false,
      "algo_id" : 1,
      "algo_key" : "MM",
      "buy_quote_sizes" : "1",
      "sell_quote_sizes" : "1",
      "buy_margins" : "50",
      "sell_margins" : "50",
      "source_aggregation" : "BBO",
      "fx_aggregation" : null,
      "min_price_change" : "5",
      "min_size_change" : "0",
      "min_spread" : "3 bps",
      "take_out" : null,
      "bid_price_factor" : "100",
      "ask_price_factor" : "200",
      "max_bid" : "300",
      "min_ask" : "300",
      "aggressive_mode" : false,
      "resting_mode" : false
    },
    "hedger_config" : {
      "running" : false,
      "algo_id" : 1,
      "algo_key" : "MM",
      "position_max_norm_size" : "0.1 0",
      "hedge_strategy" : "LIMIT",
      "execution_style" : "CROSS_MARKET",
      "venues_list" : "BINANCE",
      "max_order_size" : "1",
      "resend_time" : 500,
      "hedge_instrument" : null,
      "max_offset" : "20 bps",
      "hedge_qty_factor" : null,
      "max_bid" : "300",
      "min_ask" : "300",
      "custom_order_parameters" : ""
    },
    "risk_limits_config" : {
      "algo_id" : 1,
      "algo_key" : "MM",
      "max_long_exposure" : 2.0,
      "max_short_exposure" : 2.0,
      "max_quoter_position_size" : null,
      "max_hedger_position_size" : null,
      "min_buy_quote_active_time" : null,
      "min_sell_quote_active_time" : null,
      "max_day_loss" : 0.0,
      "max_daily_loss" : 0.0
    }
  }, {
    "instrument_config" : {
      "instrument" : "USDJPY",
      "exchange" : "KRAKEN",
      "underlyings" : "ETHUSD",
      "running" : false,
      "algo_id" : 2,
      "algo_key" : "MM",
      "source_exchange" : "COINBASE GEMINI",
      "fx_leg" : "USDJPY",
      "fx_exchange" : "LMAX",
      "comments" : ""
    },
    "pricer_config" : {
      "running" : false,
      "algo_id" : 2,
      "algo_key" : "MM",
      "buy_quote_sizes" : "0.5 1",
      "sell_quote_sizes" : "0.5 1",
      "buy_margins" : "50 100",
      "sell_margins" : "50 100",
      "source_aggregation" : "BEST_AGGREGATED",
      "fx_aggregation" : "BBO",
      "min_price_change" : "10",
      "min_size_change" : "0",
      "min_spread" : "3 bps",
      "take_out" : null,
      "bid_price_factor" : null,
      "ask_price_factor" : null,
      "max_bid" : null,
      "min_ask" : null,
      "aggressive_mode" : false,
      "resting_mode" : false
    },
    "hedger_config" : {
      "running" : false,
      "algo_id" : 2,
      "algo_key" : "MM",
      "position_max_norm_size" : "0.2 0",
      "hedge_strategy" : "LIMIT",
      "execution_style" : "CROSS_MARKET",
      "venues_list" : "COINBASE GEMINI",
      "max_order_size" : "1",
      "resend_time" : 500,
      "hedge_instrument" : "ETHUSD",
      "max_offset" : "30 bps",
      "hedge_qty_factor" : "100",
      "max_bid" : "300",
      "min_ask" : "300",
      "custom_order_parameters" : ""
    },
    "risk_limits_config" : {
      "algo_id" : 2,
      "algo_key" : "MM",
      "max_long_exposure" : 3.0,
      "max_short_exposure" : 3.0,
      "max_quoter_position_size" : null,
      "max_hedger_position_size" : null,
      "min_buy_quote_active_time" : "300",
      "min_sell_quote_active_time" : "300",
      "max_day_loss" : 0.0,
      "max_daily_loss" : 0.0
    }
  } ]
}

2.3. Instrument configuration

2.3.1. Create/Update instrument

Update instrument section of the trading bot configuration or create a new bot.

request
POST /api/v0/config/instrument/save HTTP/1.1
Content-Length: 261
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json

{
  "instrument" : "ADAETH",
  "exchange" : "BITTREX",
  "underlyings" : "ADABTC",
  "running" : false,
  "algo_id" : null,
  "algo_key" : "MM",
  "source_exchange" : "BINANCE",
  "fx_leg" : "ETHBTC",
  "fx_exchange" : "KRAKEN",
  "comments" : null
}
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "instrument" : "ADAETH",
  "exchange" : "BITTREX",
  "underlyings" : "ADABTC",
  "running" : false,
  "algo_id" : null,
  "algo_key" : "MM",
  "source_exchange" : "BINANCE",
  "fx_leg" : "ETHBTC",
  "fx_exchange" : "KRAKEN",
  "comments" : null
}'
response
HTTP/1.1 200 OK
Content-Length: 258
Content-Type: application/json;charset=UTF-8

{
  "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
}
Table 5. request/response 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).

2.3.2. Get instrument

Get current values of parameters of the instrument section of trading bot configuration.

request
GET /api/v0/config/instrument/get/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/get/2' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 6. /api/v0/config/instrument/get/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 1758
Content-Type: application/json;charset=UTF-8

{
  "instrument_config" : {
    "instrument" : "USDJPY",
    "exchange" : "KRAKEN",
    "underlyings" : "ETHUSD",
    "running" : false,
    "algo_id" : 2,
    "algo_key" : "MM",
    "source_exchange" : "COINBASE GEMINI",
    "fx_leg" : "USDJPY",
    "fx_exchange" : "LMAX",
    "comments" : ""
  },
  "pricer_config" : {
    "running" : false,
    "algo_id" : 2,
    "algo_key" : "MM",
    "buy_quote_sizes" : "0.5 1",
    "sell_quote_sizes" : "0.5 1",
    "buy_margins" : "50 100",
    "sell_margins" : "50 100",
    "source_aggregation" : "BEST_AGGREGATED",
    "fx_aggregation" : "BBO",
    "min_price_change" : "10",
    "min_size_change" : "0",
    "min_spread" : "3 bps",
    "take_out" : null,
    "bid_price_factor" : null,
    "ask_price_factor" : null,
    "max_bid" : null,
    "min_ask" : null,
    "aggressive_mode" : false,
    "resting_mode" : false
  },
  "hedger_config" : {
    "running" : false,
    "algo_id" : 2,
    "algo_key" : "MM",
    "position_max_norm_size" : "0.2 0",
    "hedge_strategy" : "LIMIT",
    "execution_style" : "CROSS_MARKET",
    "venues_list" : "COINBASE GEMINI",
    "max_order_size" : "1",
    "resend_time" : 500,
    "hedge_instrument" : "ETHUSD",
    "max_offset" : "30 bps",
    "hedge_qty_factor" : "100",
    "max_bid" : "300",
    "min_ask" : "300",
    "custom_order_parameters" : ""
  },
  "risk_limits_config" : {
    "algo_id" : 2,
    "algo_key" : "MM",
    "max_long_exposure" : 3.0,
    "max_short_exposure" : 3.0,
    "max_quoter_position_size" : null,
    "max_hedger_position_size" : null,
    "min_buy_quote_active_time" : "300",
    "min_sell_quote_active_time" : "300",
    "max_day_loss" : 0.0,
    "max_daily_loss" : 0.0
  }
}

2.3.3. Delete instrument

Delete trading bot from the server.

request
DELETE /api/v0/config/instrument/delete/3 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/delete/3' -i -X DELETE \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 7. /api/v0/config/instrument/delete/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK

2.3.4. Start trading

Start trading bot.

request
POST /api/v0/config/instrument/start/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/start/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 8. /api/v0/config/instrument/start/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 260
Content-Type: application/json;charset=UTF-8

{
  "instrument" : "USDJPY",
  "exchange" : "KRAKEN",
  "underlyings" : "ETHUSD",
  "running" : true,
  "algo_id" : 2,
  "algo_key" : "MM",
  "source_exchange" : "COINBASE GEMINI",
  "fx_leg" : "USDJPY",
  "fx_exchange" : "LMAX",
  "comments" : ""
}

2.3.5. Stop trading

Stop trading bot.

request
POST /api/v0/config/instrument/stop/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/stop/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 9. /api/v0/config/instrument/stop/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 261
Content-Type: application/json;charset=UTF-8

{
  "instrument" : "USDJPY",
  "exchange" : "KRAKEN",
  "underlyings" : "ETHUSD",
  "running" : false,
  "algo_id" : 2,
  "algo_key" : "MM",
  "source_exchange" : "COINBASE GEMINI",
  "fx_leg" : "USDJPY",
  "fx_exchange" : "LMAX",
  "comments" : ""
}

2.3.6. Start all

Start all trading bots on the server.

request
POST /api/v0/config/instrument/startAll HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/startAll' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 509
Content-Type: application/json;charset=UTF-8

[ {
  "instrument" : "ETHBTC",
  "exchange" : "BITTREX",
  "underlyings" : null,
  "running" : true,
  "algo_id" : 1,
  "algo_key" : "MM",
  "source_exchange" : "BINANCE",
  "fx_leg" : null,
  "fx_exchange" : null,
  "comments" : ""
}, {
  "instrument" : "USDJPY",
  "exchange" : "KRAKEN",
  "underlyings" : "ETHUSD",
  "running" : true,
  "algo_id" : 2,
  "algo_key" : "MM",
  "source_exchange" : "COINBASE GEMINI",
  "fx_leg" : "USDJPY",
  "fx_exchange" : "LMAX",
  "comments" : ""
} ]

2.3.7. Stop all

Stop all running bots.

request
POST /api/v0/config/instrument/stopAll HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/stopAll' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 511
Content-Type: application/json;charset=UTF-8

[ {
  "instrument" : "ETHBTC",
  "exchange" : "BITTREX",
  "underlyings" : null,
  "running" : false,
  "algo_id" : 1,
  "algo_key" : "MM",
  "source_exchange" : "BINANCE",
  "fx_leg" : null,
  "fx_exchange" : null,
  "comments" : ""
}, {
  "instrument" : "USDJPY",
  "exchange" : "KRAKEN",
  "underlyings" : "ETHUSD",
  "running" : false,
  "algo_id" : 2,
  "algo_key" : "MM",
  "source_exchange" : "COINBASE GEMINI",
  "fx_leg" : "USDJPY",
  "fx_exchange" : "LMAX",
  "comments" : ""
} ]

2.4. Pricer configuration

2.4.1. Create/Update pricer

Create or update pricing section of the trading bot configuration.

request
POST /api/v0/config/pricer/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Content-Length: 511
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json

{
  "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,
  "resting_mode" : false
}
curl request
$ curl 'http://localhost:8990/api/v0/config/pricer/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "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,
  "resting_mode" : false
}'
response
HTTP/1.1 200 OK
Content-Length: 511
Content-Type: application/json;charset=UTF-8

{
  "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,
  "resting_mode" : false
}
Table 10. request/response 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, BEST_AGGREGATED_EXT, MID_AVG

fx_aggregation

String

BEST_AGGREGATED, BEST_SINGLE, WORST_SINGLE, BBO, MID_PT, REPLICATION, BEST_AGGREGATED_EXT, MID_AVG

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.

resting_mode

Boolean

This mode limits calculated SELL price to current Best Ask on Target - 1 tick and limits calculated BUY price to current Best Bid on Target + 1 tick in case of calculated price is on the top of the book. Note, resting mode works correctly only when trading bot has one level on each side.

running

Boolean

Status of pricer (running or stopped).

2.4.2. Start pricer

Start Pricer component of the trading bot.

request
POST /api/v0/config/pricer/start/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/pricer/start/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 11. /api/v0/config/pricer/start/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 528
Content-Type: application/json;charset=UTF-8

{
  "running" : true,
  "algo_id" : 2,
  "algo_key" : "MM",
  "buy_quote_sizes" : "0.5 1",
  "sell_quote_sizes" : "0.5 1",
  "buy_margins" : "50 100",
  "sell_margins" : "50 100",
  "source_aggregation" : "BEST_AGGREGATED",
  "fx_aggregation" : "BBO",
  "min_price_change" : "10",
  "min_size_change" : "0",
  "min_spread" : "3 bps",
  "take_out" : null,
  "bid_price_factor" : null,
  "ask_price_factor" : null,
  "max_bid" : null,
  "min_ask" : null,
  "aggressive_mode" : false,
  "resting_mode" : false
}

2.4.3. Stop pricer

Stop Pricer component of the trading bot.

request
POST /api/v0/config/pricer/stop/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/pricer/stop/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 12. /api/v0/config/pricer/stop/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 529
Content-Type: application/json;charset=UTF-8

{
  "running" : false,
  "algo_id" : 2,
  "algo_key" : "MM",
  "buy_quote_sizes" : "0.5 1",
  "sell_quote_sizes" : "0.5 1",
  "buy_margins" : "50 100",
  "sell_margins" : "50 100",
  "source_aggregation" : "BEST_AGGREGATED",
  "fx_aggregation" : "BBO",
  "min_price_change" : "10",
  "min_size_change" : "0",
  "min_spread" : "3 bps",
  "take_out" : null,
  "bid_price_factor" : null,
  "ask_price_factor" : null,
  "max_bid" : null,
  "min_ask" : null,
  "aggressive_mode" : false,
  "resting_mode" : false
}

2.5. Hedger configuration

2.5.1. Create/Update hedger

Create or update hedger section of the trading bot configuration.

request
POST /api/v0/config/hedger/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json
Content-Length: 430

{
  "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
}
curl request
$ curl 'http://localhost:8990/api/v0/config/hedger/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "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
}'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 430

{
  "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
}
Table 13. request/response 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 for the buy hedge order. If calculated hedge bid price is above the limit, the hedge order will be send with price equal to max_bid value.

min_ask

String

Specifies the worst price for the sell hedge order. If calculated hedge ask price is below the limit, the hedge order will be send with price equal to min_ask value.

custom_order_parameters

String

Additional parameters for client custom hedge algorithms

running

Boolean

Status of hedger (running or stopped).

2.5.2. Start hedger

Start hedger.

request
POST /api/v0/config/hedger/start/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/hedger/start/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 14. /api/v0/config/hedger/start/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 434
Content-Type: application/json;charset=UTF-8

{
  "running" : true,
  "algo_id" : 2,
  "algo_key" : "MM",
  "position_max_norm_size" : "0.2 0",
  "hedge_strategy" : "LIMIT",
  "execution_style" : "CROSS_MARKET",
  "venues_list" : "COINBASE GEMINI",
  "max_order_size" : "1",
  "resend_time" : 500,
  "hedge_instrument" : "ETHUSD",
  "max_offset" : "30 bps",
  "hedge_qty_factor" : "100",
  "max_bid" : "300",
  "min_ask" : "300",
  "custom_order_parameters" : ""
}

2.5.3. Stop hedger

Stop hedger.

request
POST /api/v0/config/hedger/stop/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/hedger/stop/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 15. /api/v0/config/hedger/stop/{algo_id}
Parameter Description

algo_id

Unique ID of the bot.

response
HTTP/1.1 200 OK
Content-Length: 435
Content-Type: application/json;charset=UTF-8

{
  "running" : false,
  "algo_id" : 2,
  "algo_key" : "MM",
  "position_max_norm_size" : "0.2 0",
  "hedge_strategy" : "LIMIT",
  "execution_style" : "CROSS_MARKET",
  "venues_list" : "COINBASE GEMINI",
  "max_order_size" : "1",
  "resend_time" : 500,
  "hedge_instrument" : "ETHUSD",
  "max_offset" : "30 bps",
  "hedge_qty_factor" : "100",
  "max_bid" : "300",
  "min_ask" : "300",
  "custom_order_parameters" : ""
}

2.6. Risk limits configuration

2.6.1. Create/Update risk limits

Create or update risk limit section of the trading bot configuration.

request
POST /api/v0/config/riskLimits/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json
Content-Length: 323

{
  "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,
  "max_daily_loss" : 0.0
}
curl request
$ curl 'http://localhost:8990/api/v0/config/riskLimits/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "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,
  "max_daily_loss" : 0.0
}'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 323

{
  "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,
  "max_daily_loss" : 0.0
}
Table 16. request/response 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

This parameter limits worst case quoter position calculated as sum of Quoter Net QTY (in base units) of the bot and open buy/sell quantity of quote orders placed to the market.

max_hedger_position_size

String

This parameter limits worst case hedger position calculated as sum of Hedger Net QTY (in base units of hedge instrument) of the bot and open buy/sell quantity of quote orders placed to the market.

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 loss (in term currency units) for the bot. If current loss hits the limit, trading bot will be stopped.

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

3. Risk configuration

3.1. Get risk configurations

request
GET /api/v0/config/risks HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 108
Content-Type: application/json;charset=UTF-8

[ {
  "algo_key" : "MM",
  "account_currency" : "BTC",
  "cutoff_time" : 0,
  "last_reset_time" : 0
} ]
Table 17. response 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

Number

Last cutoff timestamp (Unix time).

3.2. Create/Update risk configuration

request
POST /api/v0/config/risks/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json
Content-Length: 114

{
  "algo_key" : "MM",
  "account_currency" : "BTC",
  "cutoff_time" : 57600000,
  "last_reset_time" : null
}
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "algo_key" : "MM",
  "account_currency" : "BTC",
  "cutoff_time" : 57600000,
  "last_reset_time" : null
}'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 111

{
  "algo_key" : "MM",
  "account_currency" : "BTC",
  "cutoff_time" : 57600000,
  "last_reset_time" : 0
}

3.3. Full risk configuration

request
GET /api/v0/config/risks/MM HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/MM' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 18. /api/v0/config/algorithm/{algo_key}
Parameter Description

algo_key

Unique algorithm key.

response
HTTP/1.1 200 OK
Content-Length: 1271
Content-Type: application/json;charset=UTF-8

{
  "risk" : {
    "algo_key" : "MM",
    "account_currency" : "BTC",
    "cutoff_time" : 57600000,
    "last_reset_time" : 0
  },
  "configurations" : [ {
    "currency_config" : {
      "currency" : "ETH",
      "currency_id" : 1,
      "algo_key" : "MM",
      "exchange_algo_id" : null
    },
    "risk_limits_config" : {
      "currency_id" : 1,
      "algo_key" : "MM",
      "max_long_exposure" : 3.0,
      "max_short_exposure" : 3.0
    },
    "hedger_config" : null
  }, {
    "currency_config" : {
      "currency" : "JPY",
      "currency_id" : 2,
      "algo_key" : "MM",
      "exchange_algo_id" : "2"
    },
    "risk_limits_config" : {
      "currency_id" : 2,
      "algo_key" : "MM",
      "max_long_exposure" : 40000.0,
      "max_short_exposure" : 40000.0
    },
    "hedger_config" : {
      "running" : false,
      "currency_id" : 2,
      "algo_key" : "MM",
      "position_max_norm_size" : "20000 0",
      "hedge_strategy" : "LIMIT",
      "execution_style" : "CROSS_MARKET",
      "venues_list" : "LMAX",
      "max_order_size" : "1000",
      "resend_time" : 100,
      "hedge_instrument" : "USDJPY",
      "max_offset" : "3 bps",
      "max_bid" : "300",
      "min_ask" : "300"
    }
  } ]
}

3.4. Currency configuration

3.4.1. Create/Update currency configuration

request
POST /api/v0/config/risks/currency/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json
Content-Length: 102

{
  "currency" : "ADA",
  "currency_id" : null,
  "algo_key" : "MM",
  "exchange_algo_id" : "3"
}
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/currency/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "currency" : "ADA",
  "currency_id" : null,
  "algo_key" : "MM",
  "exchange_algo_id" : "3"
}'
response
HTTP/1.1 200 OK
Content-Length: 99
Content-Type: application/json;charset=UTF-8

{
  "currency" : "ADA",
  "currency_id" : 3,
  "algo_key" : "MM",
  "exchange_algo_id" : "3"
}
Table 19. request/response 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.

3.4.2. Get currency configuration

request
GET /api/v0/config/risks/currency/get/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/currency/get/2' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 20. /api/v0/config/risks/currency/get/{currency_id}
Parameter Description

currency_id

Currency ID.

response
HTTP/1.1 200 OK
Content-Length: 708
Content-Type: application/json;charset=UTF-8

{
  "currency_config" : {
    "currency" : "JPY",
    "currency_id" : 2,
    "algo_key" : "MM",
    "exchange_algo_id" : "2"
  },
  "risk_limits_config" : {
    "currency_id" : 2,
    "algo_key" : "MM",
    "max_long_exposure" : 40000.0,
    "max_short_exposure" : 40000.0
  },
  "hedger_config" : {
    "running" : false,
    "currency_id" : 2,
    "algo_key" : "MM",
    "position_max_norm_size" : "20000 0",
    "hedge_strategy" : "LIMIT",
    "execution_style" : "CROSS_MARKET",
    "venues_list" : "LMAX",
    "max_order_size" : "1000",
    "resend_time" : 100,
    "hedge_instrument" : "USDJPY",
    "max_offset" : "3 bps",
    "max_bid" : "300",
    "min_ask" : "300"
  }
}

3.4.3. Delete currency configuration

request
DELETE /api/v0/config/risks/currency/delete/3 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/currency/delete/3' -i -X DELETE \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 21. /api/v0/config/risks/currency/delete/{currency_id}
Parameter Description

currency_id

Currency ID.

response
HTTP/1.1 200 OK

3.5. Currency risk limits configuration

3.5.1. Create/Update currency risk limits configuration

request
POST /api/v0/config/risks/riskLimits/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Length: 116
Content-Type: application/json

{
  "currency_id" : 3,
  "algo_key" : "MM",
  "max_long_exposure" : 11000.0,
  "max_short_exposure" : 11000.0
}
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/riskLimits/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "currency_id" : 3,
  "algo_key" : "MM",
  "max_long_exposure" : 11000.0,
  "max_short_exposure" : 11000.0
}'
response
HTTP/1.1 200 OK
Content-Length: 116
Content-Type: application/json;charset=UTF-8

{
  "currency_id" : 3,
  "algo_key" : "MM",
  "max_long_exposure" : 11000.0,
  "max_short_exposure" : 11000.0
}
Table 22. request/response 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.

3.6. Currency hedger configuration

3.6.1. Create/Update currency hedger configuration

request
POST /api/v0/config/risks/hedger/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Length: 369
Content-Type: application/json

{
  "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"
}
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/hedger/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "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"
}'
response
HTTP/1.1 200 OK
Content-Length: 369
Content-Type: application/json;charset=UTF-8

{
  "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"
}
Table 23. request/response 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

Specifies the worst price for the buy hedge order. If calculated hedge bid price is above the limit, the hedge order will be send with price equal to max_bid value

min_ask

String

Specifies the worst price for the sell hedge order. If calculated hedge ask price is below the limit, the hedge order will be send with price equal to min_ask value

running

Boolean

Status (running or stopped).

3.6.2. Start currency hedger

request
POST /api/v0/config/risks/hedger/start/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/hedger/start/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 24. /api/v0/config/risks/hedger/start/{currency_id}
Parameter Description

currency_id

Currency ID.

response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 365

{
  "running" : true,
  "currency_id" : 2,
  "algo_key" : "MM",
  "position_max_norm_size" : "20000 0",
  "hedge_strategy" : "LIMIT",
  "execution_style" : "CROSS_MARKET",
  "venues_list" : "LMAX",
  "max_order_size" : "1000",
  "resend_time" : 100,
  "hedge_instrument" : "USDJPY",
  "max_offset" : "3 bps",
  "max_bid" : "300",
  "min_ask" : "300"
}

3.6.3. Stop currency hedger

request
POST /api/v0/config/risks/hedger/stop/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/risks/hedger/stop/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 25. /api/v0/config/risks/hedger/stop/{currency_id}
Parameter Description

currency_id

Currency ID.

4. User Access Control

4.1. Current user information

request
GET /api/v0/uac/user HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/user' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 91
Content-Type: application/json;charset=UTF-8

{
  "id" : 1,
  "login" : "admin",
  "password" : null,
  "roles" : [ "ROLE_ADMIN" ]
}

4.2. Users list

request
GET /api/v0/uac/users HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/users' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 287

[ {
  "id" : 1,
  "login" : "admin",
  "password" : null,
  "roles" : [ "ROLE_ADMIN" ]
}, {
  "id" : 2,
  "login" : "trader",
  "password" : null,
  "roles" : [ "ROLE_TRADER" ]
}, {
  "id" : 3,
  "login" : "rm",
  "password" : null,
  "roles" : [ "ROLE_RISK_MANAGER" ]
} ]

4.3. Save user

request
POST /api/v0/uac/user/save HTTP/1.1
Accept: application/json
Content-Length: 98
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json

{
  "id" : null,
  "login" : "user1",
  "password" : "user1",
  "roles" : [ "ROLE_TRADER" ]
}
curl request
$ curl 'http://localhost:8990/api/v0/uac/user/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "id" : null,
  "login" : "user1",
  "password" : "user1",
  "roles" : [ "ROLE_TRADER" ]
}'
response
HTTP/1.1 200 OK
Content-Length: 92
Content-Type: application/json;charset=UTF-8

{
  "id" : 4,
  "login" : "user1",
  "password" : null,
  "roles" : [ "ROLE_TRADER" ]
}
Table 26. request/response fields
Path Type Description

id

Number

Unique user ID. Set null to create new user.

login

String

Specify for newly created users. Immutable for existing users.

password

String

Set null to leave password unchanged.

roles

Array

See /api/v0/uac/roles to query available roles list.

4.4. Delete user

request
DELETE /api/v0/uac/user/delete/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/user/delete/2' -i -X DELETE \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 27. /api/v0/uac/user/delete/{user_id}
Parameter Description

user_id

Unique user ID.

response
HTTP/1.1 200 OK

4.5. Permissions list

request
GET /api/v0/uac/permissions HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/permissions' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 68

[ "WRITE_TRADING_CONFIG", "WRITE_RISK_CONFIG", "WRITE_USER_CONFIG" ]

4.6. Roles list

request
GET /api/v0/uac/roles HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/roles' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 322

[ {
  "id" : 1,
  "role" : "ROLE_ADMIN",
  "permissions" : [ "WRITE_TRADING_CONFIG", "WRITE_RISK_CONFIG", "WRITE_USER_CONFIG" ]
}, {
  "id" : 2,
  "role" : "ROLE_TRADER",
  "permissions" : [ "WRITE_TRADING_CONFIG" ]
}, {
  "id" : 3,
  "role" : "ROLE_RISK_MANAGER",
  "permissions" : [ "WRITE_RISK_CONFIG" ]
} ]

4.7. Save role

request
POST /api/v0/uac/role/save HTTP/1.1
Accept: application/json
Host: localhost:8990
Content-Length: 94
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json

{
  "id" : null,
  "role" : "ROLE_USER_ADMIN",
  "permissions" : [ "WRITE_USER_CONFIG" ]
}
curl request
$ curl 'http://localhost:8990/api/v0/uac/role/save' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "id" : null,
  "role" : "ROLE_USER_ADMIN",
  "permissions" : [ "WRITE_USER_CONFIG" ]
}'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 91

{
  "id" : 4,
  "role" : "ROLE_USER_ADMIN",
  "permissions" : [ "WRITE_USER_CONFIG" ]
}

4.8. Delete role

request
DELETE /api/v0/uac/role/delete/4 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/uac/role/delete/4' -i -X DELETE \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
Table 28. /api/v0/uac/role/delete/{role_id}
Parameter Description

role_id

Unique role ID.

response
HTTP/1.1 200 OK

5. Miscellaneous

5.1. Application version

request
GET /api/v0/config/version HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/version' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 164
Content-Type: application/json;charset=UTF-8

{
  "name" : "Crypto Cortex Market Maker",
  "version" : "0.9.1-SNAPSHOT",
  "timestamp" : 1631798334437,
  "db_version" : "1.0.0",
  "customer_info" : null
}
Table 29. response fields
Path Type Description

name

String

Application name.

version

String

Actual version.

db_version

String

Actual version of configuration database.

timestamp

Number

Application timestamp (Unix time).

customer_info

String

Customer label text.

5.2. Types

request
GET /api/v0/config/types HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/types' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 536

{
  "aggregation_methods" : [ "BEST_AGGREGATED", "BEST_SINGLE", "WORST_SINGLE", "BBO", "MID_PT", "REPLICATION", "BEST_AGGREGATED_EXT", "MID_AVG" ],
  "fx_aggregation_methods" : [ "BBO", "BEST_AGGREGATED", "BEST_SINGLE", "WORST_SINGLE", "MID_PT", "BEST_AGGREGATED_EXT", "MID_AVG" ],
  "hedge_order_params" : [ "LIMIT", "IOC" ],
  "execution_style" : [ "LEAN", "PASSIVE", "CROSS_MARKET", "RESTING", "IMPROVE", "DEPENDING" ],
  "hedge_strategies" : [ "LIMIT", "SOR" ],
  "balance_rule_conditions" : [ "EQUALS", "GREATER", "LESS" ]
}

5.3. Securities

request
GET /api/v0/securities HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/securities' -i -X GET \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK
Content-Length: 1025
Content-Type: application/json;charset=UTF-8

[ {
  "symbol" : "BTCUSD",
  "base_currency" : "BTC",
  "term_currency" : "USD",
  "price_precision" : "0.00001",
  "size_precision" : "0.00001",
  "significant_digits" : null,
  "is_inverse" : false,
  "is_quanto" : false,
  "is_index" : false,
  "multiplier" : null,
  "settlement_currency" : null,
  "exchange" : "COINBASE"
}, {
  "symbol" : "ETHUSD",
  "base_currency" : "ETH",
  "term_currency" : "USD",
  "price_precision" : "0.00001",
  "size_precision" : "0.00001",
  "significant_digits" : null,
  "is_inverse" : false,
  "is_quanto" : false,
  "is_index" : false,
  "multiplier" : null,
  "settlement_currency" : null,
  "exchange" : "COINBASE"
}, {
  "symbol" : "BTCJPY",
  "base_currency" : "BTC",
  "term_currency" : "JPY",
  "price_precision" : "0.00001",
  "size_precision" : "0.00001",
  "significant_digits" : null,
  "is_inverse" : false,
  "is_quanto" : false,
  "is_index" : false,
  "multiplier" : null,
  "settlement_currency" : null,
  "exchange" : "COINBASE"
} ]

5.4. Reset current position

request
POST /api/v0/config/instrument/cutoff/2 HTTP/1.1
Accept: application/json
Host: localhost:8990
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
curl request
$ curl 'http://localhost:8990/api/v0/config/instrument/cutoff/2' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167'
response
HTTP/1.1 200 OK

5.5. Add external order

request
POST /api/v0/trade/send HTTP/1.1
Accept: application/json
Host: localhost:8990
Content-Length: 511
Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167
Content-Type: application/json

{
  "account" : null,
  "algo_id" : 3,
  "exchange": "BITFINEX",
  "external_attributes" : [],
  "is_hedger" : false,
  "side" : "BUY",
  "symbol" : "ETHUSD",
  "trade_price" : "4296.1",
  "trade_quantity" : "0.01",
  "trader" : null,
  "trader_group" : null
}
curl request
$ curl 'http://localhost:8990/api/v0/trade/send' -i -X POST \
    -H 'Accept: application/json' \
    -H 'Authorization: bearer cd6b2fbb-4dbc-4399-803c-250a15b04167' \
    -H 'Content-Type: application/json' \
    -d '{
  "account" : null,
  "algo_id" : 3,
  "exchange": "BITFINEX",
  "external_attributes" : [],
  "is_hedger" : false,
  "side" : "BUY",
  "symbol" : "ETHUSD",
  "trade_price" : "4296.1",
  "trade_quantity" : "0.01",
  "trader" : null,
  "trader_group" : null
}'
response
HTTP/1.1 200 OK