Export historical OHLC data From IB datafeed to JSON
Axel-CH last edited by Axel-CH
Hi, first of all I would like to thank Backtrader creators and maintainers, it's an awesome framework with a great documentation. I'm not used to ask questions on a community forum. Usually all my questions / problematics are already answered on forums. But this time it's different. I did'nt found the solution that fit my issue.
I'm trying to backup the recieved datafeed received from IB. As you guys know IB placed some limitation on the numbers of request. As my strategy depend on a relatively important amount of data, i'm forced to backup localy the results.
I found on this topic: [https://community.backtrader.com/topic/524/save-cerebro-data-to-file-for-later-plotting-it-on-another-computer/4](link url)
That normaly we can use pickle to store the cerebro instance in a file, I have two issues with this:
1/ It doesn't work, I get the error "can't pickle _thread.RLock objects" even if I set bt.Cerebro(maxcpus=1)
2/ Apparently using pickle is slow, heavy and pose security issues
So the solution that I want to implement is Based On JSON like MessagePack. The problem is that I can't find the OHLC data in the "<backtrader.feeds.ibdata.IBData object>" because I don't know how to read the content of <backtrader.lineseries.Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_AbstractDataBase_DataBase_IBData object>
My question is: How can I get the OHLC data in a format that will allow me to convert them in JSON or Pandas or CSV.
Note that I'm trying to perform the backup in the init method of my strategy, after the data loading.
Thank you for your time,