[Add] new spread trading app
This commit is contained in:
parent
afb079c9ca
commit
5a9dfa747d
17
vnpy/app/spread_trading/__init__.py
Normal file
17
vnpy/app/spread_trading/__init__.py
Normal 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"
|
13
vnpy/app/spread_trading/engine.py
Normal file
13
vnpy/app/spread_trading/engine.py
Normal 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)
|
1
vnpy/app/spread_trading/ui/__init__.py
Normal file
1
vnpy/app/spread_trading/ui/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .widget import SpreadManager
|
BIN
vnpy/app/spread_trading/ui/spread.ico
Normal file
BIN
vnpy/app/spread_trading/ui/spread.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
25
vnpy/app/spread_trading/ui/widget.py
Normal file
25
vnpy/app/spread_trading/ui/widget.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user