Skip to main content
Sourav Basu Roy
Algo Trader with Python and Fyers API
Asked a question 4 months ago

How to fetch weekly OHLC data from Fyers Data API ?

Join FYERS Community to pick others' brains on Trading/Investing

I tried this and it works:


from fyers_api import accessToken

from fyers_api import fyersModel

import time

import pandas as pd

 data = {"symbol":symbol,"resolution":resolution,"date_format":date_format,"range_from":range_from,"range_to":range_to,"cont_flag":"1"}




           print('fyers is not defined , lets define it')

           fyers = fyres_login()#Use your login method


       df = pd.DataFrame(data=ss,columns=['Date', 'Open','High','Close','Low','Volume'])

       df['Date'] =[ time.strftime("%Y-%m-%d, %H:%M:%S",time.localtime(float(x))) for x in df['Date']]

       df['Date'] = pd.to24_datetime(df['Date'])

        fd = df.resample("W", on ='Date', closed='left', label='left').apply(ohlc_dict).dropna()

        #fd is the weekly data frame


Related Questions