English
Login Sign Up
PUBLIC API
Get the latest market data
API CALLSEXAMPLE
POST https://bitafex.com/api/public/getmarketsummaries.html Get Full Market Summary(CLICK TO SEE)
POST /appApi.html?action=depthGet Depth data(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=depth&symbol=1

EXAMPLE
# Request 
POST BTC /appApi.html?action=depth&symbol=1
# Response
{
  "code": 200,
  "msg": "Get depth data",
  "time": 1486203073756,
  "data": {
    "date": 1478758913,
    "asks": [
      [
        5003.68,
        0.275
      ]
    ],
    "bids": [
      [
        4903.66,
        0.075
      ]
    ]
  }
}
Return value
date : Server time when data is returned
asks : Seller depth
bids : Buyer depth
Request parameter name
Parameter nameDescription
symbolCurrency: 1 (Bitcoin to Litecoin)
sizeDepth: Maximum support 10 (default 10)
POST /appApi.html?action=klineGet Trade data(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=kline&symbol=1&step=60

Example
# Request 
POST /appApi.html?action=kline&symbol=1&step=60
# Response
{
  "code": 200,
  "msg": "Get K-line data",
  "time": 1486203073756,
  "data": "[[1478746261695,4939.32,4939.97,4938.74,4939.58,446.9005]]"
}
Return value description
[
	1478746261695,		Time stamp
	4939.32,		Open
	4939.97,		High
	4938.74,		Low
	4939.58,		Close
	446.9005		Trading volume
]
Request parameter name
parameter namedescription
symbolCurrency: 1 (bitcoin vs LTC), btc_ltc (Small Cap)
step60(1m), 60*3(3m),60*5(5m),60*15(15m),60*30(3m),60*60(1h),60*60*2(2h),60*60*4(4h),60*60*6(6h),
60*60*12(12h),60*60*24(1d),60*60*24*3(3d),60*60*24*7(1w)
POST /appApi.html?action=marketGet real-time market(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=market&symbol=1

Example
# Request 
POST /appApi.html?action=market&symbol=1
# Response
{
  "code": 200,
  "msg": "Get real-time market",
  "time": 1486203073756,
  "data": {
    "high": 4962.03,
    "vol": 1633159.5247,
    "last": 4899.26,
    "low": 4876,
    "buy": 4898.93,
    "sell": 4899.26
  }
}
Return value description
high: Highest price
vol: Volume (24 hours)
last: Latest Price
low: Lowest Price
buy: Buy Price
sell: Sell Price
Request parameter name
parameter namedescription
symbolCurrency: 1 (Bitcoin to LTC)
POST /appApi.html?action=tradesGet latest transaction data(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=trades?&symbol=1

Example
# Request 
POST /appApi.html?action=trades&symbol=1
# Response
{
  "code": 200,
  "msg": "Get the latest transaction records",
  "time": 1486203073756,
  "data": [
    {
      "amount": 1.7931,
      "price": 4906.49,
      "id": 1,
      "time": "15:59:24",
      "en_type": "ask",
      "type": "卖出"
    }
}
Return value description
amount: Number of transactions
price: Trading price
id: Data ID
time: transaction hour
en_type: Transaction Type ask / bid
type: Transaction Type Sell / Buy
Request parameter name
Return value description
symbolCurrency: 1 (Bitcoin to LTC)
PRIVATE API
For fast TRADING WITH BOT
API CALLSEXAMPLE
/user/api.htmlSETTING OF API FROM USER ACCOUNT(CLICK TO SEE EXAMPLE)
EXAMPLE

> 1. Get API authentication apiKey and secretKey
Apply for the API to get the apiKey and secretKey, where apiKey is the access key provided to the API user and secretKey is the private key used to sign the request parameters.
  Note: Do not leak these two parameters to anyone, these two parameters related to account security.
> 2. Generate a string to sign
User submitted parameters except sign, must participate in the signature.
The string to be signed needs to be sorted according to the parameter name (the first letter of all the parameter names is compared first in the order of abcd, the second letter in the case of the same first letter, and so on.In here type=0 means(Buy), type=1 means(Sell), symbol=1 is number of market.Example : BTC/LTC market number is 1, so symbol=1
For example: Sign the following parameters: string[] parameters={"api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c","symbol=1","type=0","price=680","amount=1.0"};
 Generate the string to be signed:amount=1.0&api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&price=680&symbol=1&type=0
> 3. MD5 signature
In the MD5 signature, the private key secretKey participation signature.
Add the private key parameter to the string to be signed to generate the final string to be signed,
For example: amount=1.0&api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&price=680&symbol=1&type=0&secret_key=secretKey note"&secret_key=secretKey" Signature parameters will be transmitted.
The 32-bit MD5 algorithm is used to sign the final signature string to obtain the signed result string (the string is assigned to the parameter sign). The letters in the MD5 calculation result are all uppercase。

Example for Buy or Sell [type= 0(Buy), 1 (Sell)] order:

BUY: https://bitafex.com/appApi.html?action=trade&amount=500&api_key=your_api_key&price=0.00000123&symbol=1&type=0&sign=your_generated_sign
SELL: https://bitafex.com/appApi.html?action=trade&amount=500&api_key=your_api_key&price=0.00000123&symbol=1&type=1&sign=your_generated_sign
POST /appApi.html?action=tradeCREATE BUY ORDERS(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000

EXAMPLE
# Request [type= 0(Buy), 1 (Sell)]
POST /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000
# Response
{
  "code": 200,
  "msg": "Commissioned success",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (Bitcoin to LTC)
typeType of commission: 0-buy, 1-sell
amountThe number of commission
priceCommissioned price
POST /appApi.html?action=cancel_entrustCANCEL ORDER(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=cancel_entrust?id=1

EXAMPLE
# Request 
POST /appApi.html?action=cancel_entrust?id=1
# Response
{
  "code": 200,
  "msg": "Withdrawal successful",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
idOrder id
POST /appApi.html?action=tradeCREATE SELL ORDERS(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=trade&symbol=1&type=1&amount=1&price=5000

Example
# Request [type= 0(Buy), 1 (Sell)]
POST /appApi.html?action=trade&symbol=1&type=1&amount=1&price=5000
# Response
{
  "code": 200,
  "msg": "Commissioned success",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (Bitcoin to LTC)
typeType of commission: 0-buy, 1-sell
amountThe number of commission
priceCommissioned price
POST /appApi.html?action=entrustPENDING ORDER HISTORY(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=entrust&symbol=1

EXAMPLE
# Request 
POST /appApi.html?action=entrust&symbol=1
# Response
{
  "code": 200,
  "msg": "Check the current list",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (Bitcoin to LTC)
POST /appApi.html?action=lastentrustLATEST 10 PENDING ORDER (CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=lastentrust&symbol=1

EXAMPLE
# Request 
POST /appApi.html?action=lastentrust&symbol=1
# Response
{
  "code": 200,
  "msg": "Check the latest 10 transactions orders",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (Bitcoin to LTC)
POST /appApi.html?action=orderTRADE HISTORY(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=order&id=1

EXAMPLE
# Request 
POST /appApi.html?action=order&id=1
# Response
{
  "code": 200,
  "msg": "Fundamental id check orders details",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
idOrder id: 1
POST /appApi.html?action=userinfoGET BALANCE (CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=userinfo

EXAMPLE
# Request 
POST /appApi.html?action=userinfo
# Response
{
  "code": 200,
  "msg": "成功",
  "time": 1486203073756,
  "data": {
    "frozen": {
      "BTC": 0,
      "ETC": 0,
      "LTC": 0,
      "CNY": 0
    },
    "free": {
      "BTC": 0,
      "ETC": 0,
      "LTC": 0,
      "CNY": 0
    }
  }
}
Return value description
code: return code
msg: return message
data: carry data
free: Available assets
Frozen: Frozen assets
asset: total assets 
Request parameter name
parameter namedescription
WITHDRAWAL API
Used for quick cash withdrawal
API CALLSEXAMPLE
POST /appApi.html?action=cancel_withdrawCANCEL WITHDRAWAL(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=cancel_withdraw&id=1

EXAMPLE
# Request 
POST /appApi.html?action=cancel_withdraw?id=1
# Response
{
  "code": 200,
  "msg": "Cancel withdrawal successful",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
withdraw_idWithdraw id
POST /appApi.html?action=withdrawMAKE WITHDRAW(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=withdraw&symbol=1&amount=1&withdrawaddress=123456

Example
# Request 
POST /appApi.html?action=withdraw?symbol=1&amount=1&withdrawaddress=123456
# Response
{
  "code": 200,
  "msg": "Withdraw now, please wait for the administrator to review",
  "time": 1486203073756,
  "data": null
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (bitcoin)
amountDraw the number
withdrawaddressCertified cash withdrawal address
POST /appApi.html?action=withdraw_recordWITHDRAWAL HISTORY(CLICK TO SEE EXAMPLE)

BTC /appApi.html?action=withdraw_record?symbol=1

EXAMPLE
# Request 
POST /appApi.html?action=withdraw_record?symbol=1
# Response
{
  "code": 200,
  "msg": "Query virtual cash withdrawal records",
  "time": 1486203073756,
  "data": []
}
Return value description
code : Return code
msg  : Return the message
time : Time stamp(ms)
data : Carry the data
Request parameter name
parameter namedescription
symbolCurrency: 1 (bitcoin)
COMMON API RESULT & ERROR
API interface call error code description
RESULT/ERROR CODEDESCRIPTION
200Successful operation
500Operation failed
10001Network Error
10002API does not exist
10003Parameter error
10004No trading rights
10005No withdrawal permission
10006api_key error
10007Signed wrong