示例#1
0
def get_historical_data(token, interval, start, end=None):
    candles_data = client.get_historical_klines(token, interval, start, end)
    candles = []
    for candle in candles_data:
        candles.append(
            Candle(token, float(candle[1]), float(candle[4]), float(candle[2]),
                   float(candle[3]), float(candle[5]), float(candle[0])))
    return candles
示例#2
0
def get_candles(data, ticker):
    candles = []
    rows = data.shape[0]
    for i in range(rows):
        open_ = data[["Open"]]["Open"].iloc[i]
        close = data[["Close"]]["Close"].iloc[i]
        high = data[["High"]]["High"].iloc[i]
        low = data[["Low"]]["Low"].iloc[i]
        vol = data[["Volume"]]["Volume"].iloc[i]
        date = data.index[i]
        candles.append(Candle(ticker, open_, close, high, low, vol, date))
    # return reversed(candles)
    return candles
示例#3
0
def get_candles(data, symbol):
    candles_data = []
    if data["s"] != "ok":
        return False
    for i in range(len(data["v"])):
        close = data["c"][i]
        open_ = data["o"][i]
        high = data["h"][i]
        low = data["l"][i]
        volume = data["v"][i]
        date = data["t"][i]
        candles_data.append(Candle(symbol, open_, close, high, low, volume, date))
    return candles_data