<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Weekend Trend Trader
This notebook outlines experiments in getting my weekend trend trader code implemented.
Step1:  Get Daily price data for Caltex.
Step2:  Transform to Weekly
Not sure if there is a better way of doing this? 
So far this is the best I have found. The Pandas API doco is rather poor in this area.
Step3:  All Ords Moving Average
To enter trade, 10 week moving average of All Ords must be greater than last week.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import pandas.io.data as web
import datetime
Explanation: Weekend Trend Trader
This notebook outlines experiments in getting my weekend trend trader code implemented.
End of explanation
# date ranges
end = datetime.date(2015, 1, 26)
start = end + datetime.timedelta(weeks=-21)
start
# Get daily price data for Caltex
ctx = web.DataReader('ctx.ax', 'yahoo', start, end)
ctx
Explanation: Get Daily price data for Caltex.
End of explanation
# resample to weekly ohlc data starting on Monday
weekly = pd.DataFrame()
weekly["Open"] = ctx['Open'].resample('W-FRI', how='first')
weekly["High"] = ctx['High'].resample('W-FRI', how='max')
weekly["Low"] = ctx['Low'].resample('W-FRI', how='min')
weekly["Close"] = ctx['Close'].resample('W-FRI', how='last')
weekly["Volume"] = ctx['Volume'].resample('W-FRI', how='mean')
weekly
# Work out 20 week Rate of Change in price.
round((weekly["Close"][-1] - weekly["Close"][-21]) / weekly["Close"][-21], 2)
# Work out 20 week high of closing prices
weekly["Close"][-21:-1]
weekly["Close"][-21:-1].max()
Explanation: Transform to Weekly
Not sure if there is a better way of doing this? 
So far this is the best I have found. The Pandas API doco is rather poor in this area.
End of explanation
# date ranges
end = datetime.date(2015, 1, 26)
start = end + datetime.timedelta(weeks=-12)
all_ords = web.DataReader('^AORD', 'yahoo', start, end)
all_ords
weekly_ords = pd.DataFrame()
weekly_ords["Close"] = all_ords["Close"].resample("W-FRI", how="last")
weekly_ords
# 10 week moving average
pd.rolling_mean(weekly_ords["Close"], 10)
weekly_ords.plot()
nums = pd.Series([1,2,3,4,5,6,7,8,9,10,11])
pd.rolling_mean(nums,5)
Explanation: All Ords Moving Average
To enter trade, 10 week moving average of All Ords must be greater than last week.
End of explanation
<END_TASK>