Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, strategy, instrument, limitPrice, stopPrice, quantity, goodTillCanceled):
if limitPrice == None and stopPrice == None:
entryOrder = strategy.getBroker().createMarketOrder(broker.Order.Action.BUY, instrument, quantity, False)
elif limitPrice != None and stopPrice == None:
entryOrder = strategy.getBroker().createLimitOrder(broker.Order.Action.BUY, instrument, limitPrice, quantity)
elif limitPrice == None and stopPrice != None:
entryOrder = strategy.getBroker().createStopOrder(broker.Order.Action.BUY, instrument, stopPrice, quantity)
elif limitPrice != None and stopPrice != None:
entryOrder = strategy.getBroker().createStopLimitOrder(broker.Order.Action.BUY, instrument, stopPrice, limitPrice, quantity)
else:
assert(False)
Position.__init__(self, strategy, entryOrder, goodTillCanceled)
strategy.getBroker().placeOrder(entryOrder)
def __init__(self, strategy, instrument, limitPrice, stopPrice, quantity, goodTillCanceled):
if limitPrice == None and stopPrice == None:
entryOrder = strategy.getBroker().createMarketOrder(broker.Order.Action.BUY, instrument, quantity, False)
elif limitPrice != None and stopPrice == None:
entryOrder = strategy.getBroker().createLimitOrder(broker.Order.Action.BUY, instrument, limitPrice, quantity)
elif limitPrice == None and stopPrice != None:
entryOrder = strategy.getBroker().createStopOrder(broker.Order.Action.BUY, instrument, stopPrice, quantity)
elif limitPrice != None and stopPrice != None:
entryOrder = strategy.getBroker().createStopLimitOrder(broker.Order.Action.BUY, instrument, stopPrice, limitPrice, quantity)
else:
assert(False)
Position.__init__(self, strategy, entryOrder, goodTillCanceled)
strategy.getBroker().placeOrder(entryOrder)
def __init__(self, strategy, instrument, limitPrice, stopPrice, quantity, goodTillCanceled):
if limitPrice == None and stopPrice == None:
entryOrder = strategy.getBroker().createMarketOrder(broker.Order.Action.BUY, instrument, quantity, False)
elif limitPrice != None and stopPrice == None:
entryOrder = strategy.getBroker().createLimitOrder(broker.Order.Action.BUY, instrument, limitPrice, quantity)
elif limitPrice == None and stopPrice != None:
entryOrder = strategy.getBroker().createStopOrder(broker.Order.Action.BUY, instrument, stopPrice, quantity)
elif limitPrice != None and stopPrice != None:
entryOrder = strategy.getBroker().createStopLimitOrder(broker.Order.Action.BUY, instrument, stopPrice, limitPrice, quantity)
else:
assert(False)
Position.__init__(self, strategy, entryOrder, goodTillCanceled)
strategy.getBroker().placeOrder(entryOrder)
def __init__(self, strategy, instrument, limitPrice, stopPrice, quantity, goodTillCanceled):
if limitPrice == None and stopPrice == None:
entryOrder = strategy.getBroker().createMarketOrder(broker.Order.Action.BUY, instrument, quantity, False)
elif limitPrice != None and stopPrice == None:
entryOrder = strategy.getBroker().createLimitOrder(broker.Order.Action.BUY, instrument, limitPrice, quantity)
elif limitPrice == None and stopPrice != None:
entryOrder = strategy.getBroker().createStopOrder(broker.Order.Action.BUY, instrument, stopPrice, quantity)
elif limitPrice != None and stopPrice != None:
entryOrder = strategy.getBroker().createStopLimitOrder(broker.Order.Action.BUY, instrument, stopPrice, limitPrice, quantity)
else:
assert(False)
Position.__init__(self, strategy, entryOrder, goodTillCanceled)
strategy.getBroker().placeOrder(entryOrder)