Closed glgnohk closed 5 years ago
I would like this exchange, as well, fwiw.
I would like this exchange, as well, fwiw.
I am mostly done for this issue, but then went on a long vacation. Will get back to it in a few days.
Great. Is there a document anywhere that describes the steps involved in adding an exchange?
@cticket yes - see https://github.com/bmoscon/cryptofeed/blob/master/docs/exchange.md
The subscription is a bit unique. From code comments in exchange/houbi_dm.py
:
Huobi_DM has 3 futures per currency (with USD as base): weekly, bi-weekly(the next week), and quarterly.
You must subscribe to them with: CRY_TC
where
CRY = BTC, ETC, etc.
TC is the time code mapping below:
mapping = {
"this_week": "CW", # current week
"next_week": "NW", # next week
"quarter": "CQ" # current quarter
}
So for example, to get the quarterly BTC future, you subscribe to "BTC_CQ", and it is returned to channel "market.BTC_CQ. ..."
However since the actual contract changes over time, we want to pubish the pair name using the actual expiry date, which
is contained in the exchanges "contract_code".
Here's what you get for BTC querying https://www.hbdm.com/api/v1/contract_contract_info on 2019 Aug 16:
[{"symbol":"BTC","contract_code":"BTC190816","contract_type":"this_week","contract_size":100.000000000000000000,"price_tick":0.010000000000000000,"delivery_date":"20190816","create_date":"20190802","contract_status":1}
,{"symbol":"BTC","contract_code":"BTC190823","contract_type":"next_week","contract_size":100.000000000000000000,"price_tick":0.010000000000000000,"delivery_date":"20190823","create_date":"20190809","contract_status":1}
,{"symbol":"BTC","contract_code":"BTC190927","contract_type":"quarter","contract_size":100.000000000000000000,"price_tick":0.010000000000000000,"delivery_date":"20190927","create_date":"20190614","contract_status":1},
...]
So we return BTC190927 as the pair name for the BTC quaterly future.
Also added tools/websockets_test.py
to help with websocket testing for new exchanges.
merged
For API docs, see https://huobiapi.github.io/docs/dm/v1/en/#introduction.
Similar to Huobi API, but some differences and different end point.