Example #1
0
 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()
Example #2
0
 def get_stream(self):
     trade = ZTrade()
     trade.sleep = False
     return trade.get_stream()
Example #3
0
 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()
Example #4
0
 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()
Example #5
0
 def get_instruments(self):
     trade = ZTrade()
     trade.sleep = False
     return trade.get_instruments()
Example #6
0
 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()
Example #7
0
 def get_stream(self):
     trade = ZTrade()
     trade.sleep = False
     return trade.get_stream()
Example #8
0
 def get_instruments(self):
     trade = ZTrade()
     trade.sleep = False
     return trade.get_instruments()
Example #9
0
    def handle_noargs(self, **options):
        jpy = ZTrade()
        jpy.currency = "EUR/JPY"
        jpy.take_profit = 135.92
        jpy.stop_loss = 137.12
        jpy.buy = False
        jpy.start_pending()

        cad = ZTrade()
        cad.currency = "USD/CAD"
        cad.take_profit = 1.32001
        cad.stop_loss = 1.2918
        cad.buy = True
        cad.start_market()
Example #10
0
    def handle_noargs(self, **options):
        jpy = ZTrade()
        jpy.currency = "EUR/JPY"
        jpy.take_profit = 135.92
        jpy.stop_loss = 137.12
        jpy.buy = False
        jpy.start_pending()

        cad = ZTrade()
        cad.currency = "USD/CAD"
        cad.take_profit = 1.32001
        cad.stop_loss = 1.2918
        cad.buy = True
        cad.start_market()