From d065f6c3521c02c3e411a87e87496109862af742 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 1 Nov 2019 14:34:37 +0800 Subject: [PATCH] [Add] position price data for BitmexGateway --- examples/vn_trader/run.py | 22 +++++++++++----------- vnpy/gateway/bitmex/bitmex_gateway.py | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/vn_trader/run.py b/examples/vn_trader/run.py index 92cc8257..55ca8949 100644 --- a/examples/vn_trader/run.py +++ b/examples/vn_trader/run.py @@ -8,7 +8,7 @@ from vnpy.trader.ui import MainWindow, create_qapp from vnpy.gateway.bitmex import BitmexGateway # from vnpy.gateway.futu import FutuGateway # from vnpy.gateway.ib import IbGateway -from vnpy.gateway.ctp import CtpGateway +# from vnpy.gateway.ctp import CtpGateway # from vnpy.gateway.ctptest import CtptestGateway # from vnpy.gateway.mini import MiniGateway # from vnpy.gateway.sopt import SoptGateway @@ -18,20 +18,20 @@ from vnpy.gateway.ctp import CtpGateway # from vnpy.gateway.oes import OesGateway # from vnpy.gateway.okex import OkexGateway # from vnpy.gateway.huobi import HuobiGateway -from vnpy.gateway.bitfinex import BitfinexGateway +# from vnpy.gateway.bitfinex import BitfinexGateway # from vnpy.gateway.onetoken import OnetokenGateway -from vnpy.gateway.okexf import OkexfGateway -from vnpy.gateway.okexs import OkexsGateway +# from vnpy.gateway.okexf import OkexfGateway +# from vnpy.gateway.okexs import OkexsGateway # from vnpy.gateway.xtp import XtpGateway # from vnpy.gateway.hbdm import HbdmGateway # from vnpy.gateway.tap import TapGateway # from vnpy.gateway.tora import ToraGateway # from vnpy.gateway.alpaca import AlpacaGateway -from vnpy.gateway.da import DaGateway -from vnpy.gateway.coinbase import CoinbaseGateway -from vnpy.gateway.bitstamp import BitstampGateway -from vnpy.gateway.gateios import GateiosGateway -from vnpy.gateway.bybit import BybitGateway +# from vnpy.gateway.da import DaGateway +# from vnpy.gateway.coinbase import CoinbaseGateway +# from vnpy.gateway.bitstamp import BitstampGateway +# from vnpy.gateway.gateios import GateiosGateway +# from vnpy.gateway.bybit import BybitGateway from vnpy.app.cta_strategy import CtaStrategyApp # from vnpy.app.csv_loader import CsvLoaderApp @@ -77,9 +77,9 @@ def main(): # main_engine.add_gateway(OkexsGateway) # main_engine.add_gateway(DaGateway) # main_engine.add_gateway(CoinbaseGateway) - main_engine.add_gateway(BitstampGateway) + # main_engine.add_gateway(BitstampGateway) # main_engine.add_gateway(GateiosGateway) - main_engine.add_gateway(BybitGateway) + # main_engine.add_gateway(BybitGateway) main_engine.add_app(CtaStrategyApp) main_engine.add_app(CtaBacktesterApp) diff --git a/vnpy/gateway/bitmex/bitmex_gateway.py b/vnpy/gateway/bitmex/bitmex_gateway.py index 02781cc4..8b168a8c 100644 --- a/vnpy/gateway/bitmex/bitmex_gateway.py +++ b/vnpy/gateway/bitmex/bitmex_gateway.py @@ -740,6 +740,7 @@ class BitmexWebsocketApi(WebsocketClient): exchange=Exchange.BITMEX, direction=Direction.NET, volume=d.get("currentQty", 0), + price=d.get("avgEntryPrice", 0), gateway_name=self.gateway_name, )