Introduction

C2CX offers both public market data and authenticate trade REST JSON APIs to give external applications access to key C2CX functionality and data.

Current ‘v1’ APIs are designed to offer core functionality only. Future version will be deployed on new endpoints and will expand on current functionality. If you have any feedback or feature requests feel free to send the details to one of our support channels.

C2CX supplies several example libraries to help you get started in your chosen language. If you create a library in an additional language that you would like to share please let us know.

Versioning

API parameters and results will remain consistent within versions though new API, parameters, responses may be added that do not affect existing requests.

The current API version is “v1”. Documentation for the previous version may be found at https://api.c2cx.com/beta/. This API will be depreciated and will no longer be available after September 1st 2017.

Support

Chinese: [QQ Group:129483457 ]

Limitations

60 API request per minute per endpoint.

Error Response: {“error”:”rate_limit”}

If more then 60 API requests are sent per minute to an endpoint the sending IP will be blocked for between 30 and 60 seconds.

Results are also limited to 100 results per API request. APIs that may return more than 100 result will have a pagination option.

Libraries

Libraries are offered as is with no warranty. Please review the code before integrating them into your application.

Download PHP Download NET

Authentication

API keys can be generated by logging into your C2CX account and selecting the “Settings” menu item. Using the “API” tab on the left you can generate a new API public and secret key. Copy these and keep them in a safe place. Your private key will only be shown once.

All authenticated request are sent along with a signature generated by getting the MD5 of a string containing the public key, all parameters, and the secret key.

The parameters must be orders alphabetically with the secret key as the last parameter. The string should be formatted as in the example below.

Example:
Signature = stringToUppercase( md5(“apiKey=[Public_Key]& param1=value& param2=value&secretKey=[Secret_Key]”) )

This signature is then send along with the post request as an additional parameter called “sign”.

Pairs

Market data API’s require a “symbol” argument to return the appropriate trading data. Symbols must be capitalized. Currently support symbols are:

 DRG to BTC: “DRG_BTC”
DRG to ETH: “DRG_ETH”
DRG to ETC: “DRG_ETC”
DRG to SKY: “DRG_SKY”
DRG to SHL: “DRG_SHL”
BTC to ETH: “BTC_ETH”
ETH to SKY: “ETH_SKY”
BTC to SKY: “BTC_SKY”
BTC to BCC: “BTC_BCC”

Example Ticker Request:

https://api.c2cx.com/v1/ticker/?symbol=DRG_BTC

Error Responses:

 code 200: Success 
code 400: Error

Public APIs

ExchangePolicy

Get Exchange Policy

Request

Type GET

https://api.c2cx.com/v1/ExchangePolicy

Parameters

none

Response

SupportPairs: Support Pairs
TransferFee: Transfer Fee
OrderPolicy: Order Policy

Example

https://api.c2cx.com/v1/ExchangePolicy

Response

{
                                                 {
  "SupportPairs": [
    "BTC_BCC",
    "BTC_DASH",
    "BTC_ETH",
    "BTC_FUN",
    "BTC_SKY",
    "BTC_TNB",
    "BTC_UCASH",
    "BTC_ZRX",
    "DRG_BCC",
    "DRG_BTC",
    "DRG_BTG",
    "DRG_DASH",
    "DRG_ETC",
    "DRG_ETH",
    "DRG_FUN",
    "DRG_LTC",
    "DRG_SKY",
    "DRG_TNB",
    "DRG_ZEC",
    "DRG_ZRX",
    "USDT_BCC",
    "USDT_BTC",
    "USDT_BTG",
    "USDT_DASH",
    "USDT_DRG",
    "USDT_ETC",
    "USDT_ETH",
    "USDT_FUN",
    "USDT_LTC",
    "USDT_SKY",
    "USDT_TNB",
    "USDT_UCASH",
    "USDT_ZEC",
    "USDT_ZRX"
  ],
  "TransferFee": [
    //Symbol                百分比手续费                                最低手续费                   充值手续费额度                    充值手续费                                充值确认数                             maker交易费                         taker交易费
    {"Symbol": "BTC"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.0005    ,"DepositFee":0.001              ,"DepositFeeRuleThreshold":0.5            ,"DepositComfirmation":1              ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "ETH"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.005     ,"DepositFee":0.002              ,"DepositFeeRuleThreshold":0.5            ,"DepositComfirmation":20             ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "ETC"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.05      ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":20             ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "SKY"       ,"PercentageWithdrawalFee":0              ,"MinWithdrawalFee":0.01      ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":1              ,"MakerTradingFee":0.002           ,"TakerTradingFee":0.002 },
    {"Symbol": "BCH"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.0005    ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":4              ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "BTG"       ,"PercentageWithdrawalFee":0              ,"MinWithdrawalFee":0         ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":4              ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "USDT"      ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":2.5       ,"DepositFee":1                  ,"DepositFeeRuleThreshold":500            ,"DepositComfirmation":20             ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "ZEC"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.005     ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":20             ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "LTC"       ,"PercentageWithdrawalFee":0              ,"MinWithdrawalFee":0.001     ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":0              ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "DASH"      ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":0.01      ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":0              ,"MakerTradingFee":0.001           ,"TakerTradingFee":0.001 },
    {"Symbol": "ZRX"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":2.5       ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":20             ,"MakerTradingFee":0.0015          ,"TakerTradingFee":0.0015 },
    {"Symbol": "FUN"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":50        ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":20             ,"MakerTradingFee":0.0015          ,"TakerTradingFee":0.0015 },
    {"Symbol": "TNB"       ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":30        ,"DepositFee":0                  ,"DepositFeeRuleThreshold":0              ,"DepositComfirmation":20             ,"MakerTradingFee":0.0015          ,"TakerTradingFee":0.0015 },
    {"Symbol": "UCASH"     ,"PercentageWithdrawalFee":0.001          ,"MinWithdrawalFee":5         ,"DepositFee":5                  ,"DepositFeeRuleThreshold":5000           ,"DepositComfirmation":20             ,"MakerTradingFee":0.0015          ,"TakerTradingFee":0.0015 }
  ],
  "OrderPolicy": [
    //货币                 最小下单量                           下单数量规则(小数位数)                      下单价格规则(龙币小数位数)
    {"Symbol": "BTC"      ,"MinOrderQuantity":0.01             ,"Quantitydigits": 4                       ,"Pricedigits": 1 },
    {"Symbol": "ETH"      ,"MinOrderQuantity":0.05             ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "ETC"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 1                       ,"Pricedigits": 3 },
    {"Symbol": "SKY"      ,"MinOrderQuantity":1                ,"Quantitydigits": 1                       ,"Pricedigits": 3 },
    {"Symbol": "BCH"      ,"MinOrderQuantity":0.01             ,"Quantitydigits": 4                       ,"Pricedigits": 1 },
    {"Symbol": "BTG"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 4                       ,"Pricedigits": 2 },
    {"Symbol": "ZEC"      ,"MinOrderQuantity":0.05             ,"Quantitydigits": 1                       ,"Pricedigits": 2 },
    {"Symbol": "LTC"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "DASH"     ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "ZRX"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "FUN"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "TNB"      ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 },
    {"Symbol": "UCASH"    ,"MinOrderQuantity":0.1              ,"Quantitydigits": 2                       ,"Pricedigits": 2 }
  ]
}
                                       

Ticker

The public ticker API returns key pricing data for a give currency pair.

Request

Type GET

https://api.c2cx.com/v1/ticker/?symbol=[symbol]

Parameters

Symbol ( required ): The currency pair you are retrieve data for ( must be capitalized ).

Response

Timestamp: Epoch timestamp of data.
High: Trailing 24 hour highest price.
Last: Last order execution price.
Low: Trailing 24 hour lowest price.
Buy: Current highest buy price in order book.
Sell: Current lowest sell price in order book.
Volume: 24 hour trailing volume (not all currencies may report this number).

Example

https://api.c2cx.com/v1/ticker/?symbol=DRG_BTC

Response

{
  "fail": [ ],
  "success": [
  {
      "code": 200,
      "message": "success",
      "data": {
          "date": "1495513951",
          "high": 17310,
          "last": 69.7,
          "low": 15850,
          "buy": 16660,
          "sell": 16970,
          "volume": 23123
      }
  }]
}                                        

Order Book

Return the full order book for a given currency pair.

Request

Type GET

https://api.c2cx.com/v1/getorderbook?symbol=[symbol]

Parameters

symbol: The currency pair you are retrieve data for ( must be capitalized ).

Response

Timestamp: Epoch timestamp of data.
Bids: Array of open buy orders. Each order contains the order price and order quantity.
Asks: Array of open sell orders. Each order contains the order price and order quantity.

Example

https://api.c2cx.com/v1/getorderbook?symbol=DRG_BTC

Response

{
  "code":200,
  "message":"success",
  "data":
  {
   "timestamp":"1495518849",
   "bids":[[16990.0,52.49],[16980.0,0.12],[16960.0,0.03],[16950.0,2.51],[16940.0,2.2],[16930.0,1.19],[16920.0,4.15],
           [16910.0,1.82],[16900.0,1.21],[16880.0,14.27],[16870.0,1.27],[16860.0,1.00],[16850.0,0.58],[16840.0,1.21],
           [16830.0,1.34],[16820.0,1.06],[16800.0,15.10],[16790.0,1.04],[16780.0,1.21],[16770.0,3.96]],
   "asks":[[17850.0,6.52],[17840.0,3.94],[17830.0,1.99],[17810.0,2.86],[17800.0,3.69],
           [17790.0,0.46],[17780.0,0.34],[17770.0,0.73],[17760.0,0.22],[17740.0,0.30],[17730.0,0.37],[17720.0,25.84],
           [17710.0,2.84],[17700.0,0.55],[17690.0,5.11],[17670.0,2.79],[17660.0,0.42],[17650.0,3.29],[17640.0,16.07],
           [17630.0,3.94],[17620.0,2.30],[17600.0,1.72],[17590.0,0.32],[17580.0,2.00],[17570.0,11.08],[17560.0,18.06],
           [17550.0,16.36],[17530.0,3.94],[17520.0,21.44],[17510.0,3.35]]
  }
}                                        

Authenticated APIs

getBalance

Returns a user’s balance details.

Type POST

https://api.c2cx.com/v1/getbalance

Parameters

getBalance: Public API Key
sign: Public/Private key signature.

Response

balance: Balance of a given currency and “total” balance of all currencies converted to RMB. frozen: Amount used on open order for a given currency and “total” frozen of all currencies converted to RMB.

Example

https://api.c2cx.com/v1/getbalance

Post Parameters

 [apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX 
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response

{
   "code":200,
   "message":"success",
   "data":{
      "balance":{
         "btc":21.02938304,
         "cny":107132.59597700,
         "eth":10.46997897,
         "etc":109.34651160,
         "sky":501.09096000
      },
      "frozen":{
         "btc":0.11800000,
         "cny":1000.00000000,
         "eth":9.46800000,
         "etc":24.91900000,
         "sky":0.00000000
      }
   }
}  

Create Order

Create a new order.

Type POST

https://api.c2cx.com/v1/createOrder

Parameters

quantity: Quantity of order.
apiKey: Public API key
price: Order Price
symbol: Symbol for the order book you would like to place an order for.
priceTypeId: “limit” for limit orders, “market” for market orders.
orderType: “buy” or “sell”,
isAdvancedOrder: “0” if no advanced options are used, “1” if advanced options are used.
// Advanced options are only required if “isAdvancedOrder” is set. For more information of advanced orders see the FAQ.
takeProfit: Take profit price.
stopLoss: Stop loss price.
triggerPrice: Trigger price.
sign: Public/Private key signature.

Notes:
Under [priceTypeId] => "Market" condition:
If [orderType] => Buy: Not passing the quantity parameter or passing the quantity value as 0.
If [orderType] => Sell:Not passing the price parameter or passing the price value as 0.

Response

orderId: ID of submitted order.

Example

https://api.c2cx.com/v1/createOrder

Post Parameters

 [quantity] => 1 
[apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX
[price] => 10
[symbol] => DRG_ETC
[priceTypeId] => limit
[orderType] => Buy
[isAdvanceOrder] => 0
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response

{
  "code":200,
  "message":"success",
  "data":{
     "orderId":223424243
  }
}                                        

Get recent order

Get recent order

Type POST

https://api.c2cx.com/v1/getRecentOrder

Parameters

apiKey: Public API key
symbol: Symbol for the order book you would like to place an order for.
start: start time.
end: end time
sort: desc/asc
statusId: 110--Open,0---All,2---Active,3---Partial,4---Completed,5---Cancelled,7---Suspended,11---Expired,12---Cancelling
typeId: 0---All,1---Buy,2---Sell,3---Market,4----Trigger,5----Take_Profit,6----Stop_Loss
sign: Public/Private key signature.

Response

orderId: ID of submitted order.

Example

https://api.c2cx.com/v1/getRecentOrder

Post Parameters

 [statusId] => 110 
[apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX
[typeId] => 0
[start] => 2018-3-8 10:04:12
[end] => 2018-3-8 16:04:33
[sort] => desc
[symbol] => DRG_ETC
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response


                                                 {
    "fail": [ ], 
    "success": [
        {
            "code": 200, 
            "message": "success", 
            "data": [
                {
                    "Date": "2017-07-27", 
                    "Time": "11:29", 
                    "OrderId": 7170213, 
                    "TypeName": 74, 
                    "Quantity": "Ξ1", 
                    "Price": "¥1000", 
                    "CompletedAmount": "¥0", 
                    "OrderStatus": "Suspended", 
                    "OrderStatusId": 7, 
                    "Type": "buy", 
                    "Linheight": "N/A", 
                    "MarketOrder": false, 
                    "OrderBookStatusId": 1, 
                    "BaseOrderId": null, 
                    "Notified": false, 
                    "OrderClassId": 1
                }
            ]
        }
    ]
}                                      

Cancel Order

Cancel an open order.

Type POST

https://api.c2cx.com/v1/cancelorder

Parameters

apiKey: Public API key.
orderId: Id of order you wish to cancel.
sign: Public/Private key signature.

Response

“success” array will not be empty if successfully, “fail” array will not be empty if there is an error. The fail array will contain a description of the error.

Example

https://api.c2cx.com/v1/cancelorder

Post Parameters

 [apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX 
[orderid] => 1761386
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response

{
  "fail": [ ],
  "success": [
  {
      "code": 200,
      "message": "Success",
      "data": { }
  }]
}                                        

Get Order Info

Get a list of all open orders or a specific order.

Type POST

https://api.c2cx.com/v1/getorderinfo

Parameters

apiKey: Public API key
orderid: “-1” to return all open orders or the order number to return a specific order number.
symbol: Symbol of order book you are trying to retrieve orders from.
page( optional ): Returns result page. A maximum of 100 results may be returned per page. A value of “2” would return results 101-200.
sign: Public/Private key signature.

Response

balance: Balance of a given currency and “total” balance of all currencies converted to RMB. frozen: Amount used on open order for a given currency and “total” frozen of all currencies converted to RMB.

Example

https://api.c2cx.com/v1/getbalance

Post Parameters

 [apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX 
[orderid] => 335358
[symbol] => DRG_BTC
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response

{
 "fail": [ ],
 "success": [
 {
    "code": 200,
    "message": "success",
    "data": [
    {
       "amount": 0.01,
       "avgPrice": 0,
       "completedAmount": "0",
       "createDate": 1480662002070,
       "orderId": 335358,
       "price": 5441,
       "status": 2,
       "type": "buy",
       "fee": 0,
       "cid": null,
       "source": null
    }]
 }]
}                                        

Get Order By Status

Get a list of orders for a selected order book with a specific status.

Type POST

https://api.c2cx.com/v1/getorderbystatus

Parameters

apiKey: Public API key
symbol: Symbol of order book you are trying to retrieve orders from.
statusid: 0 = all,2=Active,3=Partially Completed,4=completed,5=cancelled,6=Suspended
duration: the duration time (second)
pageindex:
pagesize: [1,100]
sign: Public/Private key signature.

Response

amount: Order quantity,
avgPrice: Average execution price of order.
completedAmount: Amount of the order that is completed.
createDate: Epoch timestamp of the orders creation.
updateDate: Epoch timestamp of the orders last update.
orderId: 320255,
price: 2,
status:

1,Pending
2,Active
3,Partially Completed
4,Completed
5,Cancelled
6,Error
7,Suspended
8,TriggerPending
9,StopLossPending
11,Expired
12,Cancelling
fee: Commission fee for order,
type: "buy,"sell","buyMarket","sellMarket",
"trigger","stopLoss","takeProfit".
cid: User submitted id( customer id ),
source: Public API key used to create the order. If the order was created by the platform "1" will be returned.

Example

https://api.c2cx.com/v1/getorderbystatus

Post Parameters

 [apiKey] => XXXXX-XXX-XXXX-XXXX-XXXXXXXX
[statusid] => 2
[symbol] => DRG_BTC
[sign] => XXXXXXXXXXXXXXXXXXXXXX

Response

{
  "fail": [ ],
  "success": [
  {
    "code": 200,
    "message": "success",
    "data": [
    {
       "amount": 0.0562,
       "avgPrice": 17800,
       "createDate": 1495599340233,
       "completeDate": 1495600325187,
       "orderId": 1760087,
       "price": 17800,
       "status": 4,
       "type": "buy"
    },
    {
       "amount": 4.388,
       "avgPrice": 17820,
       "createDate": 1495601538910,
       "completeDate": 1495601548687,
       "orderId": 1760372,
       "price": 17820,
       "status": 4,
       "type": "buy"
    },
    {
       "amount": 1,
       "avgPrice": 17820,
       "createDate": 1495601741977,
       "completeDate": 1495601800797,
       "orderId": 1760397,
       "price": 17820,
       "status": 4,
       "type": "buy"
    }]
  }]
}