Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Simple data history question: Storing price as variable

I am trying to make an algorithm that runs every day that will buy JNUG if its price is .6% above the day's open price.

I would like to store the day's open price as a variable but can't figure out how (I'm a newbie to quantopian and programming).

I've tried many variations on the line below, even tried using some index stuff, but can't figure it out.

context.JnugOpen=data.history(sid(45570), 'open', 1, '1m').open

Can someone simply explain how I extract the "open" value and store it in a variable I can play around with? New to panda series and data frames and still trying to understand data history so feel free to start at the basic level. Thanks!

1 response

JnugOpen = data.history(sid(45570), 'open', 1, '1d')[-1]