Align hedge plan option leg PnL with OKX exchange history.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -566,12 +566,16 @@ def ensure_local_review_synced(
|
||||
if backfill_exchange_pnl and ex is not None:
|
||||
try:
|
||||
from lib.exchange.okx_options_lib import fetch_all_option_positions_history
|
||||
from lib.hedge_plan.hedge_plan_settle_lib import (
|
||||
backfill_hedge_option_legs_realized_pnl,
|
||||
)
|
||||
from lib.options.options_monitor_lib import (
|
||||
backfill_closed_options_realized_pnl_from_history,
|
||||
)
|
||||
|
||||
hist = fetch_all_option_positions_history(ex, limit=200)
|
||||
backfill_closed_options_realized_pnl_from_history(conn, hist)
|
||||
backfill_hedge_option_legs_realized_pnl(conn, hist)
|
||||
except Exception:
|
||||
pass
|
||||
return sync_all_review_sources(conn, from_exchange=False)
|
||||
|
||||
Reference in New Issue
Block a user