1. Support Center
  2. Liberator Python User's Guide & Recipes

Usage of the back_to parameter FAQ-p8

Retrieving all data for a range of time

The back_to parameter is also datetime parameter, and again you can set it to a date alone ie. 

'2024-07-08' 


Which Liberator will interpret as midnight on that date ie..

'2024-07-08 00:00:00.000000'


Or you can set it to any time, down to the nanosecond, as displayed above.


NOTE: All Liberator times are NY Time (US ET).


REMINDER: When setting your query parameters, consider the amount of data you may be requesting and start small if you can until you get a good idea of how much data is returned for each symbol/date range combination.


DEFAULT VALUE: If you do not pass a back_to Liberator will default to None - see description below for the effect this will have on your query.


I think from the examples given you already have a good idea of how back_to works in normal usage but what happens when you DROP the back_to or set it to None?


If you DROP back_to or set it to None, liberator will attempt to give you the most recent value for your symbol set at the as_of time provided. Example…


df = liberator.get_dataframe(liberator.query( name = 'daily_bars', as_of ='2023-12-25', symbols = ['GOOG','AAPL','MSFT']))


Here we try to get the most recent daily bar data as_of Christmas Day 2023. In that case, the most recent trading day was 2023-12-22 so the dataframe returned looked something like this…

faq-p8-i1