Using fetch_csv, I ran an simple algo that buy 10 stocks.
I get an following error.
"UnsupportedOrderParameters: Passing non-Asset argument to 'order()' is not supported. Use 'sid()' or 'symbol()' methods to look up an Asset."
can any one tell me what's wrong?
# For fetcher
def rename_col(df):
df = df.rename(columns={'Adj Close': 'price'})
df = df.fillna(method='ffill')
df = df[['price', 'sid']]
return df
def initialize(context):
# Fetching the CSV
fetch_csv('https://copy.com/BmDtqiJkMXACEdP1',
date_column='Date',
symbol='oooo',
usecols=['Adj Close'],
post_func=rename_col,
date_format='%Y-%m-%d',
)
# Just here so handle_data will work
context.stock = sid(8554)
def handle_data(context, data):
if 'price' in data['oooo']:
current = data['oooo'].price
order(data['oooo'], 10)
record(oooo=current)