import ally
class AllyTrader():
def __init__(self, use_real_money):
self.ally = ally.Ally()
# True preview_order means we will only preview
# the order, not exectute it.
# False means the order will execute
self.preview_order = not use_real_money
def place_trailing_limit_order(self, ticker, trailing_percent, quantity):
order_price = ally.Order.TrailingStop(True, trailing_percent)
order = ally.Order.Order(
buysell = 'sell',
symbol = ticker,
price = order_price,
time = 'gtc',
qty = quantity
)
print(str(order))
self.ally.submit(order, preview=self.preview_order)
print(order.orderid)
return order
ally_trader=AllyTrader(False)
order = ally_trader.place_trailing_limit_order("AAPL",5,5)
print(order.id)
Is the trailing stop order type implemented in this library or are you trying to use the deprecated Ally functionality, resulting in an error?
Is the trailing stop order type implemented in this library or are you trying to use the deprecated Ally functionality, resulting in an error?