[Add] function for get backtesting trade/order data

This commit is contained in:
vn.py 2019-05-30 12:30:22 +08:00
parent 3ecd3f7e9f
commit 6c24d46d6a
2 changed files with 21 additions and 1 deletions

View File

@ -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()

View File

@ -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:
""""""