Skip to content

Commit a7b60f5

Browse files
committed
[Add] 测试脚本
1 parent 7b44c58 commit a7b60f5

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ classifiers = [
2121
]
2222
requires-python = ">=3.10"
2323
dependencies = [
24-
"vnpy>=4.0.0",
25-
"pandas",
26-
"plotly",
24+
"vnpy>=4.0.0"
2725
]
2826
keywords = ["quant", "quantitative", "investment", "trading", "algotrading"]
2927

script/run.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from vnpy.event import EventEngine
2+
from vnpy.trader.engine import MainEngine
3+
from vnpy.trader.ui import MainWindow, create_qapp
4+
5+
from vnpy_ctp import CtpGateway
6+
from vnpy_portfoliostrategy import PortfolioStrategyApp
7+
8+
9+
def main() -> None:
10+
"""Start Trader"""
11+
qapp = create_qapp()
12+
13+
event_engine = EventEngine()
14+
main_engine = MainEngine(event_engine)
15+
16+
main_engine.add_gateway(CtpGateway)
17+
main_engine.add_app(PortfolioStrategyApp)
18+
19+
main_window = MainWindow(main_engine, event_engine)
20+
main_window.showMaximized()
21+
22+
qapp.exec()
23+
24+
25+
if __name__ == "__main__":
26+
main()

vnpy_portfoliostrategy/backtesting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def calculate_statistics(self, df: DataFrame = None, output: bool = True) -> dic
351351
max_drawdown_end = df["drawdown"].idxmin()
352352

353353
if isinstance(max_drawdown_end, date):
354-
max_drawdown_start = df["balance"][:max_drawdown_end].idxmax()
354+
max_drawdown_start = df["balance"][:max_drawdown_end].idxmax() # type: ignore
355355
max_drawdown_duration = (max_drawdown_end - max_drawdown_start).days
356356
else:
357357
max_drawdown_duration = 0

0 commit comments

Comments
 (0)