diff --git a/vnpy/app/cta_backtester/engine.py b/vnpy/app/cta_backtester/engine.py index dec4492b..5281d0fc 100644 --- a/vnpy/app/cta_backtester/engine.py +++ b/vnpy/app/cta_backtester/engine.py @@ -339,7 +339,7 @@ class BacktesterEngine(BaseEngine): self.write_log(f"{vt_symbol}-{interval}开始下载历史数据") symbol, exchange = extract_vt_symbol(vt_symbol) - + req = HistoryRequest( symbol=symbol, exchange=exchange, @@ -390,3 +390,11 @@ class BacktesterEngine(BaseEngine): self.thread.start() return True + + def get_all_trades(self): + """""" + return self.backtesting_engine.get_all_trades() + + def get_all_orders(self): + """""" + return self.backtesting_engine.get_all_orders() diff --git a/vnpy/app/cta_strategy/backtesting.py b/vnpy/app/cta_strategy/backtesting.py index 3431a409..852217db 100644 --- a/vnpy/app/cta_strategy/backtesting.py +++ b/vnpy/app/cta_strategy/backtesting.py @@ -1019,6 +1019,18 @@ class BacktestingEngine: """ print(f"{datetime.now()}\t{msg}") + def get_all_trades(self): + """ + Return all trade data of current backtesting result. + """ + return self.trades.values() + + def get_all_orders(self): + """ + Return all limit order data of current backtesting result. + """ + return self.limit_orders.values() + class DailyResult: """"""