Introduction

The Bitfinex API’s are designed to allow access to all of the features of the Bitfinex platform. The end goal is to allow people to potentially recreate the entire platform on their own.

If you would like to suggest changes to the documentation, please see the github at https://github.com/bitfinexcom/api_docs

Open Source Libraries

The following open source projects are works in progress. We will be continually improving them, but we want to release them early so that the community can take a look, make use of them, and offer pull requests. Nothing in the Bitcoin world exists in isolation.

Get Started    
Suggest Edits

Ticker

The ticker is a high level overview of the state of the market. It shows you the current best bid and ask, as well as the last trade price. It also includes information such as daily volume and how much the price has moved over the last day.

 
gethttps://api.bitfinex.com/v1/pubticker/Symbol
// Raw Javascript - replace symbol for other tickers
request.get(url + "/pubticker/btcusd",
  function(error, response, body) {
    console.log(body);
})

// Javascript Client - replace symbol for other tickers
bfx.rest.ticker('btcusd', cb)
#TODO
//TODO
curl https://api.bitfinex.com/v1/pubticker/btcusd
A binary file was returned

You couldn't be authenticated

{
  "mid":"244.755",
  "bid":"244.75",
  "ask":"244.76",
  "last_price":"244.82",
  "low":"244.2",
  "high":"248.19",
  "volume":"7842.11542563",
  "timestamp":"1444253422.348340958"
}
{
  "message": "Unknown symbol"
}

Path Params

Symbol
string
required

The symbol you want information about. You can find the list of valid symbols by calling the /symbols endpoint.

 

Response Details

Key Type Description
mid [price] (bid + ask) / 2
bid [price] Innermost bid
ask [price] Innermost ask
last_price [price] The price at which the last order executed
low [price] Lowest trade price of the last 24 hours
high [price] Highest trade price of the last 24 hours
volume [price] Trading volume of the last 24 hours
timestamp [time] The timestamp at which this information was valid
Suggest Edits

Stats

Various statistics about the requested pair.

 
gethttps://api.bitfinex.com/v1/stats/:Symbol
curl --request GET \
  --url https://api.bitfinex.com/v1/stats/:Symbol
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.bitfinex.com/v1/stats/:Symbol' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.bitfinex.com/v1/stats/:Symbol")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.bitfinex.com/v1/stats/:Symbol");

xhr.send(data);
import requests

url = "https://api.bitfinex.com/v1/stats/:Symbol"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[{
  "period":1,
  "volume":"7967.96766158"
},{
  "period":7,
  "volume":"55938.67260266"
},{
  "period":30,
  "volume":"275148.09653645"
}]

Path Params

symbol
string
required

The symbol you want information about. You can find the list of valid symbols by calling the /symbols endpoint.

 

Response Details

An array of the following:

Key Type Description
period [integer] Period covered in days
volume [price] Volume
Suggest Edits

Fundingbook

Get the full margin funding book

 
gethttps://api.bitfinex.com/v1/lendbook/currency
funding_book = client.funding_book
A binary file was returned

You couldn't be authenticated

{
  "bids":[{
    "rate":"9.1287",
    "amount":"5000.0",
    "period":30,
    "timestamp":"1444257541.0",
    "frr":"No"
  }],
  "asks":[{
    "rate":"8.3695",
    "amount":"407.5",
    "period":2,
    "timestamp":"1444260343.0",
    "frr":"No"
  }]
}

Path Params

currency
string
required
 

Request Details

Key Required Type Default Description
limit_bids false [int] 50 Limit the number of funding bids returned. May be 0 in which case the array of bids is empty
limit_asks false [int] 50 Limit the number of funding offers returned. May be 0 in which case the array of asks is empty

Response Details

Key Type Description
bids [array of funding bids]
rate [rate in % per 365 days]
amount [decimal]
period [days] Minimum period for the margin funding contract
timestamp [time]
frr [yes/no] “Yes” if the offer is at Flash Return Rate, “No” if the offer is at fixed rate
asks [array of funding offers]
rate [rate in % per 365 days]
amount [decimal]
period [days] Maximum period for the funding contract
timestamp [time]
frr [yes/no] “Yes” if the offer is at Flash Return Rate, “No” if the offer is at fixed rate
Suggest Edits

Orderbook

Get the full order book.

 
gethttps://api.bitfinex.com/v1/book/symbol
order_book = client.orderbook
A binary file was returned

You couldn't be authenticated

{
  "bids":[{
    "price":"574.61",
    "amount":"0.1439327",
    "timestamp":"1472506127.0"
  }],
  "asks":[{
    "price":"574.62",
    "amount":"19.1334",
    "timestamp":"1472506126.0"
  }]
}

Path Params

symbol
string
required
 

Request Details

Key Required Type Default Description
limit_bids false [int] 50 Limit the number of bids returned. May be 0 in which case the array of bids is empty
limit_asks false [int] 50 Limit the number of asks returned. May be 0 in which case the array of asks is empty
group false [0/1] 1 If 1, orders are grouped by price in the orderbook. If 0, orders are not grouped and sorted individually

Response Detail

key Type
bids [array]
price [price]
amount [decimal]
timestamp [time]
asks [array]
price [price]
amount [decimal]
timestamp [time]
Suggest Edits

Trades

Get a list of the most recent trades for the given symbol.

 
gethttps://api.bitfinex.com/v1/trades/symbol
trades = client.trades
A binary file was returned

You couldn't be authenticated

[{
  "timestamp":1444266681,
  "tid":11988919,
  "price":"244.8",
  "amount":"0.03297384",
  "exchange":"bitfinex",
  "type":"sell"
}]

Path Params

symbol
string
required
 

Request Details

Key Required Type Default Description
timestamp false [time] Only show trades at or after this timestamp
limit_trades false [int] 50 Limit the number of trades returned. Must be >= 1

Response Details

Key Type Description
tid [integer]
timestamp [time]
price [price]
amount [decimal]
exchange [string] "bitfinex"
type [string] “sell” or “buy” (can be “” if undetermined)
Suggest Edits

Lends

Get a list of the most recent funding data for the given currency: total amount provided and Flash Return Rate (in % by 365 days) over time.

 
gethttps://api.bitfinex.com/v1/lends/currency
lends = client.lends
A binary file was returned

You couldn't be authenticated

[{
  "rate":"9.8998",
  "amount_lent":"22528933.77950878",
  "amount_used":"0.0",
  "timestamp":1444264307
}]

Path Params

currency
string
required
 

Request Details

Key Required Type Default Description
timestamp false [time] Only show data at or after this timestamp
limit_lends false [int] 50 Limit the amount of funding data returned. Must be >= 1

Response Details

Key Type Description
rate [decimal, % by 365 days] Average rate of total funding received at fixed rates, ie past Flash Return Rate annualized
amount_lent [decimal] Total amount of open margin funding in the given currency
amount_used [decimal] Total amount of open margin funding used in a margin position in the given currency
timestamp [time]
Suggest Edits

Symbols

A list of symbol names. Currently "btcusd","ltcusd","ltcbtc","ethusd","ethbtc","etcbtc","etcusd","rrtusd","rrtbtc","zecusd","zecbtc","xmrusd","xmrbtc","dshusd","dshbtc","bccbtc","bcubtc","bccusd","bcuusd","xrpusd","xrpbtc","iotusd","iotbtc","ioteth","eosusd","eosbtc","eoseth"

 
gethttps://api.bitfinex.com/v1/symbols
curl --request GET \
  --url https://api.bitfinex.com/v1/symbols
var request = require("request");

var options = { method: 'GET', url: 'https://api.bitfinex.com/v1/symbols' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.bitfinex.com/v1/symbols")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.bitfinex.com/v1/symbols");

xhr.send(data);
import requests

url = "https://api.bitfinex.com/v1/symbols"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[
  "btcusd",
  "ltcusd",
  "ltcbtc",
  ...
]
 
Suggest Edits

Symbol Details

Get a list of valid symbol IDs and the pair details.

 
gethttps://api.bitfinex.com/v1/symbols_details
curl --request GET \
  --url https://api.bitfinex.com/v1/symbols_details
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.bitfinex.com/v1/symbols_details' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.bitfinex.com/v1/symbols_details")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.bitfinex.com/v1/symbols_details");

xhr.send(data);
import requests

url = "https://api.bitfinex.com/v1/symbols_details"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[{
  "pair":"btcusd",
  "price_precision":5,
  "initial_margin":"30.0",
  "minimum_margin":"15.0",
  "maximum_order_size":"2000.0",
  "minimum_order_size":"0.01",
  "expiration":"NA"
},{
  "pair":"ltcusd",
  "price_precision":5,
  "initial_margin":"30.0",
  "minimum_margin":"15.0",
  "maximum_order_size":"5000.0",
  "minimum_order_size":"0.1",
  "expiration":"NA"
},{
  "pair":"ltcbtc",
  "price_precision":5,
  "initial_margin":"30.0",
  "minimum_margin":"15.0",
  "maximum_order_size":"5000.0",
  "minimum_order_size":"0.1",
  "expiration":"NA"
},
...
]
 

Response Details

Key Type Description
pair [string] The pair code
price_precision [integer] Maximum number of significant digits for price in this pair
initial_margin [decimal] Initial margin required to open a position in this pair
minimum_margin [decimal] Minimal margin to maintain (in %)
maximum_order_size [decimal] Maximum order size of the pair
expiration [string] Expiration date for limited contracts/pairs
Suggest Edits

Account Info

Return information about your account (trading fees)

 
posthttps://api.bitfinex.com/v1/account_infos
client.account_info
var payload = {
  "request": "/v1/account_infos",
  "nonce": Date.now().toString()
}
A binary file was returned

You couldn't be authenticated

[{
  "maker_fees":"0.1",
  "taker_fees":"0.2",
  "fees":[{
    "pairs":"BTC",
    "maker_fees":"0.1",
    "taker_fees":"0.2"
   },{
    "pairs":"LTC",
    "maker_fees":"0.1",
    "taker_fees":"0.2"
   },
   {
    "pairs":"ETH",
    "maker_fees":"0.1",
    "taker_fees":"0.2"
  }]
}]

Headers

X-BFX-APIKEY
string

Your API Key

X-BFX-PAYLOAD
string

JSON String of Payload in base64

X-BFX-SIGNATURE
string

SHA-384 HMAC of the Payload using your API Secret as the key

 
Suggest Edits

Account Fees

See the fees applied to your withdrawals

 
posthttps://api.bitfinex.com/v1/account_fees
response = client.fees # Not Yet Implemented
A binary file was returned

You couldn't be authenticated

{
  "withdraw":{
    "BTC": "0.0005",
    "LTC": 0,
    "ETH": 0,
    ...
  }
}
 
Suggest Edits

Summary

Returns a 30-day summary of your trading volume and return on margin funding.

 
posthttps://api.bitfinex.com/v1/summary
client.summary
A binary file was returned

You couldn't be authenticated

//response
{
  "trade_vol_30d":[
    {"curr":"BTC","vol":11.88696022},
    {"curr":"LTC","vol":0.0},
    {"curr":"ETH","vol":0.1},
    {"curr":"Total (USD)","vol":5027.63}
  ],
  "funding_profit_30d":[
    {"curr":"USD","amount":0.0},
    {"curr":"BTC","amount":0.0},
    {"curr":"LTC","amount":0.0},
    {"curr":"ETH","amount":0.0}
  ],
  "maker_fee":0.001,
  "taker_fee":0.002
}
 

Response Details

Key Type Description
trade_vol_30d [string] Trading volumes for any currency for the last 30 days
funding_profit_30d [string] Funding profits for any currency for the last 30 days
maker_fees [decimal] Your current fees for maker orders (limit orders not marketable, in percent)
taker_fees [decimal] Your current fees for taker orders (marketable order, in percent)
Suggest Edits

Deposit

Return your deposit address to make a new deposit.

 
posthttps://api.bitfinex.com/v1/deposit/new
new_address = client.deposit("bitcoin", "exchange")
A binary file was returned

You couldn't be authenticated

//response
{
  "result":"success",
  "method":"bitcoin",
  "currency":"BTC",
  "address":"1A2wyHKJ4KWEoahDHVxwQy3kdd6g1qiSYV"
}

Form Data

request
string
required
nonce
string
required
method
string
required

Method of deposit (methods accepted: “bitcoin”, “litecoin”, “ethereum”, “mastercoin” (tethers), "ethereumc", "zcash", "monero", "iota").

wallet_name
string
required

Wallet to deposit in (accepted: “trading”, “exchange”, “deposit”). Your wallet needs to already exist

renew
int32

Default is 0. If set to 1, will return a new unused deposit address

 

Important

Mastercoin currency deposit works only for verified accounts

Response Details

Key Type Description
result [string] “success” or “error”
method [string]
currency [string]
address [string] The deposit address (or error message if result = “error”)
Suggest Edits

Key Permissions

Check the permissions of the key being used to generate this request.

 
posthttps://api.bitfinex.com/v1/key_info
response = client.key_info
A binary file was returned

You couldn't be authenticated

{
  "account":{
    "read":true,
    "write":false
  },
  "history":{
    "read":true,
    "write":false
  },
  "orders":{
    "read":true,
    "write":true
  },
  "positions":{
    "read":true,
    "write":true
  },
  "funding":{
    "read":true,
    "write":true
  },
  "wallets":{
    "read":true,
    "write":true
  },
  "withdraw":{
    "read":null,
    "write":null
  }
}
 

Response Details

A JSON object with a key for each of the possible permissions whose value is another JSON object with both a read and write key which has a value of true or false.

Suggest Edits

Margin Information

See your trading wallet information for margin trading.

 
posthttps://api.bitfinex.com/v1/margin_infos
response = client.margin_infos
A binary file was returned

You couldn't be authenticated

[{
  "margin_balance":"14.80039951",
  "tradable_balance":"-12.50620089",
  "unrealized_pl":"-0.18392",
  "unrealized_swap":"-0.00038653",
  "net_value":"14.61609298",
  "required_margin":"7.3569",
  "leverage":"2.5",
  "margin_requirement":"13.0",
  "margin_limits":[{
    "on_pair":"BTCUSD",
    "initial_margin":"30.0",
    "margin_requirement":"15.0",
    "tradable_balance":"-0.329243259666666667"
  }],
  "message": "Margin requirement, leverage and tradable balance are now per pair. You will find them under margin_limits, for each pair. Please update your code as soon as possible."
}]
 

Response Details

Key Type Description
margin_balance [decimal] The USD value of all your trading assets (based on last prices)
unrealized_pl [decimal] The unrealized profit/loss of all your open positions
unrealized_swap [decimal] The margin funding used by all your open positions
net_value [decimal] Your net value (the USD value of your trading wallet, including your margin balance, your unrealized P/L and margin funding)
required_margin [decimal] The minimum net value to maintain in your trading wallet, under which all of your positions are fully liquidated
margin_limits [array] The list of margin limits for each pair. The array gives you the following information, for each pair
on_pair [string] The pair for which these limits are valid
initial_margin [decimal] The minimum margin (in %) to maintain to open or increase a position
tradable_balance [decimal] Your tradable balance in USD (the maximum size you can open on leverage for this pair)
margin_requirements [decimal] The maintenance margin (% of the USD value of all of your open positions in the current pair to maintain)
Suggest Edits

Wallet Balances

See your balances

 
posthttps://api.bitfinex.com/v1/balances
response = client.balances
A binary file was returned

You couldn't be authenticated

[{
  "type":"deposit",
  "currency":"btc",
  "amount":"0.0",
  "available":"0.0"
},{
  "type":"deposit",
  "currency":"usd",
  "amount":"1.0",
  "available":"1.0"
},{
  "type":"exchange",
  "currency":"btc",
  "amount":"1",
  "available":"1"
},{
  "type":"exchange",
  "currency":"usd",
  "amount":"1",
  "available":"1"
},{
  "type":"trading",
  "currency":"btc",
  "amount":"1",
  "available":"1"
},{
  "type":"trading",
  "currency":"usd",
  "amount":"1",
  "available":"1"
},
...]
 

Response Details

An array of wallet balances.

Key Type Description
type [string] “trading”, “deposit” or “exchange”
currency [string] Currency
amount [decimal] How much balance of this currency in this wallet
available [decimal] How much X there is in this wallet that is available to trade
Suggest Edits

Transfer Between Wallets

Allow you to move available balances between your wallets.

 
posthttps://api.bitfinex.com/v1/transfer
response = client.transfer(10, 'btc', "exchange", "deposit")
A binary file was returned

You couldn't be authenticated

[{
  "status":"success",
  "message":"1.0 USD transfered from Exchange to Deposit"
}]

Query Params

amount
int32
required

Amount to transfer.

currency
string
required

Currency of funds to transfer.

walletfrom
string
required

Wallet to transfer from.

walletto
string
required

Wallet to transfer to.

 

Response Details

Key Type Description
status [string] “success” or “error”
message [string] Success or error message
Suggest Edits

Withdrawal

Allow you to request a withdrawal from one of your wallet.

 
posthttps://api.bitfinex.com/v1/withdraw
response = client.withdraw("bitcoin","deposit",1000, address: "1DKwqRhDmVyHJDL4FUYpDmQMYA3Rsxtvur")
A binary file was returned

You couldn't be authenticated

[{
  "status":"success",
  "message":"Your withdrawal request has been successfully submitted.",
  "withdrawal_id":586829
}]

Query Params

withdraw_type
string
required

can be one of the following ['bitcoin', 'litecoin', 'ethereum', 'ethereumc', 'mastercoin', 'zcash', 'monero', 'wire', 'dash', 'ripple', 'eos']

walletselected
string
required

The wallet to withdraw from, can be “trading”, “exchange”, or “deposit”.

amount
string
required

Amount to withdraw.

address
string
required

(1) Destination address for withdrawal.

payment_id
string

Optional hex string to identify a Monero transaction

account_name
string

Account name

account_number
string
required

Account number

swift
string

The SWIFT code for your bank.

bank_name
string
required

Bank name

bank_address
string
required

Bank address

bank_city
string
required

Bank city

bank_country
string
required

Bank country

detail_payment
string

Message to beneficiary

expressWire
int32

“1” to submit an express wire withdrawal, “0” or omit for a normal withdrawal

intermediary_bank_name
string

Intermediary bank name

intermediary_bank_address
string

Intermediary bank address

intermediary_bank_city
string

Intermediary bank city

intermediary_bank_country
string

Intermediary bank country

intermediary_bank_account
string

Intermediary bank account

intermediary_bank_swift
string

Intermediary bank SWIFT

 

Note

For ALL withdrawals, you must supply the Withdrawal Type, the Wallet and the Amount.

For CRYPTOCURRENCY withdrawals, you will also supply the Address where the funds should be sent. If it is a monero transaction, you can also include a Payment ID.

For WIRE WITHDRAWALS, you will need to fill in the beneficiary bank information.

In some cases your bank will require the use of an intermediary bank, if this is the case, please supply those fields as well.

When submitting a Ripple Withdrawal via API, you should include tag in the payment_id field

Response Details

Key Type Description
status [string] “success” or “error”.
message [string] Success or error message
withdrawal_id [int] ID of the withdrawal (0 if unsuccessful)
Suggest Edits

New Order

Submit a new Order

 
posthttps://api.bitfinex.com/v1/order/new
client.new_order("BTCUSD", 100, "market", "sell", 0)
A binary file was returned

You couldn't be authenticated

// response
{
  "id":448364249,
  "symbol":"btcusd",
  "exchange":"bitfinex",
  "price":"0.01",
  "avg_execution_price":"0.0",
  "side":"buy",
  "type":"exchange limit",
  "timestamp":"1444272165.252370982",
  "is_live":true,
  "is_cancelled":false,
  "is_hidden":false,
  "was_forced":false,
  "original_amount":"0.01",
  "remaining_amount":"0.01",
  "executed_amount":"0.0",
  "order_id":448364249
}

Form Data

symbol
string
required

The name of the symbol (see /symbols).

amount
float
required

Order size: how much you want to buy or sell

price
float
required

Price to buy or sell at. Must be positive. Use random number for market orders.

side
string
required

Either “buy” or “sell”.

type
string
required

Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill” / “exchange market” / “exchange limit” / “exchange stop” / “exchange trailing-stop” / “exchange fill-or-kill”. (type starting by “exchange ” are exchange orders, others are margin trading orders)

exchange
string
is_hidden
boolean

true if the order should be hidden.

is_postonly
boolean

true if the order should be post only. Only relevant for limit orders.

use_all_available
int32

1 will post an order that will use all of your available balance.

ocoorder
boolean
required

Set an additional STOP OCO order that will be linked with the current order.

buy_price_oco
float
required

If ocoorder is true, this field represent the price of the OCO stop order to place

sell_price_oco
float
required

If ocoorder is true, this field represent the price of the OCO stop order to place

 

Response Details

Key Type Description
order_id [int64] An order object containing the order’s ID as well as all the information provided by /order/status
Suggest Edits

Multiple New Orders

Submit several new orders at once.

 
posthttps://api.bitfinex.com/v1/order/new/multi
response = client.multiple_orders([{symbol: "btcusd", amount: 10, price: 0, exchange: "bitfinex", side: "buy", type: "market"}])
A binary file was returned

You couldn't be authenticated

// response
{
  "order_ids":[{
    "id":448383727,
    "symbol":"btcusd",
    "exchange":"bitfinex",
    "price":"0.01",
    "avg_execution_price":"0.0",
    "side":"buy",
    "type":"exchange limit",
    "timestamp":"1444274013.621701916",
    "is_live":true,
    "is_cancelled":false,
    "is_hidden":false,
    "was_forced":false,
    "original_amount":"0.01",
    "remaining_amount":"0.01",
    "executed_amount":"0.0"
  },{
    "id":448383729,
    "symbol":"btcusd",
    "exchange":"bitfinex",
    "price":"0.03",
    "avg_execution_price":"0.0",
    "side":"buy",
    "type":"exchange limit",
    "timestamp":"1444274013.661297306",
    "is_live":true,
    "is_cancelled":false,
    "is_hidden":false,
    "was_forced":false,
    "original_amount":"0.02",
    "remaining_amount":"0.02",
    "executed_amount":"0.0"
  }],
  "status":"success"
}

Form Data

symbol
string
required

The name of the symbol (see /symbols).

amount
int32
required

Order size: how much you want to buy or sell

price
float
required

Price to buy or sell at. Must be positive. Use random number for market orders.

side
string
required

Either “buy” or “sell”.

type
string
required

Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill”.

exchange
string

"bitfinex"

 

Response Details

Key Type Description
order_id [array] An array of order objects each having their own unique ID, as well as the information given by /order/status for each of the orders opened.
Suggest Edits

Cancel Order

Cancel an order.

 
posthttps://api.bitfinex.com/v1/order/cancel
response = client.cancel_orders(448364249)
A binary file was returned

You couldn't be authenticated

{
  "id":446915287,
  "symbol":"btcusd",
  "exchange":null,
  "price":"239.0",
  "avg_execution_price":"0.0",
  "side":"sell",
  "type":"trailing stop",
  "timestamp":"1444141982.0",
  "is_live":true,
  "is_cancelled":false,
  "is_hidden":false,
  "was_forced":false,
  "original_amount":"1.0",
  "remaining_amount":"1.0",
  "executed_amount":"0.0"
}

Form Data

order_id
int64
required

The order ID given by /order/new

 

Response Details

Result of /order/status for the cancelled order.

Suggest Edits

Cancel Multiple Orders

Cancel multiples orders at once.

 
posthttps://api.bitfinex.com/v1/order/cancel/multi
response = client.cancel_orders([448402101, 448402099])
A binary file was returned

You couldn't be authenticated

{"result":"Orders cancelled"}

Form Data

order_ids
array of integers
required

An array of the order IDs given by /order/new or /order/new/multi.

 

Response Details

Confirmation of cancellation of the orders.

Suggest Edits

Cancel All Orders

Cancel all active orders at once.

 
posthttps://api.bitfinex.com/v1/order/cancel/all
response = client.cancel_orders
A binary file was returned

You couldn't be authenticated

{"result":"All orders cancelled"}
 

Response Details

Confirmation of cancellation of the orders.

Suggest Edits

Replace Order

Replace an order with a new one.

 
posthttps://api.bitfinex.com/v1/order/cancel/replace
response = client.replace_order(100,"usdbtc", 10, "market", "buy", 0)
A binary file was returned

You couldn't be authenticated

{
  "id":448411365,
  "symbol":"btcusd",
  "exchange":"bitfinex",
  "price":"0.02",
  "avg_execution_price":"0.0",
  "side":"buy",
  "type":"exchange limit",
  "timestamp":"1444276597.691580782",
  "is_live":true,
  "is_cancelled":false,
  "is_hidden":false,
  "was_forced":false,
  "original_amount":"0.02",
  "remaining_amount":"0.02",
  "executed_amount":"0.0",
  "order_id":448411365
}

Form Data

order_id
int64
required

The order ID given by /order/new.

symbol
string

The name of the symbol (see /symbols).

amount
int32

Order size: how much to buy or sell.

price
float

Price to buy or sell at. May omit if a market order.

exchange
string

“bitfinex”

side
string

Either “buy” or “sell”.

type
boolean

Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill” / “exchange market” / “exchange limit” / “exchange stop” / “exchange trailing-stop” / “exchange fill-or-kill”. (type starting by “exchange ” are exchange orders, others are margin trading orders)

is_hidden
string

true if the order should be hidden.

is_postonly
boolean

true if the order should be post only. Only relevant for limit orders.

use_remaining
boolean

True if the new order should use the remaining amount of the original order.

 

Response Details

Key Type Description
order_id [int64] A randomly generated ID for the order and the information given by /order/status.
Suggest Edits

Order Status

Get the status of an order. Is it active? Was it cancelled? To what extent has it been executed? etc.

 
posthttps://api.bitfinex.com/v1/order/status
response = client.order_status(448411153)
A binary file was returned

You couldn't be authenticated

{
  "id":448411153,
  "symbol":"btcusd",
  "exchange":null,
  "price":"0.01",
  "avg_execution_price":"0.0",
  "side":"buy",
  "type":"exchange limit",
  "timestamp":"1444276570.0",
  "is_live":false,
  "is_cancelled":true,
  "is_hidden":false,
  "oco_order":null,
  "was_forced":false,
  "original_amount":"0.01",
  "remaining_amount":"0.01",
  "executed_amount":"0.0"
}

Form Data

order_id
int64
required

The order ID given by /order/new.

 

Response Details

Key Type Description
symbol [string] The symbol name the order belongs to
exchange [string] “bitfinex”
price [decimal] The price the order was issued at (can be null for market orders)
avg_execution_price [decimal] The average price at which this order as been executed so far. 0 if the order has not been executed at all
side [string] Either “buy” or “sell”
type [string] Either “market” / “limit” / “stop” / “trailing-stop”
timestamp [time] The timestamp the order was submitted
is_live [bool] Could the order still be filled?
is_cancelled [bool] Has the order been cancelled?
is_hidden [bool] Is the order hidden?
oco_order [int64] If the order is an OCO order, the ID of the linked order. Otherwise, null
was_forced [bool] For margin only true if it was forced by the system
executed_amount [decimal] How much of the order has been executed so far in its history?
remaining_amount [decimal] How much is still remaining to be submitted?
original_amount [decimal] What was the order originally submitted for?
Suggest Edits

Active Orders

View your active orders.

 
posthttps://api.bitfinex.com/v1/orders
response = client.orders
A binary file was returned

You couldn't be authenticated

[{
  "id":448411365,
  "symbol":"btcusd",
  "exchange":"bitfinex",
  "price":"0.02",
  "avg_execution_price":"0.0",
  "side":"buy",
  "type":"exchange limit",
  "timestamp":"1444276597.0",
  "is_live":true,
  "is_cancelled":false,
  "is_hidden":false,
  "was_forced":false,
  "original_amount":"0.02",
  "remaining_amount":"0.02",
  "executed_amount":"0.0"
}]
 

Response Details

An array of the results of /order/status for all your live orders.

Suggest Edits

Positions

 
Suggest Edits

Active Positions

View your active positions.

 
posthttps://api.bitfinex.com/v1/positions
response = client.positions
A binary file was returned

You couldn't be authenticated

[{
  "id":943715,
  "symbol":"btcusd",
  "status":"ACTIVE",
  "base":"246.94",
  "amount":"1.0",
  "timestamp":"1444141857.0",
  "swap":"0.0",
  "pl":"-2.22042"
}]
 

Response Details

An array of your active positions.

Suggest Edits

Claim Position

A position can be claimed if:

It is a long position: The amount in the last unit of the position pair that you have in your trading wallet AND/OR the realized profit of the position is greater or equal to the purchase amount of the position (base price position amount) and the funds which need to be returned. For example, for a long BTCUSD position, you can claim the position if the amount of USD you have in the trading wallet is greater than the base price the position amount and the funds used.

It is a short position: The amount in the first unit of the position pair that you have in your trading wallet is greater or equal to the amount of the position and the margin funding used.

 
posthttps://api.bitfinex.com/v1/position/claim
client.claim_position(100,10)
A binary file was returned

You couldn't be authenticated

{
  "id":943715,
  "symbol":"btcusd",
  "status":"ACTIVE",
  "base":"246.94",
  "amount":"1.0",
  "timestamp":"1444141857.0",
  "swap":"0.0",
  "pl":"-2.2304"
}

Query Params

position_id
int32
required

The position ID given by /positions.

amount
int32
required

The partial amount you wish to claim.

 

Response Details

Status of the position for the claimed position, if the position could be claimed.

Suggest Edits

Historical Data

 
Suggest Edits

Balance History

View all of your balance ledger entries.

 
posthttps://api.bitfinex.com/v1/history
response = client.history
A binary file was returned

You couldn't be authenticated

[{
  "currency":"USD",
  "amount":"-246.94",
  "balance":"515.4476526",
  "description":"Position claimed @ 245.2 on wallet trading",
  "timestamp":"1444277602.0"
}]

Query Params

currency
string
required

The currency to look for.

since
date-time

Return only the history after this timestamp.

until
date-time

Return only the history before this timestamp.

limit
int32

Limit the number of entries to return.

wallet
string

Return only entries that took place in this wallet. Accepted inputs are: “trading”, “exchange”, “deposit”.

 

Response Details

Key Type Description
currency [string] Currency
amount [decimal] Positive (credit) or negative (debit)
balance [decimal] Wallet balance after the current entry
description [string] Description of the entry. Includes the wallet in which the operation took place
timestamp [time] Timestamp of the entry
Suggest Edits

Deposit-Withdrawal History

View your past deposits/withdrawals.

 
posthttps://api.bitfinex.com/v1/history/movements
response = client.movements
A binary file was returned

You couldn't be authenticated

[{
  "id":581183,
  "txid": 123456,
  "currency":"BTC",
  "method":"BITCOIN",
  "type":"WITHDRAWAL",
  "amount":".01",
  "description":"3QXYWgRGX2BPYBpUDBssGbeWEa5zq6snBZ, offchain transfer ",
  "address":"3QXYWgRGX2BPYBpUDBssGbeWEa5zq6snBZ",
  "status":"COMPLETED",
  "timestamp":"1443833327.0",
  "timestamp_created": "1443833327.1",
  "fee": 0.1
}]

Query Params

currency
string
required

The currency to look for.

method
string

The method of the deposit/withdrawal (can be “bitcoin”, “litecoin”, “darkcoin”, “wire”).

since
date-time

Return only the history after this timestamp.

until
date-time

Return only the history before this timestamp.

limit
int32

Limit the number of entries to return.

 

Response Details

An array of histories

Key Type Description
currency [string]
method [string]
type [string]
txid [long] Transmission ID
amount [decimal] Absolute value of the movement
description [string] Description of the movement (txid, destination address,...)
address [string] Deposit address used or withdrawal destination address
status [string] Status of the movement
timestamp [time] Timestamp of the movement
timestamp_created [time] Creation timestamp of the movement
fee [decimal] Fee
Suggest Edits

Past Trades

View your past trades.

 
posthttps://api.bitfinex.com/v1/mytrades
response = client.mytrades
A binary file was returned

You couldn't be authenticated

[{
  "price":"246.94",
  "amount":"1.0",
  "timestamp":"1444141857.0",
  "exchange":"",
  "type":"Buy",
  "fee_currency":"USD",
  "fee_amount":"-0.49388",
  "tid":11970839,
  "order_id":446913929
}]

Query Params

symbol
string
required

The pair traded (BTCUSD, …).

timestamp
date-time
required

Trades made before this timestamp won’t be returned.

until
date-time

Trades made after this timestamp won’t be returned.

limit_trades
int32

Limit the number of trades returned.

reverse
int32

Return trades in reverse order (the oldest comes first). Default is returning newest trades first.

 

Response Details

An array of trades.

Key Type Description
price [price]
amount [decimal]
exchange [string]
type [string] Sell or Buy
fee_currency [string] Currency you paid this trade’s fee in
fee_amount [decimal] Amount of fees you paid for this trade
tid [integer] unique identification number of the trade
order_id [integer] unique identification number of the parent order of the trade
Suggest Edits

Margin Funding

 
Suggest Edits

New Offer

Submit a new Offer

 
posthttps://api.bitfinex.com/v1/offer/new
response = client.new_offer("btc", 10.0, 20, 365, "lend")
A binary file was returned

You couldn't be authenticated

{
  "id":13800585,
  "currency":"USD",
  "rate":"20.0",
  "period":2,
  "direction":"lend",
  "timestamp":"1444279698.21175971",
  "is_live":true,
  "is_cancelled":false,
  "original_amount":"50.0",
  "remaining_amount":"50.0",
  "executed_amount":"0.0",
  "offer_id":13800585
}

Form Data

currency
string
required

The name of the currency.

amount
float
required

Order size: how much to lend or borrow.

rate
float
required

Rate to lend or borrow at. In percentage per 365 days. (Set to 0 for FRR).

period
int32
required

Number of days of the funding contract (in days)

direction
string
required

Either “lend” or “loan”.

 

Response Details

Key Type Description
id [int] A randomly generated ID for the offer and the information given by /offer/status
currency [string] The name of the currency.
rate [decimal] Rate to lend or borrow at. In percentage per 365 days. (Set to 0 for FRR).
period [integer] Number of days of the funding contract (in days)
direction [string] Either “lend” or “loan”.
is_live [bool] Could the offer still be filled?
is_cancelled [bool] Has the offer been cancelled?
executed_amount [decimal] How much of the offer has been executed so far in its history?
remaining_amount [decimal] How much is still remaining to be submitted?
original_amount [decimal] What was the offer originally submitted for?
Suggest Edits

Cancel Offer

Cancel an offer.

 
posthttps://api.bitfinex.com/v1/offer/cancel
response = client.cancel_offer(1000)
A binary file was returned

You couldn't be authenticated

{
  "id":13800585,
  "currency":"USD",
  "rate":"20.0",
  "period":2,
  "direction":"lend",
  "timestamp":"1444279698.0",
  "is_live":true,
  "is_cancelled":false,
  "original_amount":"50.0",
  "remaining_amount":"50.0",
  "executed_amount":"0.0"
}

Form Data

offer_id
int32
required

The offer ID given by /offer/new.

 

Response Details

Result of /offer/status for the cancelled offer.

Suggest Edits

Offer Status

Get the status of an offer. Is it active? Was it cancelled? To what extent has it been executed? etc.

 
posthttps://api.bitfinex.com/v1/offer/status
response = client.offer_status(1000)
A binary file was returned

You couldn't be authenticated

{
  "id":13800585,
  "currency":"USD",
  "rate":"20.0",
  "period":2,
  "direction":"lend",
  "timestamp":"1444279698.0",
  "is_live":false,
  "is_cancelled":true,
  "original_amount":"50.0",
  "remaining_amount":"50.0",
  "executed_amount":"0.0"
}

Form Data

offer_id
int32
required

The offer ID given by /offer/new.

 

Response Details

Key Type Description
currency [string] The currency name of the offer.
rate [decimal] The rate the offer was issued at (in % per 365 days).
period [integer] The number of days of the offer.
direction [string] Either “lend” or “loan”.
type [string] Either “market” / “limit” / “stop” / “trailing-stop”.
timestamp [time] The timestamp the offer was submitted.
is_live [bool] Could the offer still be filled?
is_cancelled [bool] Has the offer been cancelled?
executed_amount [decimal] How much of the offer has been executed so far in its history?
remaining_amount [decimal] How much is still remaining to be submitted?
original_amount [decimal] What was the offer originally submitted for?
Suggest Edits

Active Credits

View your funds currently taken (active credits).

 
posthttps://api.bitfinex.com/v1/credits
response = client.credits
A binary file was returned

You couldn't be authenticated

[{
  "id":13800719,
  "currency":"USD",
  "rate":"31.39",
  "period":2,
  "direction":"lend",
  "timestamp":"1444280237.0",
  "is_live":true,
  "is_cancelled":false,
  "original_amount":"50.0",
  "remaining_amount":"50.0",
  "executed_amount":"0.0"
}]
 

Response Details

An array of your active credits

Suggest Edits

Offers

View your active offers.

 
posthttps://api.bitfinex.com/v1/offers
response = client.offers
A binary file was returned

You couldn't be authenticated

[{
  "id":13800719,
  "currency":"USD",
  "rate":"31.39",
  "period":2,
  "direction":"lend",
  "timestamp":"1444280237.0",
  "is_live":true,
  "is_cancelled":false,
  "original_amount":"50.0",
  "remaining_amount":"50.0",
  "executed_amount":"0.0"
}]
 

Response Details

An array of the results of /offer/status for all your live offers (lending or borrowing).

Suggest Edits

Active Funding Used in a margin position

 
posthttps://api.bitfinex.com/v1/taken_funds
response = client.taken_funds
A binary file was returned

You couldn't be authenticated

[{
  "id":11576737,
  "position_id":944309,
  "currency":"USD",
  "rate":"9.8874",
  "period":2,
  "amount":"34.24603414",
  "timestamp":"1444280948.0",
  "auto_close":false
}]
 

Response Details

An array of your active margin funds.

Suggest Edits

Active Funding Not Used in a margin position

View your funding currently borrowed and not used (available for a new margin position).

 
posthttps://api.bitfinex.com/v1/unused_taken_funds
response = client.unused_taken_funds
A binary file was returned

You couldn't be authenticated

[{
  "id":11576737,
  "position_id":944309,
  "currency":"USD",
  "rate":"9.8874",
  "period":2,
  "amount":"34.24603414",
  "timestamp":"1444280948.0",
  "auto_close":false
}]
 

Response Details

An array of your active unused margin funds.

Suggest Edits

Total Taken Funds

View the total of your active funding used in your position(s).

 
posthttps://api.bitfinex.com/v1/total_taken_funds
response = client.total_taken_funds
A binary file was returned

You couldn't be authenticated

[{
  "position_pair":"BTCUSD",
  "total_swaps":"34.24603414"
}]
 

Response Details

Key Type Description
position_pair [string] Pair of the position
total_swaps [decimal] Sum of the active funding backing this position
Suggest Edits

Close Margin Funding

Allow you to close an unused or used taken fund

 
posthttps://api.bitfinex.com/v1/funding/close
response = client.close_funding(1000)
A binary file was returned

You couldn't be authenticated

{
  "id":11576737,
  "position_id":944309,
  "currency":"USD",
  "rate":"9.8874",
  "period":2,
  "amount":"34.24603414",
  "timestamp":"1444280948.0",
  "auto_close":false
}

Query Params

swap_id
int32
required

The ID given by '/taken_funds' or '/unused_taken_funds'

 

Response Details

Status of the margin funding contract. Closed if it could be closed.

Suggest Edits

Basket Manage

This endpoint is used to manage the creation or destruction of tokens via splitting or merging. For the moment, this is only useful for the bcc and bcu tokens.

 
posthttps://api.bitfinex.com/v1/basket_manage
curl --request POST \
  --url https://api.bitfinex.com/v1/basket_manage
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.bitfinex.com/v1/basket_manage' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.bitfinex.com/v1/basket_manage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.bitfinex.com/v1/basket_manage");

xhr.send(data);
import requests

url = "https://api.bitfinex.com/v1/basket_manage"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

[{"error":false,"message":"Basket btc_btu success"}]

Form Data

amount
string

The amount you wish to split or merge

dir
int32

1 to split, -1 to merge

name
string

the symbol of the token pair you wish to create or destroy

 

Response Details

On success, you will receive the following message:
'[{"error":false,"message":"Basket btc_btu success"}]'
Otherwise, you will receive a message with instructions on how to fix the request.

Suggest Edits

Order Books

The Order Books channel allow you to keep track of the state of the Bitfinex order book.
It is provided on a price aggregated basis, with customizable precision.
After receiving the response, you will receive a snapshot of the book,
followed by updates upon any changes to the book.

 

Fields

Fields Type Description
PRECISION string Level of price aggregation (P0, P1, P2, P3).
The default is P0.
FREQUENCY string Frequency of updates (F0, F1, F2, F3).
F0=realtime / F1=2sec / F2=5sec / F3=10sec.
PRICE float Price level.
COUNT int Number of orders at that price level.
±AMOUNT float Total amount available at that price level.
Positive values mean bid, negative values mean ask.
LENGTH string Number of price points ("25", "100") [default="25"]

Precision Levels per Pair

Pair Precision Level Number of significant figures Example
BTCUSD P0 2 $0.01
... P1 1 $0.10
... P2 0 $1
... P3 -1 $10
LTCUSD P0 4 $0.0001
... P1 3 $0.001
... P2 2 $0.01
... P3 1 $0.1
LTCBTC P0 6 ฿0.000001
... P1 5 ฿0.00001
... P2 4 ฿0.0001
... P3 3 ฿0.001
ETHUSD P0 4 $0.0001
... P1 3 $0.001
... P2 2 $0.01
... P3 1 $0.1
ETHBTC P0 6 ฿0.000001
... P1 5 ฿0.00001
... P2 4 ฿0.0001
... P3 3 ฿0.001

Error Codes

10011 : Unknown Book precision
10012 : Unknown Book length

NOTE

COUNT=0 means that you have to remove the price level from your book.

// request
{
   "event":"subscribe",
   "channel":"book",
   "pair":"<PAIR>",
   "prec":"<PRECISION>",
   "freq":"<FREQUENCY>"
}

// response
{
   "event":"subscribed",
   "channel":"book",
   "chanId":"<CHANNEL_ID>",
   "pair":"<PAIR>",
   "prec":"<PRECISION>",
   "freq":"<FREQUENCY>",
   "len":"<LENGTH>"
}
// snapshot
[
   "<CHANNEL_ID>",
   [
      [
         "<PRICE>",
         "<COUNT>",
         "<AMOUNT>"
      ],
     ...
   ]
]

// updates
[
   "<CHANNEL_ID>",
   "<PRICE>",
   "<COUNT>",
   "<AMOUNT>"
]
Suggest Edits

Raw Order Books

These are the most granular books.

 

Note

PRICE = 0 means that you have to remove the order from your book.

Fields

Fields Type Description
PRECISION string Aggregation level (R0).
ORD_ID int Order id.
ORD_PRICE float Order price.
±AMOUNT float Total amount available at that price level. Positive values mean bid, negative values mean ask.
LENGTH string Number of price points (“25”)
// request
{
   "event":"subscribe",
   "channel":"book",
   "pair":"<PAIR>",
   "prec":"R0"
}

// response
{
   "event":"subscribed",
   "channel":"book",
   "chanId":"<CHANNEL_ID>",
   "pair":"<PAIR>",
   "prec":"R0",
   "len":"<LENGTH>"
}
// snapshot
[
   "<CHANNEL_ID>",
   [
      [
         "<ORD_ID>",
         "<PRICE>",
         "<AMOUNT>"
      ],
      [
         "..."
      ]
   ]
]

// updates
[
   "<CHANNEL_ID>",
   "<ORD_ID>",
   "<ORD_PRICE>",
   "<AMOUNT>"
]
Suggest Edits

Trades

This channel sends a trade message whenever a trade occurs at Bitfinex. It includes all the pertinent details of the trade, such as price, size and time.

 

here is an example of a real trade

[ 5, 'te', '1234-BTCUSD', 1443659698, 236.42, 0.49064538 ]
[ 5, 'tu', '1234-BTCUSD', 15254529, 1443659698, 236.42, 0.49064538 ]

Fields

Fields Type Description
SEQ string Trade sequence id
ID int Trade database id
TIMESTAMP int Unix timestamp of the trade.
PRICE float Price at which the trade was executed
±AMOUNT float How much was bought (positive) or sold (negative).

The order that causes the trade determines if it is a buy or a sell.

NOTE

SEQ is different from canonical ID. Websocket server uses SEQ strings to push trades with low latency. After a “te” message you receive shortly a “tu” message that contains the real trade “ID”.

// request
{
  "event": "subscribe",
  "channel": "trades",
  "pair": "BTCUSD"
}

// response
{
  "event": "subscribed",
  "channel": "trades",
  "chanId": "<CHANNEL_ID>",
  "pair":"<PAIR>"
}
// snapshot
[  
   "<CHANNEL_ID>",
   [  
      [  
         "<SEQ> OR <ID>",
         "<TIMESTAMP>",
         "<PRICE>",
         "<AMOUNT>"
      ],
      [  
         "..."
      ]
   ]
]

// updates
[
   "<CHANNEL_ID>",
   "te",
   "<SEQ>",
   "<TIMESTAMP>",
   "<PRICE>",
   "<AMOUNT>"
]

[
   "<CHANNEL_ID>",
   "tu",
   "<SEQ>",
   "<ID>",
   "<TIMESTAMP>",
   "<PRICE>",
   "<AMOUNT>"
]
Suggest Edits

Ticker

The ticker is a high level overview of the state of the market. It shows you the current best bid and ask, as well as the last trade price. It also includes information such as daily volume and how much the price has moved over the last day.

 

Here is an example of a real ticker

[ 2, 236.62, 9.0029, 236.88, 7.1138, -1.02, 0, 236.52, 5191.36754297, 250.01, 220.05 ]

Fields

Fields Type Description
BID float Price of last highest bid
BID_SIZE float Size of the last highest bid
ASK float Price of last lowest ask
ASK_SIZE float Size of the last lowest ask
DAILY_CHANGE float Amount that the last price has changed since yesterday
DAILY_CHANGE_PERC float Amount that the price has changed expressed in percentage terms
LAST_PRICE float Price of the last trade.
VOLUME float Daily volume
HIGH float Daily high
LOW float Daily low
// request
{
   "event":"subscribe",
   "channel":"ticker",
   "pair":"BTCUSD"
}

// response
{
   "event":"subscribed",
   "channel":"ticker",
   "chanId":"<CHANNEL_ID>",
   "pair":"BTCUSD"
}
// snapshot
[
   "<CHANNEL_ID>",
   "<BID>",
   "<BID_SIZE>",
   "<ASK>",
   "<ASK_SIZE>",
   "<DAILY_CHANGE>",
   "<DAILY_CHANGE_PERC>",
   "<LAST_PRICE>",
   "<VOLUME>",
   "<HIGH>",
   "<LOW>"
]

// updates
[
   "<CHANNEL_ID>",
   "<BID>",
   "<BID_SIZE>",
   "<ASK>",
   "<ASK_SIZE>",
   "<DAILY_CHANGE>",
   "<DAILY_CHANGE_PERC>",
   "<LAST_PRICE>",
   "<VOLUME>",
   "<HIGH>",
   "<LOW>"
]
Suggest Edits

Position Snapshot

 

Fields

Term Type Description
POS_PAIR string Pair (BTCUSD, …).
POS_STATUS string Status (ACTIVE, CLOSED).
±POS_AMOUNT float Size of the position. Positive values means a long position, negative values means a short position.
POS_BASE_PRICE float The price at which you entered your position.
POS_MARGIN_FUNDING float The amount of funding being used for this position.
POS_MARGIN_FUNDING_TYPE int 0 for daily, 1 for term.
[  
   0,
   "ps",
   [  
      [  
         "<POS_PAIR>",
         "<POS_STATUS>",
         "<POS_AMOUNT>",
         "<POS_BASE_PRICE>",
         "<POS_MARGIN_FUNDING>",
         "<POS_MARGIN_FUNDING_TYPE>"
      ],
      [  
         "..."
      ]
   ]
]
Suggest Edits

Wallet Snapshot

 

Fields

Term Type Description
WLT_NAME string Wallet name (exchange, trading, deposit)
WLT_BALANCE float Wallet balance
WLT_INTEREST_UNSETTLED float Unsettled interest
[
   0,
   "ws",
   [
      [
         "<WLT_NAME>",
         "<WLT_CURRENCY>",
         "<WLT_BALANCE>",
         "<WLT_INTEREST_UNSETTLED>"
      ]
   ]
]
Suggest Edits

Order Snapshots

os and hos indentify respectively active and inactive orders snapshots

 

Fields

Term Type Description
ORD_ID int order id
ORD_PAIR string Pair (BTCUSD, …)
±ORD_AMOUNT float Positive means buy, negative means sell.
±ORD_AMOUNT_ORIG float Original amount
ORD_TYPE string The type of the order [“LIMIT”, “MARKET”, “STOP”, “TRAILING STOP”, “EXCHANGE MARKET”, “EXCHANGE LIMIT”, “EXCHANGE STOP”, “EXCHANGE TRAILING STOP”, “FOK”, “EXCHANGE FOK”].
ORD_STATUS string Status [ACTIVE, EXECUTED, PARTIALLY FILLED, CANCELED]
ORD_PRICE float Price
ORD_PRICE_AVG float Average price
ORD_CREATED_AT string Creation date/time
ORD_NOTIFY int 1 if Notify flag is active, 0 if not
ORD_HIDDEN int 1 if Hidden, 0 if not hidden
ORD_OCO int ID of the linked order, 0 otherwise
[
   0,
   "os",
   [
      [
         "<ORD_ID>",
         "<ORD_PAIR>",
         "<ORD_AMOUNT>",
         "<ORD_AMOUNT_ORIG>",
         "<ORD_TYPE>",
         "<ORD_STATUS>",
         "<ORD_PRICE>",
         "<ORD_PRICE_AVG>",
         "<ORD_CREATED_AT>",
         "<ORD_NOTIFY>",
         "<ORD_HIDDEN>",
         "<ORD_OCO>"
      ],
      [
         "..."
      ]
   ]
]
Suggest Edits

Trade Snapshots

 

Fields

Term Type Description
TRD_ID int Trade database id
TRD_PAIR string Pair (BTCUSD, …)
TRD_TIMESTAMP int Execution timestamp
TRD_ORD_ID int Order id
±TRD_AMOUNT_EXECUTED float Positive means buy, negative means sell
TRD_PRICE_EXECUTED float Execution price
ORD_TYPE string Order type
ORD_PRICE float Order price
FEE float Fee
FE_CURRENCY string Fee currency
[
   0,
   "ts",
   [
      [
         "<TRD_ID>",
         "<TRD_PAIR>",
         "<TRD_TIMESTAMP>",
         "<TRD_ORD_ID>",
         "<TRD_AMOUNT_EXECUTED>",
         "<TRD_PRICE_EXECUTED>",
         "<ORD_TYPE>",
         "<ORD_PRICE>",
         "<FEE>",
         "<FEE_CURRENCY>"
      ],
      [
         "..."
      ]
   ]
]
Suggest Edits

Order Updates

 
[
   0,
   "<on|ou|oc>",
   [
      "<ORD_ID>",
      "<ORD_PAIR>",
      "<ORD_AMOUNT>",
      "<ORD_AMOUNT_ORIG>",
      "<ORD_TYPE>",
      "<ORD_STATUS>",
      "<ORD_PRICE>",
      "<ORD_PRICE_AVG>",
      "<ORD_CREATED_AT>",
      "<ORD_NOTIFY>",
      "<ORD_HIDDEN>",
      "<ORD_OCO>"
   ]
]	
Suggest Edits

Position Updates

 
[  
   0,
   "<pn|pu|pc>",
   [  
      "<POS_PAIR>",
      "<POS_STATUS>",
      "<POS_AMOUNT>",
      "<POS_BASE_PRICE>",
      "<POS_MARGIN_FUNDING>",
      "<POS_MARGIN_FUNDING_TYPE>"
   ]
]
Suggest Edits

Wallet Updates

 

Limit Order Behavior

  • When you place a limit order, you will first receive an ‘on’ (order new) which means that the order has been accepted by the system
  • When the order rests on the book, you will receive an ‘ou’ (order update).
  • If you send a market order, you will only receive the ‘on’ because it won’t actually rest on the book (as it matches the first order it runs into).
[
   0,
   "wu",
   [
      "<WLT_NAME>",
      "<WLT_CURRENCY>",
      "<WLT_BALANCE>",
      "<WLT_INTEREST_UNSETTLED>"
   ]
]
Suggest Edits

Executed Trades

 

After a te message you receive shortly a tu message that contains the real trade id (TRD_ID) and additional/updated fields.

Abbreviated Terms Glossary

Term Definition
ps position snapshot
pn new position
pu position update
pc position close
ws wallet snapshot
wu wallet update
os order snapshot
on new order
ou order update
oc order cancel
te trade executed
tu trade execution update

Error Codes

10100 : Authentication failure (generic)
10101 : Already authenticated
10102 : Authentication Payload Error
10103 : Authentication Signature Error
10104 : Authentication HMAC Error

[
   0,
   "te",
   [
      "<TRD_SEQ>",
      "<TRD_PAIR>",
      "<TRD_TIMESTAMP>",
      "<TRD_ORD_ID>",
      "<TRD_AMOUNT_EXECUTED>",
      "<TRD_PRICE_EXECUTED>",
      "<ORD_TYPE>",
      "<ORD_PRICE>"
   ]
]

[
   0,
   "tu",
   [
      "<TRD_SEQ>",
      "<TRD_ID>",
      "<TRD_PAIR>",
      "<TRD_TIMESTAMP>",
      "<TRD_ORD_ID>",
      "<TRD_AMOUNT_EXECUTED>",
      "<TRD_PRICE_EXECUTED>",
      "<ORD_TYPE>",
      "<ORD_PRICE>",
      "<FEE>",
      "<FEE_CURRENCY>"
   ]
]
Suggest Edits

Unauthentication

 

Error Codes

10201 : Not authenticated

// request
{  
   "event":"unauth"
}

// response
{  
   "event":"unauth",
   "status":"OK",
   "chanId":0
}
// response-failure
{
   "event":"error",
   "status":"FAILED",
   "chanId":0,
   "code":"<CODE>"
}