-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
139 lines (125 loc) · 7.08 KB
/
Copy path.env.example
File metadata and controls
139 lines (125 loc) · 7.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Polymarket trading wallet (EOA / signature type 0)
# Copy this file to .env and fill in real values. NEVER commit .env.
# Private key of the trading wallet (0x-prefixed, 64 hex chars). KEEP SECRET.
# Only required for LIVE trading; paper mode runs without it.
PRIVATE_KEY=
# Public address derived from PRIVATE_KEY. This is the funder for EOA (type 0).
WALLET_ADDRESS=
# Polymarket endpoints / chain
CLOB_HOST=https://clob.polymarket.com
GAMMA_HOST=https://gamma-api.polymarket.com
DATA_HOST=https://data-api.polymarket.com
CHAIN_ID=137
SIGNATURE_TYPE=0
# Polygon RPC — used for live signing/allowances AND on-chain trade detection.
# A private RPC (free Alchemy/Infura key) is strongly recommended. Provide a
# PRIMARY and one or more BACKUPS for automatic failover (public drpc is always
# appended last). You can also comma-separate multiple URLs in one var.
POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
POLYGON_RPC_URL_FALLBACK=https://polygon-mainnet.infura.io/v3/YOUR_INFURA_KEY
# ── On-chain real-time detection ──────────────────────────────────
# Detects the target's fills from CTF ERC-1155 transfers (~2-3s via WS) instead
# of the ~16-22s lag of the /activity API. Runs alongside the API watcher.
ONCHAIN_DETECT=true
ONCHAIN_POLL_MS=2000
# WebSocket RPCs for push detection (fastest). PRIMARY + BACKUP for failover.
POLYGON_WS_RPC_URL=wss://polygon-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
POLYGON_WS_RPC_URL_FALLBACK=wss://polygon-mainnet.infura.io/v3/YOUR_INFURA_KEY
# ── Mode ──────────────────────────────────────────────────────────
# PAPER_TRADING=true simulates orders (no funds, no signing).
# To go LIVE you must set BOTH switches: PAPER_TRADING=false AND LIVE_ARMED=true.
# Even then the engine runs a funding/allowance preflight and refuses if the
# wallet isn't ready (run `npm run live:check`).
PAPER_TRADING=true
LIVE_ARMED=false
STARTING_BANKROLL=1000
LOG_DIR=logs
# Strategy: copy | hybrid | momentum
# copy — mirror the target's side the instant they trade (recommended)
# hybrid — only mirror when our own spot momentum agrees with them
# momentum — ignore the target; trade purely on our own momentum signal
STRATEGY_MODE=copy
# ── Strategy target (the profitable 15m bot we copy) ──────────────
TARGET_WALLET=0xe2511c9e41c5e762887e538b1d6e7221807aa237
# ── Assets (each is its own 15m Up/Down series + spot feed) ───────
ASSET_BTC=true
ASSET_ETH=true
BTC_SLUG_PREFIX=btc-updown-15m
ETH_SLUG_PREFIX=eth-updown-15m
BTC_WS_URL=wss://stream.binance.com:9443/ws/btcusdt@trade
BTC_REST_URL=https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT
ETH_WS_URL=wss://stream.binance.com:9443/ws/ethusdt@trade
ETH_REST_URL=https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT
# ── Crypto price source ───────────────────────────────────────────
# Polymarket prices crypto Up/Down on CHAINLINK for SHORT windows (5m/15m/4h) and
# on BINANCE for hourly/daily. Binance spot can differ from Chainlink by tens of
# dollars, so for short windows the bot matches Polymarket per-window. Priority for
# a short window: Polymarket candles > Data Streams > on-chain Data Feed > Binance.
# Verify whichever is active with: npm run streams:check
#
# (BEST) Polymarket RTDS WebSocket — NO API KEY, the EXACT live price Polymarket
# shows. Connects to Polymarket's public Real-Time Data Socket
# (wss://ws-live-data.polymarket.com, topic crypto_prices_chainlink) — the same
# live Chainlink feed its own UI uses. One socket streams all symbols
# (BTC/ETH/SOL/XRP/DOGE/…) ~1/sec. Live price matches Polymarket tick-for-tick;
# the window OPEN ("Price to Beat") comes from the Chainlink-candles endpoint
# (also exact). ENABLED by default for 5m/15m/4h. Set POLY_RTDS=false to disable
# (then the bot falls back to the candle+Binance-anchor source below).
POLY_RTDS=true
# POLY_RTDS_SYMBOLS=ada,link # extra base tickers if Polymarket adds them
# POLY_RTDS_URL=wss://ws-live-data.polymarket.com
#
# (FALLBACK) Polymarket Chainlink-candles — used when POLY_RTDS=false. Exact but
# PER-MINUTE: window OPEN is exact; LIVE = Binance anchored to the Chainlink basis.
POLY_PRICE=true
POLY_OFFSET_MS=15000 # how often to refresh the Chainlink↔Binance basis (ms)
# POLY_PRICE_SYMBOLS=xrp,doge # add base tickers beyond the built-in btc,eth,sol
# POLY_PRICE_HOST=https://polymarket.com
#
# (A) On-chain Data Feed — NO API KEY. Reads Chainlink's aggregator over your
# Polygon RPC (same RPC as above). Same oracle family Polymarket resolves on
# (close; ~27s heartbeat, not sub-second). ENABLED by default — set to false
# to force Binance. BTC/ETH addresses are built in; override/add via
# CHAINLINK_FEED_<TICKER> (Polygon mainnet aggregator address).
CHAINLINK_ONCHAIN=true
CHAINLINK_FEED_BTC=
CHAINLINK_FEED_ETH=
CHAINLINK_FEED_SOL=
CHAINLINK_FEED_XRP=
CHAINLINK_FEED_DOGE=
FEED_POLL_MS=4000 # how often to poll the on-chain feed (ms)
#
# (B) Data Streams — EXACT match to Polymarket, but needs credentials you must
# request from Chainlink (https://docs.chain.link/data-streams). When the key
# + secret + a feed ID are set, they take priority over the on-chain feed.
CHAINLINK_STREAMS_HOST=https://api.dataengine.chain.link
CHAINLINK_STREAMS_API_KEY=
CHAINLINK_STREAMS_API_SECRET=
# Per-asset Data Streams feed IDs (0x… , from https://data.chain.link/streams).
CHAINLINK_STREAM_BTC=
CHAINLINK_STREAM_ETH=
CHAINLINK_STREAM_SOL=
CHAINLINK_STREAM_XRP=
CHAINLINK_STREAM_DOGE=
STREAM_POLL_MS=1500 # how often to poll the stream (ms)
# ── Signal tuning (hybrid/momentum modes; also drives the UI readout) ─
SIGNAL_MIN_MOVE_FRACTION=0.0002
REQUIRE_TARGET_AGREEMENT=false
NO_TRADE_TAIL_SECONDS=30
MAX_ENTRY_PRICE=0.95
# ── Sizing ────────────────────────────────────────────────────────
CLIP_SHARES=5 # paper: shares per clip (min order is 5)
CLIP_USD=5 # live: USDC to spend per mirror clip
MAX_CLIPS_PER_WINDOW_PER_SIDE=10
MIN_CLIP_INTERVAL_MS=1500
# ── Risk limits (enforced live; also applied in paper for parity) ─
DAILY_LOSS_LIMIT_USD=25 # halt trading once realized PnL <= -this
MAX_OPEN_USD=100 # halt when open exposure (cost basis) reaches this
MAX_CLIP_USD=10 # hard cap on any single live clip's USDC amount
# ── Polling ───────────────────────────────────────────────────────
POLL_TARGET_TRADES_MS=1200
POLL_MARKET_REFRESH_MS=5000
# ── Dashboard server ──────────────────────────────────────────────
DASHBOARD_ENABLED=true
DASHBOARD_PORT=8787
PRICE_BROADCAST_MS=250