A: Yes. The historical data received in IBridgePy from the IB server are saved in data[symbol(‘xxx’)].hist that is a pandas dataframe. Therefore, you can save it to a csv file by pd.dataframe.to_csv(“Path_to_your_local_folder”) and use it later in anyway.
Example: Request historical data of AAPL and SPY and save them to local folder.
def initialize(context): pass def handle_data(context, data): request_data(historyData=[(symbol('SPY'), '1 min', '1 D'),(symbol('AAPL'), '1 day', '10 D') ]) print data[symbol('SPY')].hist['1 min'].tail() print data[symbol('AAPL')].hist['1 day'].tail() data[symbol('AAPL')].hist['1 day'].to_csv('AAPL_hist.csv') data[symbol('SPY')].hist['1 min'].to_csv('SPY_hist.csv') exit()