Hello,
I am trying to pass history frequency ('1m' , '1d') to the history function as a string variable but I get the error:
Error history() only supports the 'frequency' values '1d' or '1m'.
def initialize(context):
context.stock = symbol('AAPL')
def handle_data(context, data):
tf = '1d'
price_history = history(5,tf,'price')[context.stock]
I also tried :
def initialize(context):
context.stock = symbol('AAPL')
def handle_data(context, data):
tf = '1d'
price_history = history(5,str(tf),'price')[context.stock]
The reason I want to do this, is that I have a class and I want to make instances for my stock universe (daily, minutely, hourly...), and then pass them the time-frames as variables in the init , I can only now copy the whole class and rename them to class_minute, class_daily which is not an object oriented approach.
any help is appreciated