Can someone clarify what I see here, please? With this code:
def initialize(context):
context.stocks = [sid(2), sid(24)]
def handle_data(context, data):
d = get_daily_prices(data, context)
if d is None:
return
@batch_transform(window_length=1, refresh_period=10)
def get_daily_prices(datapanel, context):
d = datapanel['price']
print d
return d
I get this output:
2012-01-03PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-03 14:31:00+00:00 to 2012-01-03 21:00:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
2012-01-17PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-17 14:31:00+00:00 to 2012-01-17 21:00:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
2012-01-18PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-17 14:32:00+00:00 to 2012-01-18 14:31:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
.
.
2012-01-18PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-17 21:00:00+00:00 to 2012-01-18 20:59:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
2012-01-31PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-31 14:31:00+00:00 to 2012-01-31 21:00:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
2012-02-01PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-31 14:32:00+00:00 to 2012-02-01 14:31:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
2012-02-01PRINT<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 390 entries, 2012-01-31 14:33:00+00:00 to 2012-02-01 14:32:00+00:00 Data columns (total 2 columns): 24 390 non-null values 2 390 non-null values dtypes: float64(2)
The second line of output is adavnced 10 days from the first. The third line of output is advanced one minute from the second. This continues until the end of that day when there is another 10 day advance followed by minutely ones.
Also, I don't understand the relationship between the date of the print statement and the start date of the data in the dataframe.
Is this by design?
P.