买卖行情API / Trades API

回来系统支持的一切买卖对的最高,最低 买卖行情和买卖量,每15秒钟更新。
Return the highest, lowest trade and the vulome of trade pairs. Refreshed every 15 seconds.
一切币种买卖API / All Pairs
http://api.btc38.com/v1/ticker.php?c=all&mk_type=cny
http://api.btc38.com/v1/ticker.php?c=all&mk_type=btc
单个币种买卖API / Single Pair
http://api.btc38.com/v1/ticker.php?c=btc&mk_type=cny
http://api.btc38.com/v1/ticker.php?c=ltc&mk_type=cny
http://api.btc38.com/v1/ticker.php?c=dog&mk_type=cny
http://api.btc38.com/v1/ticker.php?c=bts&mk_type=btc
http://api.btc38.com/v1/ticker.php?c=ltc&mk_type=btc
http://api.btc38.com/v1/ticker.php?c=dog&mk_type=btc
市场深度API / Depth API
回来当前市场深度(委托挂单),其间 asks 是委卖单, bids 是委买单。回来30条。
Return the trade depth (current orders). Asks for buyer's order and bids for seller's order. 30 items each.
http://api.btc38.com/v1/depth.php?c=btc&mk_type=cny
http://api.btc38.com/v1/depth.php?c=ltc&mk_type=cny
http://api.btc38.com/v1/depth.php?c=dog&mk_type=cny
http://api.btc38.com/v1/depth.php?c=bts&mk_type=btc
http://api.btc38.com/v1/depth.php?c=ltc&mk_type=btc
http://api.btc38.com/v1/depth.php?c=dog&mk_type=btc
前史成交API / History API
回来系统支持的前史成交记载,回来最新30条。
Return the trade history. 30 items for each call.
http://api.btc38.com/v1/trades.php?c=btc&mk_type=cny
http://api.btc38.com/v1/trades.php?c=ltc&mk_type=cny
http://api.btc38.com/v1/trades.php?c=dog&mk_type=cny
http://api.btc38.com/v1/trades.php?c=bts&mk_type=btc
http://api.btc38.com/v1/trades.php?c=ltc&mk_type=btc
http://api.btc38.com/v1/trades.php?c=dog&mk_type=btc
回来从[TID](买卖数自递增id)往后的最多500条前史成交记载(以比特币对人民币和比特股对比特币为例)
Return 500 items from the TID (BTC_CNY and BTS_BTC for example).
http://api.btc38.com/v1/trades.php?c=btc&mk_type=cny&tid=100
http://api.btc38.com/v1/trades.php?c=bts&mk_type=btc&tid=100

获取账户余额 Get Account Balance
http://www.btc38.com/trade/t_api/getMyBalance.php
调用方法 / Method:POST
传入参数 / Value:
key,年代提供的32位公钥 / public key
time,挂单时的时刻戳,单位为秒 / the timestamp or the order, measured by "second"
md5,运用md5(key_用户ID_skey_time),SKEY为32位密钥,次序不行倒置 / the result of md5(key_userID_skey_time), SKEY is the secret key
回来:
JSON格局的余额,含一切币种
挂单 Make an Orders
http://www.btc38.com/trade/t_api/submitOrder.php
调用方法 / Method:POST
传入参数 / Value:
key,年代提供的32位公钥 / public key
time,挂单时的时刻戳,单位为秒 / the timestamp or the order, measured by "second"
md5,运用md5(key_用户ID_skey_time),SKEY为32位密钥,次序不行倒置 / the result of md5(key_userID_skey_time), SKEY is the secret key
type,1为买入挂单,2为卖出挂单,不行为空 / the type of the order
mk_type,cny为人民币定价,btc为比特币定价,不行为空 / which market, BTC or CNY
price,价格,cny定价最多5位小数,btc定价最多8位小数,不同币种有所不同,以网站显现为准 / the price of the order.decimal digits varies as per coins, you can get thedecimal digits on our website
amount,数量,最多6位小数 / the amount of the order. 6decimal digits at most
coinname,币名,比方BTC、DOGE、BTS / the Symbol of the coin. Ex: BTC, DOGE, BTS
回来 / Return:
succ,挂单成功 / successful
overBalance,账户余额不足 / insuffient balance
其它回来表示不同的过错,状况太多,暂不罗列,这种过错产生的或许性不大
撤单 Cancel an Order
http://www.btc38.com/trade/t_api/cancelOrder.php
调用方法 / Method:POST
传入参数 / Value:
key,年代提供的32位公钥 / public key
time,挂单时的时刻戳,单位为秒 / the timestamp or the order, measured by "second"
md5,运用md5(key_用户ID_skey_time),SKEY为32位密钥,次序不行倒置 / the result of md5(key_userID_skey_time), SKEY is the secret key
mk_type,cny为人民币定价,btc为比特币定价,不行为空 / which market, BTC or CNY
order_id,要撤的单的ID the ID of the order you'd cancel
回来:
succ,撤单成功 /successful
overtime,该单不存在,或许已成交了 / order expired or traded

获取当前自己的挂单 Get Open Orders

http://www.btc38.com/trade/t_api/getOrderList.php

调用方法 / Method:POST
传入参数 / Value:
key,年代提供的32位公钥 / public key
time,挂单时的时刻戳,单位为秒 / the timestamp or the order, measured by "second"
md5,运用md5(key_用户ID_skey_time),SKEY为32位密钥,次序不行倒置 / the result of md5(key_userID_skey_time), SKEY is the secret key
mk_type,cny为人民币定价,btc为比特币定价,不行为空 / which market, BTC or CNY
coinname,币名,比方BTC、LTC,不填则回来悉数币种的挂单 / the coin's name. Eg.BTC、LTC. For default it will return order of all coins.
回来:
如果挂单为空,回来 [] / If there is no ordre, it will return []
如果挂单不为空,则回来比方 / if there is any order:
[https://bicoin8.com/wp-content/uploads/2023/04/202304211cHpE0.jpg"order_id":"123", "order_type":"1", "order_coinname":"BTC", "order_amount":"23.232323", "order_price":"0.2929"}, https://bicoin8.com/wp-content/uploads/2023/04/202304211cHpE0.jpg"order_id":"123", "order_type":"1", "order_coinname":"LTC","order_amount":"23.232323", "order_price":"0.2929"}]

行情API无须授权即可运用,买卖API需求公钥和密钥,如果您需求运用主动买卖API,请向咱们的客服讨取主动买卖API的公钥和密钥。
Public Key and Secret Key are demanded to use the trade API. If you need it, pelase contact our customer service.

因为咱们的分布式CDN对非HTTP请求做了约束,因而调用API时,您或许需求人为设置HTTP,以免被防火墙拦截。 调用API有技术方面的毛病,请联系加 API 技术QQ2805792922。
As the CDN has a technical strategy that limtes non-HTTP calling, you may need to config the header the HTTP request, so as to avoid the request being filtered. For technical help, please contact 2805792922(a)qq.com .

附件:调用典范 / Demo (PHP)

$date = new DateTime();
$stamp = $date->getTimestamp();
$mdt = "这里写公钥_这里写用户ID_这里写私钥_" . $stamp;
$mdt = md5($mdt);
$data = array("key" => "这里写公钥", "time" => $stamp, "md5" => $mdt, "type" => 1, "mk_type" => "cny",
"price" => "0.0001", "amount" => "100", "coinname" => "XRP");
//$data_string = json_encode($data);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, 'http://www.btc38.com/trade/t_api/submitOrder.php' );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; btc38 PHP bot; ' . php_uname('a') . '; PHP/' . phpversion() . ')');
$result = curl_exec($ch);
print_r($result);
?>

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注