Bitcoin
A$ 88,072
WINkLink
A$ 0.0008679
Ethereum
A$ 5,514.7

Huboi websocket data pull

I’ve a problem with Huobi Websocket, I know my ways in REST API but new to asyncio and websockets and Huobi only gives resonable amount of history through websocket request so I’m stuck with it. I managed to figure this out:

from huobi.client.market import MarketClient
from huobi.client.market import CandlestickInterval
import pandas as pd
from pandas import DataFrame as df

def callback(candlestick_req: "CandlestickReq"):
    Candles = candlestick_req.data

Market_client = MarketClient()
Market_client.req_candlestick("btcusdt", CandlestickInterval.MIN60, callback, from_ts_second = 1611788400, end_ts_second = 1614812400)

History_dataframe_new["Date"] = [Candles[f].id for f in range(len(Candles))]
History_dataframe_new["Open"] = [Candles[f].open for f in range(len(Candles))]
History_dataframe_new["High"] = [Candles[f].high for f in range(len(Candles))]
History_dataframe_new["Low"] = [Candles[f].low for f in range(len(Candles))]
History_dataframe_new["Close"] = [Candles[f].close for f in range(len(Candles))]
History_dataframe_new["Volume"] = [Candles[f].vol for f in range(len(Candles))]

The problem is, how can I get this Candles argument out of the callback to use below? I’m not calling callback directly, only in the req_candlestick so return won’t work. And it’s a callback so I propably have to wait for the response somehow. And tips how to do that? Or if what I’m trying here is the correct way?

Related Posts

Leave a Reply

Subscribe To Newsletter

For updates and exclusive offers, enter your e-mail below.

Donate To Cryptonic Australia


Donate BTC: 1MPYuHUKm3AhNivMSngqLnoEbpNEecHeEK
Donate Doge: DDYybw7H8zx8EYU74JrGW8WwmYh9AGuyMC
Donate WinK: TDiXutqKE3P17LpZMQh3SDBCGSkAC6iEjB




LUNA Outperforms Bitcoin’s Rally, Why It’s Ready For Massive Gains
October 20, 2021
Recoverybitcoins
October 20, 2021
Medical Firm In Mexico To Introduce COVID-19 Testing Through Blockchain
October 20, 2021




LUNA Outperforms Bitcoin’s Rally, Why It’s Ready For Massive Gains
October 20, 2021
Recoverybitcoins
October 20, 2021
Medical Firm In Mexico To Introduce COVID-19 Testing Through Blockchain
October 20, 2021


CryptoCurrencyAUDChange 1hChange 24hChange 7d
Bitcoin88,072 0.35 % 3.50 % 17.53 %
Ethereum5,514.7 0.32 % 7.70 % 18.52 %
Binance Coin670.80 0.25 % 3.72 % 14.52 %
Cardano2.910 0.05 % 4.06 % 3.43 %
Tether1.340 0.29 % 0.53 % 0.27 %
XRP1.520 0.04 % 5.13 % 3.71 %
Solana229.92 0.39 % 10.59 % 13.72 %
Polkadot59.27 0.08 % 7.72 % 26.83 %
Dogecoin0.3411 0.15 % 4.24 % 13.28 %
USD Coin1.340 0.23 % 0.58 % 0.29 %

Recent Comments

Allison wick

I was a victim of WDC Markets investment scam some months ago myself. It was...

Greatness

he is the best when it comes to recovery, he helped recover my funds without...

URL

... [Trackback] [...] There you will find 63491 more Infos: cryptonic.com.au/evaluation-suggests-bitcoin-robust-palms-are-shopping-for-this-dip/ [...]