Esempio n. 1
0
def compute_data(token):
    global one_hour_rsi
    #enddate = datetime.datetime(2020, 5, 4, 15,30,0,0)
    enddate = datetime.datetime.today()
    startdate = enddate - datetime.timedelta(3)
    try:
        df = historical_data.get(kite, token, startdate, enddate, candlesize)
        df = SuperTrend.calc(df, supertrend_period, supertrend_multiplier)
        df = MACD.calc(df)
        rsi = historical_data.get(kite, token, startdate, enddate, "60minute")
        rsi = RSI.calc(rsi)
        one_hour_rsi = rsi.RSI_14.values[-1]
    except Exception as e:
        print("******* ERROR Computing Historical Data ********", token, e)
    return df
Esempio n. 2
0
def compute_data(token):
    global one_hour_rsi
    #enddate = datetime.datetime(2020, 5, 4, 15,30,0,0)
    enddate = datetime.datetime.today()
    startdate = enddate - datetime.timedelta(15)
    try:
        df = historical_data.get(kite, token, startdate, enddate, candlesize)
        df = EMA.calc(df, 'close', 'ema_5', 5)
        df = EMA.calc(df, 'close', 'ema_20', 20)
        df = MACD.calc(df)
        df = MFI.calc(df)
        df = VWAP.calc(df)
        rsi = historical_data.get(kite, token, startdate, enddate, "60minute")
        rsi = RSI.calc(rsi)
        one_hour_rsi = rsi.RSI_14.values[-2]
    except Exception as e:
        print("******* ERROR Computing Historical Data ********", token, e)
    return df