bibox基于ccxt合约量化开发笔记:查询获取单个币种市场行情(以永续合约LTC_USDT为例)

方法一:GET,不多说

https://api.bibox.com/v1/mdata?cmd=market&pair=BIX_BTC

方法二:用ccxt库

代码:

print(bibox.fetch_ticker('4LTC/USDT'))

结果:

{'symbol': '4LTC/USDT', 'timestamp': 1583895957888, 'datetime': '2020-03-11T03:05:57.888Z', 'high': 51.4, 'low': 48.988, 'bid': 49.845, 'bidVolume': None, 'ask': 49.92, 'askVolume': None, 'vwap': None, 'open': None, 'close': 49.906, 'last': 49.906, 'previousClose': None, 'change': None, 'percentage': 0.1, 'average': None, 'baseVolume': 3033233.0, 'quoteVolume': None, 'info': {'last': '49.9060', 'buy': '49.8450', 'sell': '49.9200', 'base_last_cny': '347.17700000', 'last_cny': '347.17', 'buy_amount': '321', 'percent': '+0.10%', 'pair': '4LTC_USDT', 'high': '51.4000', 'vol': '3033233', 'last_usd': '49.90', 'low': '48.9880', 'sell_amount': '630', 'timestamp': 1583895957888}}

结果说明:

‘symbol’: ‘4LTC/USDT’,//交易币种

‘timestamp’: 1583895957888,

‘datetime’: ‘2020-03-11T03:05:57.888Z’,

‘high’: 51.4,//24h最高价

‘low’: 48.988,//24h最低价

‘bid’: 49.845,

‘bidVolume’: None,

‘ask’: 49.92,

‘askVolume’: None,

‘vwap’: None,

‘open’: None,

‘close’: 49.906,

‘last’: 49.906,//24h最新价

‘previousClose’: None,

‘change’: None,

‘percentage’: 0.1,

‘average’: None,

‘baseVolume’: 3033233.0,

‘quoteVolume’: None,

‘info’: {

‘last’: ‘49.9060’,

‘buy’: ‘49.8450’,

‘sell’: ‘49.9200’,

‘base_last_cny’: ‘347.17700000’,

‘last_cny’: ‘347.17’,

‘buy_amount’: ‘321’,

‘percent’: ‘+0.10%’,//24h涨跌幅

‘pair’: ‘4LTC_USDT’, //交易币种

‘high’: ‘51.4000’,

‘vol’: ‘3033233’,

‘last_usd’: ‘49.90’,

‘low’: ‘48.9880’,

‘sell_amount’: ‘630’,

‘timestamp’: 1583895957888

 

本站资源源自互联网收集及网友分享-如有侵权请发邮件到admin@6688.one联系删除!
起航在线 » bibox基于ccxt合约量化开发笔记:查询获取单个币种市场行情(以永续合约LTC_USDT为例)

提供最优质的资源集合

立即查看 了解详情