[Add] new spread trading app

This commit is contained in:
vn.py 2019-09-14 11:06:08 +08:00
parent afb079c9ca
commit 5a9dfa747d
5 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,17 @@
from pathlib import Path
from vnpy.trader.app import BaseApp
from .engine import SpreadEngine, APP_NAME
class AlgoTradingApp(BaseApp):
""""""
app_name = APP_NAME
app_module = __module__
app_path = Path(__file__).parent
display_name = "价差交易"
engine_class = SpreadEngine
widget_name = "SpreadManager"
icon_name = "spread.ico"

View File

@ -0,0 +1,13 @@
from vnpy.event import EventEngine, Event
from vnpy.trader.engine import BaseEngine, MainEngine
APP_NAME = "SpreadTrading"
class SpreadEngine(BaseEngine):
""""""
def __init__(self, main_engine: MainEngine, event_engine: EventEngine):
"""Constructor"""
super().__init__(main_engine, event_engine, APP_NAME)

View File

@ -0,0 +1 @@
from .widget import SpreadManager

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,25 @@
"""
Widget for spread trading.
"""
from vnpy.event import EventEngine, Event
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import QtWidgets, QtCore
from ..engine import (
AlgoEngine,
AlgoTemplate,
APP_NAME,
)
class SpreadManager(QtWidgets.QWidget):
""""""
def __init__(self, main_engine: MainEngine, event_engine: EventEngine):
""""""
super().__init__()
self.main_engine = main_engine
self.event_engine = event_engine
self.spread_engine = main_engine.get_engine(APP_NAME)