VIX RSI value

florixsoftware
If i want VIX RSI value on 3 min time frame, do I need historical API?

or at 9:15 I can start saving value of VIX and by 9:30 I can get RSI value of VIX when I want it?
Tagged:
  • rakeshr
    If i want VIX RSI value on 3 min time frame, do I need historical API?
    No, historical data APIs don't provide any indicator-based value. It only provides OHLCV data. Rest all calculations, you will have to do at your end.
  • CARahulPatel
    Yes You have to subscribe for Historical API.

    And here is my code which will help u in getting RSI of VIX 3 Mint Time Frame and 14 period.

    It will keep recalculatin at 15 Second Interval.

    def get_historicaldata(token=264969):
    enddate = dt.date.today()
    startdate = enddate - dt.timedelta(4)
    df = pd.DataFrame(columns=['date', 'open', 'high', 'low', 'close', 'volume'])
    try :
    data = kite.historical_data(token, startdate, enddate, interval,oi=1)
    df = pd.DataFrame.from_dict(data, orient='columns', dtype=None)
    if not df.empty:
    df = df[['date', 'open', 'high', 'low', 'close', 'volume','oi']]
    df['date'] = df['date'].astype(str).str[:-6]
    else:
    print("Error in getting historical data")
    except Exception as e:
    print("Error in getting historical data",e)
    return df

    def get_RSI(df, base="close", period=14):
    delta = df[base].diff()
    up, down = delta.copy(), delta.copy()
    up[up < 0] = 0
    down[down > 0] = 0
    rUp = up.ewm(com=period - 1, adjust=False).mean()
    rDown = down.ewm(com=period - 1, adjust=False).mean().abs()
    df['RSI'] = 100 - 100 / (1 + rUp / rDown)
    df['RSI'].fillna(0, inplace=True)
    return df.RSI.values[-1]

    RSI = 100
    df = ""
    entry_count = 1
    time_to_exit = 3*60 + 30 # no need change this time as it will change when max entry done.
    timenow = (datetime.now().hour * 60 + datetime.now().minute)

    def get_RSI_Value():
    while timenow < exit_time:
    global df
    global RSI

    df = get_historicaldata()
    get_RSI(df)
    sleep(15)


    t0 = threading.Thread(target=get_RSI_Value)
    t0.start()

    t0.join()
Sign In or Register to comment.