Hello, Im new in Quantopian and im building my first Algo.
I have a question. I want to change the keys values of a dictionary for sids.
Does anybody knows how to do that?
def initialize(context):
#First universe of securities
context.stock = {25906: sid(25906), # VHT (Vanguard Health Care ETF)
25905: sid(25905) # VGT (Vanguard Information Technology ETF)
}
#Result of best stocks to trade
context.variables = {}
pass
def handle_data(context, data):
#Change context.stocks for the best stocks given in the function best_stocks
context.variables=best_stocks(context)
#New universe of securities
context.stocks = context.variables
#Order the best stocks
#order(context.stocks,100)
#Suppose that in best_stocks the Algo choose the best stocks in the market by some kind of rank
def best_stocks(context):
best = {24: 12, #Apple: qualification
46631: 10, #Google: qualification
5061: 4 #Microsoft: qualification
}
return best