简介

C2CX提供公开市场数据和授权交易的REST JSON API,以便外部应用程序访问关键的C2CX功能和数据. 当前的'v1'API旨在仅提供核心功能. 未来版本将部署 在新终端上,并将扩展当前功能. 如果您有任何反馈或功能请求,请随时将详细信息发送到我们的支持渠道之一. C2CX提供了几个示例库,可帮助您使用所选 语言. 如果您愿意分享您用其他语言创建的库,请告诉我们.

版本

虽然可以添加不影响现有请求的新API,参数和响应值,但API参数和结果在版本中将保持一致.

当前的API版本是'v1'。 可以在 https://api.c2cx.com/beta/找到以前版本的文档。 以前版本的API将被弃用,2017年9月1日后将不再可用.

支持

中文: [QQ群:129483457]

限制

每个终端每分钟60个API请求

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

如果每分钟向端点发送超过60个API请求,则发送IP将被阻止30到60秒.

每个API请求的结果也限制为100个. 可能返回超过100个结果的API将具有分页选项.

以下提供的库,仅供参考. 请在将代码集成到您的应用程序之前审查代码.

Download PHP Download NET

授权

可以通过登录C2CX帐户并选择'设置'菜单项来生成API密钥. 进入左侧的'API'选项卡,您可以生成新的API公钥和密钥. 复制这些并将它们保存在安全的地方. 您的私钥只会显示一次.

所有经过授权的请求与通过获取包含公钥,所有参数和密钥的字符串的MD5生成的签名一起发送.

参数必须按字母顺序排列,并将密钥作为最后一个参数. 字符串的格式应如下例所示:

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

然后将该签名与post请求一起作为'sign'的附加参数发送.

货币对:

市场数据API需要symbol参数来返回适当的交易数据. 符号必须大写, 目前支持的符号如下:

DRG to BTC: "DRG_BTC" 
DRG to EOS: "DRG_EOS"
DRG to OMG: "DRG_OMG"
DRG to RCN: "DRG_RCN"
DRG to WAX: "DRG_WAX"
DRG to XRP: "DRG_XRP"
USDT to EOS: "USDT_EOS"
USDT to OMG: "USDT_OMG"
USDT to RCN: "USDT_RCN"
USDT to WAX: "USDT_WAX"
USDT to XRP: "USDT_XRP"
BTC to EOS: "BTC_EOS"
BTC to OMG: "BTC_OMG"
BTC to RCN: "BTC_RCN"
BTC to WAX: "BTC_WAX"
BTC to XRP: "BTC_XRP"
DRG to XLM: "DRG_XLM"
USDT to XLM: "USDT_XLM"
BTC to XLM: "BTC_XLM"
BTC to ETC: "BTC_ETC"
BTC to LTC: "BTC_LTC"
BTC to BTG: "BTC_BTG"
BTC to ZEC: "BTC_ZEC"
BTC to BCH: "BTC_BCH"
BTC to DASH: "BTC_DASH"
BTC to ETH: "BTC_ETH"
BTC to FUN: "BTC_FUN"
BTC to SKY: "BTC_SKY"
BTC to TNB: "BTC_TNB"
BTC to UCASH: "BTC_UCASH"
BTC to ZRX: "BTC_ZRX"
DRG to BCH: "DRG_BCH"
DRG to BTG: "DRG_BTG"
DRG to DASH: "DRG_DASH"
DRG to ETC: "DRG_ETC"
DRG to ETH: "DRG_ETH"
DRG to FUN: "DRG_FUN"
DRG to LTC: "DRG_LTC"
DRG to SKY: "DRG_SKY"
DRG to TNB: "DRG_TNB"
DRG to ZEC: "DRG_ZEC"
DRG to ZRXBCH: "DRG_ZRX"
USDT to BCH: "USDT_BCH"
USDT to BTC: "USDT_BTC"
USDT to BTG: "USDT_BTG"
USDT to DASH: "USDT_DASH"
USDT to DRG: "USDT_DRG"
USDT to ETC: "USDT_ETC"
USDT to ETH: "USDT_ETH"
USDT to LTC: "USDT_LTC"
USDT to SKY: "USDT_SKY"
USDT to TNB: "USDT_TNB"
USDT to UCASH: "USDT_UCASH"
USDT to ZEC: "USDT_ZEC"
USDT to ZRX: "USDT_ZRX"
BTC to BEZ: "BTC_BEZ"
BTC to TRIA: "BTC_TRIA"
USDT to FUN: "USDT_FUN"
USDT to PAX: "USDT_PAX"
USDT to BSV: "USDT_BSV"
DRG to BSV: "DRG_BSV"
BTC to BSV: "BTC_BSV"

示例ticker请求:

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

错误响应值:

 code 200: Success 
code 400: Error

公共接口

ExchangePolicy

获取货币交易规则

请求

类型 GET

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

参数

响应

SupportPairs: 支持的货币对
TransferFee: 提现手续费
OrderPolicy: 订单规则

示例

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

响应

{
  "SupportPairs": [
    "BTC_BCH",
    "BTC_DASH",
    "BTC_ETH",
    "BTC_FUN",
    "BTC_SKY",
    "BTC_TNB",
    "BTC_UCASH",
    "BTC_ZRX",
    "DRG_BCH",
    "DRG_BTC",
    "DRG_BTG",
    "DRG_DASH",
    "DRG_ETC",
    "DRG_ETH",
    "DRG_FUN",
    "DRG_LTC",
    "DRG_SKY",
    "DRG_TNB",
    "DRG_ZEC",
    "DRG_ZRX",
    "USDT_BCH",
    "USDT_BTC",
    "USDT_BTG",
    "USDT_DASH",
    "USDT_DRG",
    "USDT_ETC",
    "USDT_ETH",
    "USDT_FUN",
    "USDT_LTC",
    "USDT_PAX",
    "USDT_SKY",
    "USDT_TNB",
    "USDT_UCASH",
    "USDT_ZEC",
    "USDT_ZRX",
    "DRG_OMG",
    "USDT_OMG",
    "BTC_OMG",
    "DRG_RCN",
    "USDT_RCN",
    "BTC_RCN",
    "DRG_XRP",
    "USDT_XRP",
    "BTC_XRP",
    "DRG_EOS",
    "USDT_EOS",
    "BTC_EOS",
    "DRG_WAX",
    "USDT_WAX",
    "BTC_WAX",
    "DRG_XLM",
    "USDT_XLM",
    "BTC_XLM",
    "BTC_ETC",
    "BTC_LTC",
    "BTC_BTG",
    "BTC_ZEC",
    "BTC_TRIA",
    "BTC_BEZ",
    "BTC_SLRM"
  ],
  "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": [
    //货币                      下单价格规则(龙币小数位数)   下单数量规则(小数位数)                 最小下单量
    { 
      "Pair": "USDT_BTC",
      "Pricedigits": -1,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_BTC",
      "Pricedigits": 0,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0.01
    },
    {
      "Pair": "USDT_BCH",
      "Pricedigits": 0,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_BCH",
      "Pricedigits": 1,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0.01
    },
    {
      "Pair": "BTC_BCH",
      "Pricedigits": 3,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0.01
    },
    {
      "Pair": "USDT_ETH",
      "Pricedigits": 0,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_ETH",
      "Pricedigits": 2,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0.1
    },
    {
      "Pair": "BTC_ETH",
      "Pricedigits": 4,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_DASH",
      "Pricedigits": 0,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_DASH",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_DASH",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_ZEC",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_ZEC",
      "Pricedigits": 2,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0.05
    },
    {
      "Pair": "BTC_ZEC",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_LTC",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_LTC",
      "Pricedigits": 2,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_LTC",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_BTG",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_BTG",
      "Pricedigits": 2,
      "Quantitydigits": 4,
      "MinOrderQuantity": 0.1
    },
    {
      "Pair": "BTC_BTG",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_ETC",
      "Pricedigits": 1,
      "Quantitydigits": 1,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_ETC",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0.05
    },
    {
      "Pair": "BTC_ETC",
      "Pricedigits": 6,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {  
      "Pair": "USDT_EOS",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {  
      "Pair": "DRG_EOS",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {  
      "Pair": "BTC_EOS",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_SKY",
      "Pricedigits": 1,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_SKY",
      "Pricedigits": 2,
      "Quantitydigits": 2,
      "MinOrderQuantity": 1
    },
    {
      "Pair": "BTC_SKY",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 1
    },
    {
      "Pair": "USDT_XRP",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 1
    },
    {
      "Pair": "DRG_XRP",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_XRP",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_XLM",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_XLM",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_XLM",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_DRG",
      "Pricedigits": 2,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_OMG",
      "Pricedigits": 2,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_OMG",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_OMG",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_ZRX",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_ZRX",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_ZRX",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_WAX",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_WAX",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_WAX",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_RCN",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_RCN",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_RCN",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_FUN",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_FUN",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_FUN",
      "Pricedigits": 8,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_TNB",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "DRG_TNB",
      "Pricedigits": 5,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "BTC_TNB",
      "Pricedigits": 8,
      "Quantitydigits": 2,
      "MinOrderQuantity": 0
    },
    {
      "Pair": "USDT_UCASH",
      "Pricedigits": 4,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    },
    {
      "Pair": "BTC_UCASH",
      "Pricedigits": 8,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    },
    {
      "Pair": "BTC_BEZ",
      "Pricedigits": 8,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    },
    {
      "Pair": "BTC_SLRM",
      "Pricedigits": 7,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    },
    {
      "Pair": "BTC_TRIA",
      "Pricedigits": 6,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    },
    {
      "Pair": "USDT_PAX",
      "Pricedigits": 3,
      "Quantitydigits": 2,
      "MinOrderQuantity": 50
    }
  ]
}
                                       

Ticker

公共ticker接口返回给定货币对的关键定价数据

请求

类型 GET

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

参数

Symbol ( 必填 ): 您要检索数据的货币对(必须大写)

响应

Timestamp: UNIX时间戳
High: 24小时最高价
Last: 最终订单执行价
Low: 24小时最低价
Buy: orderbook当前最高买价
Sell: orderbook当前最低卖价
Volume: 24小时交易量 (不是所有货币都显示该项)

示例

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

响应

{
	'code': 200,
	'message': 'success',
	'data': {
		'timestamp': '1544086142',
		'high': 0.00483,
		'last': 0.00465,
		'low': 0.00446,
		'buy': 0.00458,
		'sell': 0.00466,
		'volume': 156590.21818550225
	}
}

Order Book

返回给定货币对的完整orderbook

请求

类型 GET

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

参数

symbol(必填): 您要检索数据的货币对(必须大写)

响应

Timestamp: UNIX时间戳
Bids: 一组未完成买单, 每个订单都包含订单价格和订单数量
Asks: 一组未完成卖单, 每个订单都包含订单价格和订单数量

示例

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

响应

{
  "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]]
  }
}                                        

授权接口

获取余额

返回用户的余额详细信息

类型 POST

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

参数

apiKey: 公钥
sign: 公钥/私钥签名

响应

balance: 给定货币的余额 frozen: 给定货币的未完成订单的余额

示例

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

Post 参数

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

响应

{
   "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
      }
   }
}  

创建订单

创建新订单

类型 POST

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

参数

quantity(必填): 订单数量
apiKey: 公钥
price(必填): 订单价格
symbol(必填): 您要检索数据的货币对(必须大写).
priceTypeId(必填): 'limit':限价单, 'market':市价单
orderType(必填): “buy” 或者 “sell”,
isAdvancedOrder: '0': 非高级订单 '1': 高级订单
// 仅当设置了'isAdvancedOrder'时才需要高级选项. 有关高级订单的更多信息,请参阅常见问题.
takeProfit: 获利价格
stopLoss: 止损价格
triggerPrice: 计划委托价
sign: 公钥/私钥签名
cid: 用户自定义字符串, 不可重复
expirationDate: 过期时间

备注:
priceTypeId为market时:
orderType为买: 不传quantity,或者quantity传0
orderType为卖: 不传price,或者price传0

响应

orderId: 提交订单的ID

示例

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

Post 参数

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

响应

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

获取最近订单

获取最近订单

类型 POST

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

参数

apiKey: 公钥
symbol(必填): 您要检索数据的货币对(必须大写)
start: 开始时间
end: 结束时间
sort: desc:倒序, asc:正序
statusId: 110--未完成,0---所有,2---活跃,3---部分完成,4---已完成,5---已取消,7---挂起,11---已过期,12---取消中
typeId:0---所有,1---买单,2---卖单,3---市价单,4----计划委托单,5----获利单,6----止损单
sign: 公钥/私钥签名

响应

orderId: 提交订单的ID
Linheight: 高亮订单 (不再支持)
BaseOrderId: 基单,用于高级单
OrderClassId: 1: 限价, 2: 获利, 3: 止损, 4: 计划委托, 5: Synthcoin

例如

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

Post 参数

 [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

响应

{
	'code': 200,
	'message': 'success',
	'data': [{
		'Date': '2018-11-12 16:39:13.733',
		'Time': '16:39',
		'OrderId': 4925276,
		'TypeName': 'Buy',
		'Quantity': ' 6000',
		'Price': '$0.0126',
		'CompletedAmount': '$75.0374',
		'OrderStatus': 'Completed',
		'OrderStatusId': 4,
		'Type': 'buy',
		'Linheight': 'N/A',
		'MarketOrder': False,
		'OrderBookStatusId': 0,
		'BaseOrderId': None,
		'Notified': False,
		'OrderClassId': 1
	}, {
		'Date': '2018-11-26 21:02:41.737',
		'Time': '21:02',
		'OrderId': 4965810,
		'TypeName': 'Buy',
		'Quantity': ' 1700',
		'Price': '$0.0051',
		'CompletedAmount': '$8.67',
		'OrderStatus': 'Completed',
		'OrderStatusId': 4,
		'Type': 'buy',
		'Linheight': 'N/A',
		'MarketOrder': False,
		'OrderBookStatusId': 0,
		'BaseOrderId': None,
		'Notified': False,
		'OrderClassId': 1
	}, {
		'Date': '2018-11-26 21:30:16.530',
		'Time': '21:30',
		'OrderId': 4968187,
		'TypeName': 'Buy',
		'Quantity': ' 1700',
		'Price': '$0.0051',
		'CompletedAmount': '$8.67',
		'OrderStatus': 'Completed',
		'OrderStatusId': 4,
		'Type': 'buy',
		'Linheight': 'N/A',
		'MarketOrder': False,
		'OrderBookStatusId': 0,
		'BaseOrderId': None,
		'Notified': False,
		'OrderClassId': 1
	}, {
		'Date': '2018-11-26 21:39:14.670',
		'Time': '21:39',
		'OrderId': 4968226,
		'TypeName': 'Buy',
		'Quantity': ' 1700',
		'Price': '$0.0051',
		'CompletedAmount': '$8.67',
		'OrderStatus': 'Completed',
		'OrderStatusId': 4,
		'Type': 'buy',
		'Linheight': 'N/A',
		'MarketOrder': False,
		'OrderBookStatusId': 0,
		'BaseOrderId': None,
		'Notified': False,
		'OrderClassId': 1
	}, {
		'Date': '2018-11-29 05:46:06.307',
		'Time': '05:46',
		'OrderId': 4969198,
		'TypeName': 'Buy',
		'Quantity': ' 2721.09',
		'Price': '$0.00735',
		'CompletedAmount': '$19.9183',
		'OrderStatus': 'Completed',
		'OrderStatusId': 4,
		'Type': 'buy',
		'Linheight': 'N/A',
		'MarketOrder': False,
		'OrderBookStatusId': 0,
		'BaseOrderId': None,
		'Notified': False,
		'OrderClassId': 1
	}]
}
                                                                                       

取消订单

取消未完成的订单

类型 POST

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

参数

apiKey: 公钥
orderId(必填): 提交订单的ID
sign: 公钥/私钥签名

响应

success数组非空,失败则fail数组非空. fail数组将包含错误信息的描述

示例

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

Post 参数

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

响应

{'code': 200, 'message': 'Success', 'data': {}}

获取订单详情

获取所有未完成订单或特定订单的列表

类型 POST

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

参数

apiKey: 公钥
orderid(必填): '-1'返回所有未完成订单, 订单号返回订单详情
symbol(必填): 您要检索数据的货币对(必须大写)
sign: 公钥/私钥签名

响应

frozen: 对于给定货币的未完成订单使用的金额和转换为人民币的所有货币的总冻结金额

示例

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

Post 参数

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

响应

{
	'code': 200,
	'message': 'Success',
	'data': {
		'amount': 27.5,
		'avgPrice': 0.0,
		'completedAmount': '0',
		'createDate': 1544077845917,
		'orderId': 4970058,
		'price': 0.00029,
		'status': 5,
		'type': 'sell',
		'fee': 0.0,
		'cid': None,
		'source': 'API'
	}
}          

根据状态获取订单

获取具有特定状态的所选orderbook的订单列表

类型 POST

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

参数

apiKey:公钥
symbol(必填): 您要检索数据的货币对(必须大写)
statusid(必填): 0 = 所有,2=活跃,3=部分完成,4=已完成,5=已取消,6=挂起
duration: 几秒前
pageindex(必填):第几页
pagesize(必填): 每页列表数量[1,100]
sign: 公钥/私钥签名

响应

amount: 订单数量
avgPrice: 订单平均成交价
completedAmount: 订单已完成数量
createDate: 订单创建UNIX时间戳
updateDate: 订单更新UNIX时间戳
orderId: 订单ID
price: 订单价格
status:

1,等待
2,活跃
3,部分完成
4,已完成
5,已取消
6,错误
7,已挂起
8,等待计划委托触发
9,等待止损触发
11,已过期
12,取消中
fee:订单手续费
type: buy:限价买,sell:限价卖,marketbuy:市价买,marketsell:市价卖,
trigger:计划委托,stopLoss:止损,takeProfit:获利
cid: 用户自定义字符串, 不可重复
source: 订单来源

Example

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

Post 参数

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

响应

{
	'code': 200,
	'message': 'success',
	'data': {
		'rows': [{
			'amount': 5300.0,
			'avgPrice': 0.00379,
			'completedAmount': '5300',
			'createDate': 1544151083157,
			'updateDate': 1544151084233,
			'orderId': 4970265,
			'price': 0.0,
			'status': 4,
			'fee': 0.030131,
			'type': 'marketsell',
			'trigger': 0.00379,
			'cid': None,
			'source': 'API'
		}, {
			'amount': 4400.0,
			'avgPrice': 0.00459999,
			'completedAmount': '4400',
			'createDate': 1544077580090,
			'updateDate': 1544078181810,
			'orderId': 4970057,
			'price': 0.0046,
			'status': 4,
			'fee': 0.0,
			'type': 'sell',
			'trigger': 0.00459999,
			'cid': None,
			'source': 'API'
		}],
		'pageindex': 0,
		'pagesize': 2,
		'recordcount': 61,
		'pagecount': 31.0
	}
}