Skip to content

Commit

Permalink
Add error information when create new order
Browse files Browse the repository at this point in the history
  • Loading branch information
Demon-Hunter committed Aug 24, 2019
1 parent f4bec94 commit c540019
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions quant/platform/bitmex.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ async def create_order(self, action, price, quantity, order_type=ORDER_TYPE_LIMI
elif order_type == ORDER_TYPE_MARKET:
order_type_tmp = "Market"
else:
logger.error("order_type error! order_type:", order_type, caller=self)
return None
return None, "order type error"
quantity = abs(int(quantity))
success, error = await self._rest_api.create_order(action_tmp, self._symbol, price, quantity, order_type_tmp,
trade_type)
Expand Down
4 changes: 2 additions & 2 deletions quant/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def __init__(self, platform=None, account=None, strategy=None, symbol=None):
self.strategy = strategy
self.symbol = symbol
self.short_quantity = 0 # 空仓数量
self.short_avg_price = 0 # 空仓平均价格
self.short_avg_price = 0 # 空仓持仓平均价格
self.long_quantity = 0 # 多仓数量
self.long_avg_price = 0 # 多仓平均价格
self.long_avg_price = 0 # 多仓持仓平均价格
self.liquid_price = 0 # 预估爆仓价格
self.utime = None # 更新时间戳

Expand Down
2 changes: 2 additions & 0 deletions quant/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def __init__(self, strategy=None, platform=None, symbol=None, host=None, wss=Non
from quant.platform.gate import GateTrade as T
elif platform == const.KUCOIN:
from quant.platform.kucoin import KucoinTrade as T
elif platform == const.HUOBI_FUTURE:
from quant.platform.huobi_future import HuobiFutureTrade as T
else:
logger.error("platform error:", platform, caller=self)
e = Error("platform error")
Expand Down

0 comments on commit c540019

Please sign in to comment.