同步回测与tqsdk

This commit is contained in:
2025-07-01 10:14:28 +08:00
parent 70c3b8186a
commit 4c243a4b47
7 changed files with 27641 additions and 25887 deletions

View File

@@ -330,6 +330,8 @@ class SimpleLimitBuyStrategyShort(Strategy):
# 只有当有持仓时才考虑平仓
if current_pos_volume < 0: # 假设只做多,所以持仓量 > 0
avg_entry_price = self.get_average_position_price(self.symbol)
self.log(f'avg_entry_price {avg_entry_price}, bar.open {bar.open}')
if avg_entry_price is not None:
pnl_per_unit = (
avg_entry_price - bar.open