REST API

Simple HTTP-based application program interface (API) allows traders to interact with the ICBIT trading engine automatically using their own software.

Limits

Please do not make more than 600 requests per 10 minutes from the same IP address, otherwise this IP address will be banned. If you need more frequent interaction then please consider using the streaming API.

Authentication

All API calls require authentication. Request is authenticated by using three parameters:

  • API_KEY
  • NONCE
  • SIGNATURE

API_KEY is an alphanumeric string used for authenticating the session.
NONCE is a 32 bit integer value which must always be greater than the previously used value for this call. Sometimes it makes sense to use unix time as nonce.
SIGNATURE is generated for every connect request using your user id, your API secret and nonce value.

API keys and secrets can be obtained from the API page in your profile.

Signature generation algorithm is identical to the one used by Bitstamp: it's a HMAC-SHA256 encoded string consisting from concatenated nonce, user id and api key values.

Signature generation in Python:

message = nonce + user_id + api_key
signature = hmac.new(API_SECRET, msg=message, digestmod=hashlib.sha256).hexdigest().upper()

Signature generation in C# is implemented in SharpTrader.

Public Requests

Order Book

GET https://api0.orderbook.net/api/orders/book

Params:

ticker
short trading instrument's code (e.g. BUU4 for BTC/USD-9.14 futures contract)

Returns JSON dictionary with "buy"s and "sell"s. Each entry is a JSON dictionary of price level "p" and total quantity at that level "q".

Symbols

GET https://api0.orderbook.net/api/symbols

Params: None

Returns JSON dictionary of all tradable instruments and their parameters.

Private Requests

Create Order

POST https://api0.orderbook.net/api/orders/create

Params:

key
API key
signature
signature
nonce
nonce value
ticker
short trading instrument's code (e.g. BUU4 for BTC/USD-9.14 futures contract)
price
price in trading instrument's units
qty
quantity
buy
should be set to "true" or "1" to create a buy order, and "false" or "0" to create a sell order
token
optional 64 bit integer user value

Returns JSON dictionary representing created order:

oid
order id
date
order timestamp
dir
1 if this is a buy order, 0 for a sell order
type
0 for a limit order
price
price
qty
quantity
exec_qty
0
status
order status
info
0
token
user specified value
ticker
trading instrument code
currency
trading instrument accounting currency code
market
market id (1 for derivatives market)

Cancel Order

POST https://api0.orderbook.net/api/orders/cancel

Params:

key
API key
signature
signature
nonce
nonce value
id
order ID

Returns a JSON dictionary containing order id and market id in case of a success, and error message otherwise.

Your Orders

POST https://api0.orderbook.net/api/orders/all

Params:

key
API key
signature
signature
nonce
nonce value

Returns JSON array of your orders. Each order is represented as dictionary:

oid
order id
date
timestamp when the order was created
dir
buy or sell order (1 = buy, 0 = sell)
type
order type (limit, market, stop-loss, etc)
price
limit price for limit order
qty
total quantity
exec_qty
executed quantity
status
order status
info
extended order information status
token
user defined value
ticker
short code of the instrument
currency
accounting currency of the instrument
market
1 for derivatives market, 0 for stock/currency market

Your Trades

POST https://api0.orderbook.net/api/trades

Params:

key
API key
signature
signature
nonce
nonce value
since
the oldest date (timestamp) after which you wish to receive trading history
limit
how many trades you wish to get at once (max. possible value for now is 500 trades records at once)

Returns JSON array of your trades sorted by timestamp descending (which means, the first array element will contain the newest trade). Each trade is represented as an object:

tid
trade id
sid
session id
ts
timestamp of the trade
buy
buy or sell trade (1 = buy, 0 = sell)
ticker
short code of the instrument
price
limit price for limit order
qty
total quantity
market
1 for derivatives market, 0 for stock/currency market

Balance and Positions

POST https://api0.orderbook.net/api/balance

Params:

key
API key
signature
signature
nonce
nonce value

Returns JSON array of user positions in securities and currencies, identified by tickers, with additional information.