Mirror option expiry settlements from exchange bills; debit OO LIVE open premiums.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 16:02:16 +08:00
parent 8d67f3fc6c
commit 3491681c28
10 changed files with 739 additions and 54 deletions
+27
View File
@@ -506,6 +506,33 @@ class BinanceTradeClient:
{"symbol": symbol, "leverage": lev},
)
def get_option_exercise_records(
self, symbol: str, *, begin_ms: int, end_ms: int | None = None
) -> list[dict] | None:
"""用户期权行权/到期结算记录 GET /eapi/v1/exerciseRecord。"""
end = int(end_ms or int(time.time() * 1000))
begin = int(begin_ms)
try:
rows = self._signed(
self._eapi,
"GET",
"/eapi/v1/exerciseRecord",
{
"symbol": symbol,
"startTime": begin,
"endTime": end,
"limit": 100,
},
)
except Exception as e:
logger.warning("binance exerciseRecord failed: %s", e)
return None
if isinstance(rows, dict):
rows = [rows]
if not isinstance(rows, list):
return []
return [r for r in rows if isinstance(r, dict)]
def get_funding_usdt(
self, symbol: str, *, begin_ms: int, end_ms: int | None = None
) -> float: