1
This commit is contained in:
parent
a402007b99
commit
c7e39ec1a4
|
|
@ -128,7 +128,11 @@ async def get_trades(
|
|||
|
||||
trades = Trade.get_all(start_timestamp, end_timestamp, symbol, status, trade_type, exit_reason, account_id=account_id)
|
||||
if not include_sync:
|
||||
trades = [t for t in trades if (t.get("entry_reason") or "") != "sync_recovered"]
|
||||
trades = [
|
||||
t for t in trades
|
||||
if (t.get("entry_reason") or "") != "sync_recovered"
|
||||
and (t.get("exit_reason") or "") != "sync"
|
||||
]
|
||||
logger.info(f"查询到 {len(trades)} 条交易记录(include_sync={include_sync})")
|
||||
|
||||
# 格式化交易记录,添加平仓类型的中文显示
|
||||
|
|
@ -226,7 +230,11 @@ async def get_trade_stats(
|
|||
|
||||
trades = Trade.get_all(start_timestamp, end_timestamp, symbol, None, account_id=account_id)
|
||||
if not include_sync:
|
||||
trades = [t for t in trades if (t.get("entry_reason") or "") != "sync_recovered"]
|
||||
trades = [
|
||||
t for t in trades
|
||||
if (t.get("entry_reason") or "") != "sync_recovered"
|
||||
and (t.get("exit_reason") or "") != "sync"
|
||||
]
|
||||
closed_trades = [t for t in trades if t['status'] == 'closed']
|
||||
|
||||
# 辅助函数:计算净盈亏(优先使用 realized_pnl - commission)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user