feat: split audit logs into live/dryrun subdirs, add catlog --dry-run, list all kline intervals
- Write live trades to logs/live/ and dry-run trades to logs/dryrun/ - Add -d/--dry-run flag to catlog to read dry-run audit logs - List all 16 Binance kline interval options in --help and docs Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ def execute_spot_trade(
|
||||
dry_run=is_dry_run,
|
||||
)
|
||||
|
||||
audit_event("trade_submitted", _trade_log_payload(intent, payload, status="submitted"))
|
||||
audit_event("trade_submitted", _trade_log_payload(intent, payload, status="submitted"), dry_run=intent.dry_run)
|
||||
if is_dry_run:
|
||||
response = {"dry_run": True, "status": "DRY_RUN", "request": payload}
|
||||
result = asdict(
|
||||
@@ -128,14 +128,14 @@ def execute_spot_trade(
|
||||
)
|
||||
)
|
||||
audit_event(
|
||||
"trade_filled", {**_trade_log_payload(intent, payload, status="DRY_RUN"), "response_payload": response}
|
||||
"trade_filled", {**_trade_log_payload(intent, payload, status="DRY_RUN"), "response_payload": response}, dry_run=intent.dry_run
|
||||
)
|
||||
return {"trade": result}
|
||||
|
||||
try:
|
||||
response = spot_client.new_order(**payload)
|
||||
except Exception as exc:
|
||||
audit_event("trade_failed", _trade_log_payload(intent, payload, status="failed", error=str(exc)))
|
||||
audit_event("trade_failed", _trade_log_payload(intent, payload, status="failed", error=str(exc)), dry_run=intent.dry_run)
|
||||
raise RuntimeError(f"Spot order failed: {exc}") from exc
|
||||
|
||||
result = asdict(
|
||||
@@ -151,6 +151,7 @@ def execute_spot_trade(
|
||||
)
|
||||
)
|
||||
audit_event(
|
||||
"trade_filled", {**_trade_log_payload(intent, payload, status=result["status"]), "response_payload": response}
|
||||
"trade_filled", {**_trade_log_payload(intent, payload, status=result["status"]), "response_payload": response},
|
||||
dry_run=intent.dry_run,
|
||||
)
|
||||
return {"trade": result}
|
||||
|
||||
Reference in New Issue
Block a user