def start_market(self): trade = ZTrade() trade.currency = self.currency trade.take_profit = self.take_profit trade.stop_loss = self.stop_loss trade.trailing_stop = self.trailing_stop trade.conditional_stop = self.conditional_stop if self.lots: trade.lots = self.lots else: trade.lots = settings.TRADE_LOTS trade.buy = self.is_buy trade.start_market() self.status = "trading" self.trade_id = trade.trade_id self.save()
def stop_pending(self): trade = ZTrade() trade.trade_id = self.trade_id trade.currency = self.currency if self.lots: trade.lots = self.lots else: trade.lots = settings.TRADE_LOTS trade.take_profit = self.take_profit trade.stop_loss = self.stop_loss trade.trailing_stop = self.trailing_stop trade.conditional_stop = self.conditional_stop trade.buy = self.is_buy self.status = "filled" trade.stop_pending() self.trade_id = None self.save()