Hey, can someone put into my code, code that will sell my selected security two minutes until close time
Here is my code:
def initialize(context):
context.stock =sid(24757)
def handle_data(context, data):
data[context.stock].open_price
curr_bar = data[context.stock].price
open_price= data[context.stock].open_price
if curr_bar > open_price :
order(context.stock, 100, style=StopOrder(open_price))
def myfunc(context, data):
data[context.stock].open_price
curr_bar = data[context.stock].price
open_price= data[context.stock].open_price
if curr_bar <= open_price :
order(context.stock, -100, style=LimitOrder(open_price))