Merge pull request #2157 from xldistance/patch-33

fix bybit_gateway price type error
This commit is contained in:
vn.py 2019-10-25 14:56:12 +08:00 committed by GitHub
commit 75f11862bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -787,7 +787,7 @@ class BybitWebsocketApi(WebsocketClient):
orderid=order_id, orderid=order_id,
tradeid=d["exec_id"], tradeid=d["exec_id"],
direction=DIRECTION_BYBIT2VT[d["side"]], direction=DIRECTION_BYBIT2VT[d["side"]],
price=d["price"], price=float(d["price"]),
volume=d["exec_qty"], volume=d["exec_qty"],
time=d["trade_time"], time=d["trade_time"],
gateway_name=self.gateway_name, gateway_name=self.gateway_name,
@ -822,7 +822,7 @@ class BybitWebsocketApi(WebsocketClient):
orderid=local_orderid, orderid=local_orderid,
type=ORDER_TYPE_BYBIT2VT[d["order_type"]], type=ORDER_TYPE_BYBIT2VT[d["order_type"]],
direction=DIRECTION_BYBIT2VT[d["side"]], direction=DIRECTION_BYBIT2VT[d["side"]],
price=d["price"], price=float(d["price"]),
volume=d["qty"], volume=d["qty"],
traded=d["cum_exec_qty"], traded=d["cum_exec_qty"],
status=STATUS_BYBIT2VT[d["order_status"]], status=STATUS_BYBIT2VT[d["order_status"]],
@ -845,7 +845,7 @@ class BybitWebsocketApi(WebsocketClient):
exchange=Exchange.BYBIT, exchange=Exchange.BYBIT,
direction=Direction.NET, direction=Direction.NET,
volume=volume, volume=volume,
price=d["entry_price"], price=float(d["entry_price"]),
gateway_name=self.gateway_name gateway_name=self.gateway_name
) )
self.gateway.on_position(position) self.gateway.on_position(position)