Accessing downloaded IBData outside of Strategie-class:
very happy with first experiences! great software! specially with online data-connect via IB.
But somehow I experience restriction and cannot find solution in docu/references/community:
Accessing IBData-download outside of Strategie-class:
Maybe not wanted?
Design-Feature of Backtrader?
While I am starting with Backtrader I need
- to check data exactly:
- exchange data with other application.
Of course many ways to check data, but just want to be able to do a very simple "print(IBData)", but somehow I cannot find a way doing this outside the strategie-class.
So many ways to access data inside-Strategie
Maybe its possible to create an numpy-array inside strategie, while this is NOT-WANTED to be stand-alone and indepentend from other py-libs (Philosophy of Backtrader).
But how to export np.array before or without running the strategie-class?
Allowed to use the IBData-API as Dataprovider also for other py-projects? (f.e. tensorflow NN-training)
Not allowed to add some indicator-values to IBData and feedforward to other analytics-software , and request an answer to integrate it in calculation of Backtrader-Strategie-class?
Loading works, adding and calculate insite Strategie also.
How do access single entries of SampleData and f.e. print it?
data = bt.feeds.IBData(dataname='EUR.USD-CASH-IDEALPRO', host='127.0.0.1', port=7496, historical=True, #fromdate='2019-01-01', #YYYY-MM-DD #todate=2020, #fromdate=datetime.datetime(2020, 8, 6)) #todate=datetime.datetime(2020, 1, 1), #timeframe=5) rtbar=True) SampleData=data.close print('SampleData: ', SampleData)
to be understood correctly: Access IBData
- before execute the backtesting at all
- even before creating cerebro
Just after downloading (as above) at beginning of everything.
SampleData=data.params.dataname print('SampleData: ', SampleData)
With the output:
But how to access the single entries?
(I need last 20 data-points, With D1-timeframe the last 20 days)
vladisld last edited by
Data feeds in general and IBData in particular, do not load any data (historical or live) during the instantiation. IBData will issue the historical data subscription request only when its
startmethod will be called, which in turn will be called within Cerebro engine
So, answering your question, getting the data from the data feeds before running the Cerebro
runmethod is not possible ( at least not with current design).
Thanks alot for this important information!
Just discussed here with friends and it came up topic with "data-quality", which is said to be expensive!
Free-Data has only a quality of 70% !
Is that true? What does that mean?
This kind of statement definatelly needs exact qualification of spezific quality-aspects!
Untrusting IB-Data feels like untrusting the Broker itself!
Restrictions are there, but not in quality,
Anybody experienced backtesting-trouble caused by bad dataquality of OFFICIALLY(!) downloaded historical-data?
Sound crazy and unreal.
- you corrupted your data yourself :)
- ok, maybe some gaps or irritations after marketclosing, when nobody should trade anyway.)
- maybe differences in data at DealingDesk- or MarketMaker-Broker, which make their own market, and nobody should trade with them anyway.
As this is topic far away from coding, and i can hardly find information and seems very important for Back-Trading.
Just4Info: Attached some datasources, that passes my way.