def placeOrder(self, symbol, pair, order=None, **order_params): """ Create Order model and place order to exchange. """ order_params['bot_id'] = self.bot_model.id new_order_model = placeNewOrder(self.exchange, symbol, pair, order, self.bot_model.test_run, order_params) if new_order_model != None: self.syncModels(pair, order, new_order_model) self.session.add(new_order_model) self.log('{} Order was placed succesfully on {}'.format( new_order_model.side, symbol))
def placeOrder(self, symbol, pair, order=None, **order_params): """ Create Order model and place order to exchange. """ order_params['bot_id'] = self.bot.id # print("Order params is") # pprint(order_params) new_order_model = placeNewOrder( self.exchange, symbol, pair, order, self.bot.test_run, order_params) if new_order_model != None: self.syncModels(pair, order, new_order_model) self.session.add(new_order_model) self.logOrSp('{} Order was placed succesfully on {}'.format( new_order_model.side, symbol), should_print=True)
def placeOrder(self, symbol, pair, order=None, **order_params): """ Create Order model and place order to exchange. """ order_params['bot_id'] = self.bot_model.id new_order_model = None try: new_order_model = placeNewOrder( self.exchange, symbol, pair, order, self.bot_model.test_run, order_params) except Exception as e: self.log('Error placing order for {}:'.format(symbol)) self.logError(sys.exc_info()) if new_order_model != None: self.syncModels(pair, order, new_order_model) self.session.add(new_order_model) self.log('{} Order was placed succesfully on {}'.format( new_order_model.side, symbol))