if context.dal in data:
order(context.dal,100)
Thank you..!
# For this example, we're going to write a simple momentum script. When the
# stock goes up quickly, we're going to buy; when it goes down quickly, we're
# going to sell. Hopefully we'll ride the waves.
# To run an algorithm in Quantopian, you need two functions: initialize and
# handle_data.
def initialize(context):
# This initialize function sets any data or variables that you'll use in
# your algorithm. For instance, you'll want to define the security (or
# securities) you want to backtest. You'll also want to define any
# parameters or values you're going to use.
# In our example, we're looking at Apple. If you re-type this line
# yourself, you'll see the auto-complete that is available for the
# security ID.
context.dal = sid(2079)
context.ual = sid(28051)
context.dal_invested = False
context.ual_invested = False
# In these two lines, we set the maximum and minimum we want our algorithm
# to go long or short our security. You don't have to set limits like this
# when you write an algorithm, but it's good practice.
context.max_notional = 1000000.1
context.min_notional = -1000000.0
def handle_data(context, data):
# This handle_data function is where the real work is done. Our data is
# minute-level tick data, and each minute is called a frame. This function
# runs on each frame of the data.
#price = data[context.dal].price
if context.dal in data:
order(context.dal,100)