Monday, 11 November 2019

python quantopian 1 get stock price

Quantopian https://www.quantopian.com/ -> Research -> Algorithm -> change Start date 10/01/2019 End date 11/01/2019 -> save - > build algorithm

def initialize(context):
    context.aapl = sid(24)
   
def handle_data(context, data):
    #get apple stock price history data array, array consists data samples every minute from start to end date. Each data has 10 samples. 1 sample every day.
    hist = data.history(context.aapl, 'price', 10, '1d')
    log.info(hist)



No comments:

Post a Comment