eth-robust-twap-live-plan.json 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {
  2. "strategy": {
  3. "name": "ETH Robust Price TWAP 15m",
  4. "symbol": "ETH-USDT-SWAP",
  5. "bar": "15m",
  6. "side": "long_only",
  7. "leverage": 3,
  8. "trend_sma": 60,
  9. "rsi_length": 2,
  10. "rsi_threshold": 3.0,
  11. "exit_rsi": 50.0,
  12. "stop_loss_pct": 0.012,
  13. "max_hold_bars": 48,
  14. "entry_offsets": [0.003, 0.006, 0.009],
  15. "entry_valid_bars": 4,
  16. "fill_buffer": 0.0,
  17. "selected_reason": "eth-twap-robustness-10y-summary.md recommends r3x50 because it stayed positive across tested cost models and rolling 1y windows."
  18. },
  19. "source_read": [
  20. "okx_codex_trader/okx_client.py",
  21. "okx_codex_trader/cli.py",
  22. "okx_codex_trader/paper_engine.py",
  23. "freqtrade/README.md",
  24. "freqtrade/user_data/strategies/BtcRsi2Guarded.py",
  25. "scripts/search_eth_price_twap_variants.py",
  26. "scripts/search_eth_twap_robustness_10y.py",
  27. "scripts/explore_ultrashort.py",
  28. "reports/eth-exploration/eth-twap-robustness-10y-summary.md",
  29. "reports/eth-exploration/README.md"
  30. ],
  31. "signal_clock": {
  32. "compute_at": "Every 15m candle boundary after the just-closed candle can be fetched from OKX history-candles with confirm flag 1.",
  33. "decision_candle": "The latest confirmed 15m candle only.",
  34. "order_start": "The next 15m candle after the decision candle.",
  35. "unconfirmed_candle_rule": "Do not use ticker, current market candle, or a history-candles row whose confirm flag is not 1 for indicators."
  36. },
  37. "entry_orders": {
  38. "type": "three post_only isolated long limit orders",
  39. "base_price": "decision_candle.close",
  40. "prices": [
  41. "close * (1 - 0.003)",
  42. "close * (1 - 0.006)",
  43. "close * (1 - 0.009)"
  44. ],
  45. "size": "planned_margin_usdt / 3 per level, converted with build_contract_size(slice_margin * 3, limit_price, instrument_meta)",
  46. "validity": "valid through four full 15m bars after the decision candle",
  47. "cancel_rule": "Cancel all unfilled entry levels when validity ends, when an exit signal appears, when stop is hit, or when any tracked position closes."
  48. },
  49. "partial_fills": {
  50. "avg_entry_price": "sum(fill_price * fill_contracts * ct_val) / sum(fill_contracts * ct_val)",
  51. "margin_used": "sum(fill_notional_usdt) / leverage",
  52. "stop_price": "avg_entry_price * (1 - 0.012)",
  53. "position_start_time": "first fill timestamp",
  54. "entry_index": "15m bar index containing the first fill"
  55. },
  56. "exit_and_stop": {
  57. "signal_exit": "When confirmed candle RSI2 >= 50.0 or held bars >= 48, cancel remaining entry orders and close tracked long position.",
  58. "stop_exit": "If last/mark price reaches stop_price before signal exit, close tracked long position immediately.",
  59. "maker_taker_assumption": "Entry is maker only because post_only is required. Signal exit and stop are taker for the live design because execution priority is flat exposure, matching maker_taker cost accounting.",
  60. "exit_order_type": "reduce_only market close for signal exit and stop during real-funds test; later maker exit is a separate design."
  61. },
  62. "state_file": {
  63. "identity": ["strategy_id", "symbol", "bar", "td_mode", "pos_side", "leverage"],
  64. "signal": ["last_confirmed_candle_ts", "last_signal_candle_ts", "indicator_values", "decision"],
  65. "orders": ["client_order_id", "okx_order_id", "level", "price", "requested_size", "filled_size", "state", "created_at", "expires_at"],
  66. "position": ["filled_contracts", "filled_notional_usdt", "avg_entry_price", "margin_used", "stop_price", "first_fill_ts", "entry_candle_ts"],
  67. "risk": ["planned_margin_usdt", "max_margin_usdt", "isolation_tag"],
  68. "audit": ["updated_at", "events"]
  69. },
  70. "minimum_real_funds_test": {
  71. "account_mode": "OKX isolated hedge mode, ETH-USDT-SWAP long side only.",
  72. "isolation": "Use a dedicated OKX subaccount or demo first. If using the current account, require no existing ETH-USDT-SWAP long position before the test and tag all orders with a deterministic client order id prefix.",
  73. "funding": "Use the minimum margin that satisfies OKX minSz after contract conversion for all three slices.",
  74. "dry_run": "Run signal and order-intent generation for at least one full signal without submitting orders.",
  75. "live_probe": "Submit one full three-level cycle with tiny margin, wait four bars, verify fills/cancels, then force a manual flat check with okx-account."
  76. },
  77. "minimal_implementation_path": [
  78. "Add a read-only signal command that emits the next-cycle entry plan from confirmed candles.",
  79. "Add an order-intent command that converts the signal plan into three post_only order payloads without submitting.",
  80. "Add a state-backed quasi-live runner that can submit/cancel/query orders only after explicit live confirmation.",
  81. "Add tests with a fake OKX session for candle confirmation, order price/size, partial fill averaging, stop price, expiry, and state persistence.",
  82. "Keep freqtrade as comparison only; do not implement this live runner inside freqtrade."
  83. ]
  84. }