rongardF / tvdatafeed

A simple TradingView historical Data Downloader
MIT License
281 stars 153 forks source link

Would you please add the fuction about back adjustment? #27

Open z135426 opened 1 year ago

z135426 commented 1 year ago

It's a wonderful module to download data into python and analysis it. However, the futures in continuous contract need to be back adjustment to avoid the gap while changing contract to next month. TradingView has this function at the right bottom corner in the chart. It's a perfect module if you add this into tvdatafeed. Thanks a lot.

Sinansi commented 1 year ago

I would like to know if the prices downloaded using tvdatafeed are adjusted to dividend and splits or not?

Sinansi commented 1 year ago

I made test comparing chart prices and prices downloaded using tvdatafeed. I confirm that prices downloaded using tvdatafeed are not adjusted to dividend. tvdatafeed prices are adjusted for splits only.

Even if you login to your own account and you have dividend adjustment turned on, tvdatafeed will still download dividend unadjusted prices.

mocchibocchi commented 9 months ago

Anyone found a solution to this yet? Been searching...

Pofatoezil commented 8 months ago

@mocchibocchi ,try install this branch pip install --upgrade --no-cache-dir git+https://github.com/Pofatoezil/tvdatafeed.git@BackwardAdjustment

and use fut_badj in get_hist function to get backward adjustment price txf_h1_adj = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=True) if you need origin data, use txf_h1 = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=False)

mocchibocchi commented 8 months ago

Thanks, it appeared to install successfully. Errors when running it though -- just doesn't like fut_badj. For what it's worth, when i tried to load @.*** as a URL in browser, it said "Not Found".

This was the code I used: import pandas as pd from tvDatafeed import TvDatafeed, Interval

txf_h1_adj = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=True) print(txf_h1_adj)

and this was the result:

---------------------------------------------------------------------------TypeError Traceback (most recent call last) Cell In[12], line 3 1 import pandas as pd 2 from tvDatafeed import TvDatafeed, Interval----> 3 txf_h1_adj = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=True) 4 print(txf_h1_adj) TypeError: TvDatafeed.get_hist() got an unexpected keyword argument 'fut_badj'

On Fri, Mar 22, 2024 at 11:40 AM HuanYu Lee @.***> wrote:

@mocchibocchi https://github.com/mocchibocchi ,try install this branch pip install --upgrade --no-cache-dir git+ @.***

and use fut_badj in get_hist function to get backward adjustment price txf_h1_adj = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=True) if you need origin data, use txf_h1 = tv.get_hist(symbol='TXF',exchange='TAIFEX',interval=Interval.in_1_hour,n_bars=10000,fut_contract=1,fut_badj=False)

— Reply to this email directly, view it on GitHub https://github.com/rongardF/tvdatafeed/issues/27#issuecomment-2014290770, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGFFAZX4F6PFHIJ3D6MT65DYZORZJAVCNFSM6AAAAAA45TEVTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJUGI4TANZXGA . You are receiving this because you were mentioned.Message ID: @.***>

Pofatoezil commented 8 months ago

@mocchibocchi Perhaps you can refer to the [file changed] and try to fix it manually.