Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Backtesting with fixed start_date and live end_date

Hello,

I am new to Quantopian and quite new to Python so maybe I am asking a very simple question. I would like to know how is it possible to get historical data in the IDE from a fixed start date in the past, up to the present date, i.e. e dynamic data window that increases its size of 1 observation every minute.

I would need something like the function of the notebook:
get_pricing(securities, fields='price', start_date=start, end_date=end ,frequency="daily")

but with the 'end_date' corresponding to the live price for every observation.

Thank you very much

6 responses
get_pricing('COHR',start_date='2016-10-17', end_date='2016-10-17', frequency = 'minute')  

Thank you Miles.

I think with your method I still get a fixed end_date. I need something that is able to update the end_date at every observation, keeping the start date fixed. Also, as far as I saw in other posts the function get_pricing works only in the notebook and not in the IDE.

many thanks

Andrea, you mean in your algorithm? If so look at data.history(assets, fields, bar_count, frequency) here

Keep in mind that bar_count is not fixed, you can increase it by 1 every minute

Luca,

Yes in my algo. If I use data.history I can only set a certain number of bars with respect to the actual present time. So I will have both the start_date and end_date rolling with time. What I need is to have my start_date fixed and my end_date = actual date, i.e. the end_date should be live. The result will be a data window that increases in size at every observation.

Thank you very much for your help

Luca 4 minutes ago
Keep in mind that bar_count is not fixed, you can increase it by 1 every minute

Thanks I will try that!