3 Star 4 Fork 2

jundayan / 火币网api交易接口

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

火币网api交易接口

介绍

此库是与火币api文档逐一开发的,通俗易懂,每个函数可以通过api文档找到对应,而且库已经经过优化,谢谢大家支持( 文档结构说明,exchange是接口的实现函数,exchangesetting是接口的配置文件,exchangetools是第三方工具。此架构放在爬虫scripy,配置文件单独配置,这样不用寻找相应的文件),之所以开发此库,就是希望中国有自己的ccxt,有兴趣一起开发的,可以加我微信号

# 获所有接口函数,对应的火币的api:

# 获取所有交易对:

# # 此接口返回所有火币全球站支持的交易对

print(huobipro.getAllsymbols())

print(huobipro.getAllsymbols(exchangedata='data'))

获取所有币种:

此接口返回所有火币全球站支持的币种

print(huobipro.getAllcurrency())

print(huobipro.getAllcurrency(exchangedata='data'))

获取当前系统时间:

此接口返回当前的系统时间,时间是调整为北京时间的时间戳,单位毫秒。

print(huobipro.getTimestamp())

print(huobipro.getTimestamp(exchangedata='data'))

K 线数据(蜡烛图):

此接口返回历史K线数据。

#参数详解:period是每根蜡烛的时间区间(1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year)

symbol是交易对(btcusdt),size是 K 线数据条数,可以不加此参数,默认150

# print(huobipro.getKline('15min','xrpusdt','2000',))

print(huobipro.getKline('15min', 'xrpusdt', '2000', exchangedata='data'))

聚合行情(Ticker)

# 此接口获取ticker信息同时提供最近24小时的交易聚合信息

#参数详解:symbol是交易对(btcusdt)

print(huobipro.getTicker('xrpusdt'))

print(huobipro.getTicker('xrpusdt', exchangedata='data'))

# 所有交易对的最新 Tickers

# 获得所有交易对的 tickers,数据取值时间区间为24小时滚动。

print(huobipro.getAllTicker())

print(huobipro.getAllcurrency(exchangedata='data'))

# 市场深度数据

# 此接口返回指定交易对的当前市场深度数据。

# 参数详解:symbol是交易对(btcusdt),type是深度的价格聚合度(step0,step1,step2,step3,step4,step5),depth是返回深度的数量,默认是20

@staticmethod

print(huobipro.getMarketdepth('xrpusdt',2,depth='20',))

print(huobipro.getMarketdepth('xrpusdt', 2, depth='20',exchangedata='data' ))

最近市场成交记录

# 此接口返回指定交易对最新的一个交易记录

# 参数详解:symbol是交易对(btcusdt),

print(huobipro.getNewtrade('xrpusdt'))

print(huobipro.getNewtrade('xrpusdt',exchangedata='data'))

获得近期交易记录

# 此接口返回指定交易对近期的所有交易记录

# 参数详解:symbol是交易对(btcusdt),

print(huobipro.getAlltrade('xrpusdt'))

print(huobipro.getAlltrade('xrpusdt',exchangedata='data'))

最近24小时行情数据

# 此接口返回最近24小时的行情数据汇总

# 参数详解:symbol是交易对(btcusdt),

print(huobipro.getAlltrade('xrpusdt'))

print(huobipro.getAlltrade('xrpusdt',exchangedata='data'))

获取用户当前手续费率(需要登陆后操作):

Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致如有exchangcedata='data'则返回的是panda格式

print( huobipro.getFeerate(symbolrate='xrpusdt'))

print(huobipro.getFeerate(symbolrate='xrpusdt',exchangedata='data'))

账户信息(需要登陆后操作)

查询当前用户的所有账户 ID account-id 及其相关信息(需要登陆后操作)如有exchangcedata='data'则返回的是panda格式

print(huobipro.getAllaccounts())

print(huobipro.getAllaccounts(exchangedata='data'))

账户余额(需要登陆后操作)

查询指定账户的余额,支持以下账户:spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户如有exchangcedata='data'则返回的是panda格式

print(huobipro.getAccountsBalance(accountid='9547894'))

print(huobipro.getAccountsBalance(accountid='9547894',exchangedata='data'))

稳定币兑换汇率((需要登陆后操作)

查询稳定币兑换汇率如有exchangcedata='data'则返回的是panda格式

print(huobipro.getExchangerate())

print(huobipro.getExchangerate(exchangedata='data'))

虚拟币提现(需要登陆后操作)

API Key 权限:提币则返回的如有exchangcedata='data'则返回的是panda格式

print(huobipro.postCreateWithdraw(gpvarsetting.gpokex['xrpwithdraw'],'10','xrp',addrtag=gpvarsetting.gpokex['xrpbiaoqian']))

print(huobipro.postCreateWithdraw(gpvarsetting.gpokex['xrpwithdraw'],'10','xrp',addrtag=gpvarsetting.gpokex['xrpbiaoqian'],exchangedata='data'))

充提记录(需要登陆后操作)

查询充提记录如有exchangcedata='data'则返回的是panda格式

print(huobipro.getDepositwithdraw())

print(huobipro.getDepositwithdraw(exchangedata='data'))

下单充提记录(需要登陆后操作)

发送一个新订单到火币以进行撮合。如有exchangcedata='data'则返回的是panda格式

print(huobipro.postOrders('9538734','xrpusdt','buy-limit','6','0.2',exchangedata='data'))

print(huobipro.postOrders('9538734','xrpusdt','buy-limit','6','0.2',exchangedata='data'))

撤销订单

此接口发送一个撤销订单的请求。如有exchangcedata='data'则返回的是panda格式

print(huobipro.postSubmmitcancel('432421'))

print(huobipro.postSubmmitcancel('431241',exchangedata='data'))

查询当前未成交订单(需要登陆后操作)

查询已提交但是仍未完全成交或未被撤销的订单。如有exchangcedata='data'则返回的是panda格式

print(huobipro.getOpenOrders('9538734','xrpusdt'))

print(huobipro.getOpenOrders('9538734', 'xrpusdt',exchangedata='data'))

批量撤销订单(需要登陆后操作)

此接口发送批量撤销订单的请求。如有exchangcedata='data'则返回的是panda格式

print(huobipro.postCancelOpenOrders('9538734'))

print(huobipro.postCancelOpenOrders('9538734',exchangedata='data'))

下单充提记录(需要登陆后操作)

发送一个新订单到火币以进行撮合。如有exchangcedata='data'则返回的是panda格式

print(huobipro.postBatchcancel([a,b]))

print(huobipro.postBatchcancel([a, b],exchangedata='data'))

查询订单详情(需要登陆后操作)

此接口返回指定订单的最新状态和详情如有exchangcedata='data'则返回的是panda格式

print(huobipro.getOrdersinfo(a))

print(huobipro.getOrdersinfo(a,exchangedata='data'))

成交明细(需要登陆后操作)

此接口返回指定订单的成交明细如有exchangcedata='data'则返回的是panda格式

print(huobipro.getMatchresults(a))

print(huobipro.getMatchresults(b,exchangedata='data'))

搜索历史订单 (需要登陆后操作)

此接口基于搜索条件查询历史订单。如有exchangcedata='data'则返回的是panda格式

print(huobipro.getHistoryorders('xrpusdt','filled'))

print(huobipro.getHistoryorders('xrpusdt', 'filled',exchangedata='data'))

搜索最近48小时内历史订单(需要登陆后操作)

此接口基于搜索条件查询最近48小时内历史订单。如有exchangcedata='data'则返回的是panda格式

print(huobipro.gethistory48hours())

print(huobipro.gethistory48hours(exchangedata='data'))

当前和历史成交(需要登陆后操作)

此接口基于搜索条件查询当前和历史成交记录,如有exchangcedata='data'则返回的是panda格式

print(huobipro.getHMatchresults('xrpusdt'))

print(huobipro.getHMatchresults('xrpusdt',exchangedata='data'))

币币现货账户与合约账户划转(需要登陆后操作)

此接口用户币币现货账户与合约账户之间的资金划转。

从现货现货账户转至合约账户,类型为pro-to-futures; 从合约账户转至现货账户,类型为futures-to-pro

该接口的访问频次的限制为1分钟10次。如有exchangcedata='data'则返回的是panda格式

print(huobipro.postAccounttransfer('xrp',10.00, 'futures-to-pro'))

print(huobipro.postAccounttransfer('xrp',10.00,'pro-to-futures',exchangedata='data'))

资产划转(需要登陆后操作)如有exchangcedata='data'则返回的是panda格式

此接口用于现货账户与杠杆账户的资产互转从现货账户划转至杠杆账户 transfer-in,从杠杆账户划转至现货账户 transfer-out

print(huobipro.postMargintransferout('xrpusdt','xrp','3'))

print(huobipro.postMargintransferout('xrpusdt', 'xrp', '3',exchangedata='data'))

print(huobipro.postMargintransferin('xrpusdt','xrp','3'))

print(huobipro.postMargintransferin('xrpusdt','xrp','3',exchangedata='data'))

申请借贷(需要登陆后操作)

此接口用于申请借贷.如有exchangcedata='data'则返回的是panda格式

print(huobipro.postmarginorders('xrpusdt','xrp','1'))

print(huobipro.postmarginorders('xrpusdt', 'xrp', '1',exchangedata='data'))

归还借贷(需要登陆后操作)

此接口用于归还借贷.如有exchangcedata='data'则返回的是panda格式

print(huobipro.postRepay('32432','122'))

查询借贷订单(需要登陆后操作)

此接口基于指定搜索条件返回借贷订单。如有exchangcedata='data'则返回的是panda格式

print(huobipro.getSearchorders('xrpusdt'))

print(huobipro.getSearchorders('xrpusdt',exchangedata='data'))

借贷账户详情

# 此接口返回借贷账户详情。如有exchangcedata='data'则返回的是panda格式

print(huobipro.getMarginbalance())

print(huobipro.getMarginbalance(exchangedata='data'))

合约期货

合约市场行情接口

此接口返回合约信息。

print(huobipro.getContractinfo())

print(huobipro.getContractinfo(exchangedata='data'))

此接口返回合约指数。

print(huobipro.getContractindex('XRP'))

qihuoprice =huobipro.getContractindex('XRP',exchangedata='data').iloc[0, 1]

qihuozhanshu = math.floor(57 * qihuoprice / 10)

print(qihuozhanshu )

#此接口返回期货合约历史K线数据。

print(huobipro.getMarketkline(r'15min','XRP_CQ','500'))

print(huobipro.getMarketkline(r'15min', 'XRP_CQ', '1800',exchangedata='data'))

期货账户详情

此接口返回期货账户详情。

参数详解:symbol是单个xrp

print(huobipro.postContractaccountinfo('xrp')['data'])

print(int(huobipro.postContractaccountinfo('XRP',exchangedata='data').iloc[0,1]))

print(huobipro.postContractpositioninfo('EOS'))

print(int(huobipro.postContractpositioninfo('XRP',exchangedata='data').iloc[0,3]))

print(huobipro.postContractorders('XRP', 'quarter', 'XRP191227',1, 'sell','open', 5, 'opponent'))

撤销订单期货合约下单

#id是必须的order_id

print(huobipro.postCancelcontractorders('XRP',order_id='131'))

撤销所有订单

print(huobipro.postALLcancelcontractorders('XRP'))

id是必须的order_id

获取所有期货订单信息

print(huobipro.postContractorderinfo('XRP',order_id='129'))

print(huobipro.postLightningcloseposition('XRP', 'quarter', 'XRP191227',1, 'buy'))

print(huobipro.postAccounttransfer('xrp',10,'futures-to-pro'))

print(huobipro.postAccounttransfer('xrp', 10, 'pro-to-futures'))

Repository Comments ( 0 )

Sign in to post a comment

About

No description expand collapse
Python
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Python
1
https://gitee.com/dadafrancis/dclibzh.git
git@gitee.com:dadafrancis/dclibzh.git
dadafrancis
dclibzh
火币网api交易接口
master

Search

113223 674803ea 1850385 170725 2838fb2a 1850385