def CancelOrder(self, coinType, id): try: result = HuobiService.cancelOrder(coinType, id, CANCEL_ORDER, self.a_key, self.s_key) if result.has_key('result'): return result else: return {'result': 'fail'} except BaseException as e: print u'cancel order detect trouble!!', e
def cancel_order(self, db, order_id): try: order_info = HuobiService.getOrderInfo(2, order_id, ORDER_INFO) msg = '价格:%s,数量:%s ' % (order_info['order_price'], order_info['order_amount']) cancelResult = HuobiService.cancelOrder(2, order_id, CANCEL_ORDER) if cancelResult.has_key('result') and order_info: msg += '取消订单成功' else: msg += '取消订单失败' db.insert('tradePenny', time.strftime('%Y%m%d%H%M%S', time.localtime()), self.uid, msg) except BaseException as e: print 'ltcCancel wrong.', e