From e1eedc063b58476fb6e9bb97ad1353f4eb24bf7c Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 1 Nov 2019 15:39:10 +0800 Subject: [PATCH] [Fix] typo --- vnpy/app/spread_trading/base.py | 2 +- vnpy/app/spread_trading/ui/widget.py | 2 +- vnpy/gateway/bitmex/bitmex_gateway.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vnpy/app/spread_trading/base.py b/vnpy/app/spread_trading/base.py index d7b460ea..3e3b5805 100644 --- a/vnpy/app/spread_trading/base.py +++ b/vnpy/app/spread_trading/base.py @@ -136,7 +136,7 @@ class SpreadData: self.active_leg: LegData = None self.passive_legs: List[LegData] = [] - self.min_volume = 0.1 + self.min_volume = 0.001 # For calculating spread price self.price_multipliers: Dict[str, int] = price_multipliers diff --git a/vnpy/app/spread_trading/ui/widget.py b/vnpy/app/spread_trading/ui/widget.py index 0b512e19..b0eef051 100644 --- a/vnpy/app/spread_trading/ui/widget.py +++ b/vnpy/app/spread_trading/ui/widget.py @@ -228,7 +228,7 @@ class SpreadAlgoWidget(QtWidgets.QFrame): ) self.offset_combo = QtWidgets.QComboBox() - self.offset_combo.addItem( + self.offset_combo.addItems( [Offset.NONE.value, Offset.OPEN.value, Offset.CLOSE.value] ) diff --git a/vnpy/gateway/bitmex/bitmex_gateway.py b/vnpy/gateway/bitmex/bitmex_gateway.py index 8b168a8c..ac143694 100644 --- a/vnpy/gateway/bitmex/bitmex_gateway.py +++ b/vnpy/gateway/bitmex/bitmex_gateway.py @@ -744,6 +744,10 @@ class BitmexWebsocketApi(WebsocketClient): gateway_name=self.gateway_name, ) + # avgEntryPrice may be None instead of 0 sometimes + if position.price is None: + position.price = 0 + self.gateway.on_position(position) def on_account(self, d):