[Add] function for get backtesting trade/order data
This commit is contained in:
parent
3ecd3f7e9f
commit
6c24d46d6a
@ -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()
|
||||
|
@ -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:
|
||||
""""""
|
||||
|
Loading…
Reference in New Issue
Block a user