Hey guys, so after I set up my algo to fetch and parse a CSV I have set up, it seems I am unable to iterate "data" when attempting to go live. Any suggestions on how to combat this issue?
import datetime
import pandas as pd
import numpy as np
import talib
import math
def my_universe(context, fetcher_data):
my_stocks = set(fetcher_data['sid'])
context.count = len(my_stocks)
return my_stocks
# see a snapshot of your CSV for debugging
def preview(df):
log.info(' %s ' % df.head())
return df
def initialize(context):
log.info("starting")
set_long_only()
context.money = context.portfolio.cash
# import the custom CSV data file
fetch_csv("http://54.183.4.219/api/equities_test.csv",
pre_func=preview,
post_func=preview,
date_column='start_date',
universe_func=(my_universe))
schedule_function(portfolio_buy,date_rules.every_day(), time_rules.market_open(hours=0,minutes=5))
def portfolio_buy(context, data):
for sec in data:
order_value(sec, 10000)
def handle_data(context,data):
print('handling data')
pass