-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.env.example
More file actions
310 lines (268 loc) · 11.1 KB
/
.env.example
File metadata and controls
310 lines (268 loc) · 11.1 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# Copy this file to .env and fill in values.
# Never commit real secrets (private keys, API keys, SSH passwords).
########################
# VPS / deploy settings #
########################
# These are used by `scripts/deploy_ssh.sh` and `scripts/restart_services.sh`.
# They are NOT read by the Go binaries themselves.
# Required: SSH login for your VPS (user@host).
SSH_SERVER=ubuntu@your-vps-ip
# Optional: SSH port.
SSH_PORT=22
# Choose ONE auth method:
# - SSH_KEY_PATH is recommended (more secure + non-interactive)
# - SSH_PASSWORD is supported for convenience (stored in plaintext in .env: be careful)
# SSH_PASSWORD=your-ssh-password
SSH_KEY_PATH=~/.ssh/id_ed25519
# If your SSH user is not root, the deploy script uses `sudo -n` for systemd + /opt + /etc writes.
# Most VPS images ship with passwordless sudo for the default user; otherwise configure sudoers.
SSH_USE_SUDO=1
# Remote install location for the binary + .env (default: /opt/poly-gocopy).
# The deploy script will upload to this directory and create a systemd unit that runs it.
DEPLOY_REMOTE_DIR=/opt/poly-gocopy
# Optional: override systemd unit name for a single deploy_ssh.sh invocation.
# Default is `poly-gocopy-<command>` (e.g. poly-gocopy-arbitrage).
# DEPLOY_SERVICE_NAME=poly-gocopy-arbitrage
# Optional: service names used by restart_services.sh.
ARBITRAGE_SERVICE=poly-gocopy-arbitrage
ARBITRAGE_EQUAL_SERVICE=poly-gocopy-arbitrage-equal
ARBITRAGE_WEIGHTED_SERVICE=poly-gocopy-arbitrage-weighted
# Optional: default args used by restart_services.sh --deploy.
# If empty, the script tries to read the current ExecStart args from the remote unit.
ARBITRAGE_DEPLOY_ARGS=--cap-a=50 --cap-b=50
ARBITRAGE_EQUAL_DEPLOY_ARGS=--event-slug=btc-updown-15m --cap-a=50 --cap-b=50
ARBITRAGE_WEIGHTED_DEPLOY_ARGS=--event-slug=btc-updown-15m --cap-a=50 --cap-b=50
##################
# Runtime config #
##################
# These are read by the Go binaries at runtime.
# The Go programs load `.env` automatically at startup (see dotenv.Load()).
# Enable live trading (default is dry-run).
# Set to true to actually place orders; false or unset for dry-run mode.
# ENABLE_TRADING=true
########################
# Polygon RPC endpoints #
########################
# Polygon RPC WebSocket endpoint (wss://...) used for subscriptions (required for
# benchmark live subscriptions).
RPC_WS_URL=wss://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
# Optional fallbacks (some commands also accept these):
# RPC_URL can be http(s) (useful for one-off queries / --tx-hash inspection).
# POLYGON_WS_URL is an alternate name for RPC_WS_URL.
# RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
# POLYGON_WS_URL=wss://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
#########################
# Polymarket CLOB config #
#########################
# Base URL for the Polymarket CLOB API.
# Default is https://clob.polymarket.com
CLOB_URL=https://clob.polymarket.com
# Trading wallet settings:
#
# PRIVATE_KEY / CLOB_PRIVATE_KEY:
# - Required for live trading (all strategies).
# - Optional for arbitrage dry-run (it will generate an ephemeral key).
# PRIVATE_KEY=0xYOUR_PRIVATE_KEY
# CLOB_PRIVATE_KEY=0xYOUR_PRIVATE_KEY # alias for PRIVATE_KEY
#
# FUNDER / CLOB_FUNDER:
# The wallet address that actually holds USDC / positions (often your proxy/safe).
# FUNDER=0xYOUR_FUNDING_WALLET
# CLOB_FUNDER=0xYOUR_FUNDING_WALLET # alias for FUNDER
#
# Signature type for your Polymarket wallet:
# 0=EOA, 1=POLY_PROXY, 2=POLY_GNOSIS_SAFE
# CLOB_SIGNATURE_TYPE=2
#
# Optional: set explicit API creds. If omitted and live trading is enabled,
# the bot will derive/create API creds using your PRIVATE_KEY.
# CLOB_API_KEY=...
# CLOB_SECRET=...
# CLOB_PASSPHRASE=...
TRADES_OUT_FILE=./out/trades.jsonl # shared fallback used by multiple CLIs
############################
# Deprecated copytrade keys #
############################
# Copytrade is deprecated and no longer supported. These are kept for reference only.
# LEADER_PROXY=0xYOUR_LEADER_PROXY
# LEADER_PROXIES=0xLEADER_A,0xLEADER_B
# COPY_PCT=25
# COPY_BPS=2500
# COPYTRADE_OUT_FILE=./out/copytrade_trades.jsonl
###################
# Claim settings #
###################
# Polymarket Data API (for redeemable positions).
# Default: https://data-api.polymarket.com
DATA_API_URL=https://data-api.polymarket.com
# Run claim loop every interval (empty = run once and exit).
# CLAIM_EVERY=30m
# Minimum position size to consider redeemable (Data API sizeThreshold).
# Set to 0 to include dust.
CLAIM_SIZE_THRESHOLD=0
# Max positions per page (Data API limit; max 500).
CLAIM_LIMIT=500
# Actually submit claim transactions (default false).
# ENABLE_CLAIMS=true
##############################
# Relayer (proxy/safe wallet) #
##############################
# Polymarket relayer endpoint (gasless txs for proxy/safe wallets).
# Default: https://relayer-v2.polymarket.com
# RELAYER_URL=https://relayer-v2.polymarket.com
# Chain ID for relayer transactions (Polygon mainnet = 137, Amoy = 80002).
# RELAYER_CHAIN_ID=137
# Relayer wallet type (SAFE only for scripts/claim_relayer.py; JS relayer client is
# required for Magic/email proxy wallets).
# RELAYER_TX_TYPE=SAFE
# Only needed for first-time Safe wallets.
# RELAYER_DEPLOY_SAFE=false
# Builder relayer credentials (from your Polymarket Builder Profile).
# POLY_BUILDER_API_KEY=...
# POLY_BUILDER_SECRET=...
# POLY_BUILDER_PASSPHRASE=...
# Optional: remote signing server instead of local builder creds.
# BUILDER_SIGNING_URL=https://your-builder-signing-host/sign
# BUILDER_SIGNING_TOKEN=...
# Optional: override on-chain contract addresses (defaults to Polymarket mainnet).
# COLLATERAL_TOKEN=0x...
# CTF_ADDRESS=0x...
#####################
# Arbitrage settings #
#####################
# Arbitrage market selection (choose one mode):
# - token mode: set TOKEN_A and TOKEN_B directly
# - slug mode: set EVENT_SLUG (or EVENT_SLUGS / EVENT_SLUGS_FILE) and the bot will
# resolve token IDs via the Gamma API and auto-switch each rolling window.
# TOKEN_A=123456
# TOKEN_B=789012
# EVENT_SLUG=btc-updown-15m
# EVENT_SLUGS=btc-updown-15m,eth-updown-15m
# EVENT_SLUGS_FILE=/opt/poly-gocopy/slugs.txt
#
# Default: start trading the NEXT rolling window in the last portion of the
# current window (keeps both sessions running so the current window can still
# exit/sell while you begin entering the next window).
# Example: start looking at the next window when there is <= 3 minutes left.
# ARBITRAGE_NEXT_SLUG_LAST=3m
#
# Optional: Gamma API base URL and timezone used to compute rolling windows.
GAMMA_URL=https://gamma-api.polymarket.com
EVENT_TZ=America/New_York
#
# Output file (JSONL):
ARBITRAGE_OUT_FILE=./out/arbitrage_trades.jsonl
#
# Range strategy: wait after window open and only buy inside bands.
# ARBITRAGE_START_DELAY=2m
# Total per-entry USD budget (split 2/3 win, 1/3 lose).
# ARBITRAGE_RANGE_ENTRY_USD=3
# Range stop-loss/add (after delay, if position not in profit).
# ARBITRAGE_RANGE_STOP_LOSS_AFTER=30s
# ARBITRAGE_RANGE_STOP_LOSS_BUDGET=10 # per side
# ARBITRAGE_RANGE_STOP_LOSS_MAX_PRICE=0.96
# ARBITRAGE_STOP_LOSS_MARKET=true
# Range profit target (percent or bps; default 3%).
# ARBITRAGE_RANGE_PROFIT_TARGET=3%
# ARBITRAGE_WIN_MIN=0.52
# ARBITRAGE_WIN_MAX=0.85
# ARBITRAGE_LOSE_MIN=0.15
# ARBITRAGE_LOSE_MAX=0.46
#
# Equal-shares strategy (cmd/arbitrage-equal): wait after window open and buy equal shares.
# This strategy holds until resolution (no stop-loss adds or profit sells).
# ARBITRAGE_EQUAL_START_DELAY=2m
# Per-side assigned budget (total budget is 2x).
# ARBITRAGE_EQUAL_ASSIGNED_USD=20
# Target average per side (defaults to ARBITRAGE_EQUAL_SUM_MAX / 2).
# ARBITRAGE_EQUAL_TARGET_AVG=0.485
# Sum cap (YES_avg + NO_avg must be <= this by completion).
# ARBITRAGE_EQUAL_SUM_MAX=0.97
# ARBITRAGE_EQUAL_SUM_ABORT=0.97
#
# Weighted-average strategy (cmd/arbitrage-weighted): match depth using a total budget.
# ARBITRAGE_WEIGHTED_TOTAL_USD=40
# Entry size as a fraction of remaining budget (0.10 = 10%; also accepts 10%).
# ARBITRAGE_WEIGHTED_ENTRY_PCT=0.10
# Max combined average (A_avg + B_avg must be <= this).
# ARBITRAGE_WEIGHTED_SUM_MAX=0.97
# Decision loop interval (default 1s).
# ARBITRAGE_WEIGHTED_LOOP_INTERVAL=1s
# Delay after window start before placing weighted buys.
# ARBITRAGE_WEIGHTED_START_DELAY=30s
# Weighted Side A price band (inclusive).
# ARBITRAGE_WEIGHTED_A_MIN=0.52
# ARBITRAGE_WEIGHTED_A_MAX=0.90
# Weighted Side B price band (inclusive).
# ARBITRAGE_WEIGHTED_B_MIN=0.01
# ARBITRAGE_WEIGHTED_B_MAX=0.46
# Optional: run relayer claim script periodically while weighted bot runs.
# Defaults: ENABLE=true, EVERY=5m, CMD="uv run scripts/claim_relayer.py".
# Command is split on spaces (no shell quoting).
# ARBITRAGE_WEIGHTED_CLAIM_ENABLE=false
# ARBITRAGE_WEIGHTED_CLAIM_EVERY=5m
# ARBITRAGE_WEIGHTED_CLAIM_CMD=uv run scripts/claim_relayer.py
# Per-side dollar caps (two independent budgets, one per outcome token).
# Defaults to 50 each if unset.
# ARBITRAGE_CAP_A=50
# ARBITRAGE_CAP_B=50
#
# Per-trade clip sizing (use small orders regardless of total caps).
# ARBITRAGE_BUY_USD_MIN defaults to 1 if unset.
# ARBITRAGE_BUY_USD_MAX defaults to 1 if unset.
ARBITRAGE_BUY_USD_MIN=1
ARBITRAGE_BUY_USD_MAX=1
#
# Optional: automatically set caps from on-chain USDC balance (split 50/50).
# Ignored in range-only mode (range uses a 2/3 vs 1/3 per-entry split).
# - Requires RPC_WS_URL or RPC_URL (Polygon mainnet).
# - Requires FUNDER/CLOB_FUNDER (or PRIVATE_KEY to infer signer wallet).
# - If you enable this, don't also pass --cap-a/--cap-b (flags override env).
# ARBITRAGE_CAP_SPLIT_BALANCE=true
#
# Optional: cooldown after CLOB returns "not enough balance / allowance" on a buy.
# This prevents repeated failed submissions and log spam while you
# top up USDC or fix approvals.
# - Set to 0 to disable the cooldown.
# ARBITRAGE_BALANCE_ALLOWANCE_COOLDOWN=30s
# Arbitrage sell / exit logic (default):
# The bot periodically computes mark-to-market unrealized PnL (liquidation value
# using current bids) and sells BOTH sides once your profit threshold is met.
#
# Sell logic is always enabled. Configure cadence below.
# Minimum time between sell evaluations (throttles how often we check unrealized PnL).
# Good defaults are 5s–15s. Set to 0 to only evaluate on RTDS updates / poll loop ticks.
SELL_EVERY=5s
#
# Range mode uses ARBITRAGE_RANGE_PROFIT_TARGET (default 3%) and ignores last-window logic.
# Legacy last-window knobs (ignored in range-only mode):
# SELL_MIN_PROFIT_EARLY=3
# SELL_LAST=3m
# SELL_MIN_PROFIT_LATE=1
# SELL_FORCE_LAST=1m
# SELL_DISABLE_BUYS_IN_LAST=true
#
# Order type used for BUYs:
# - FOK = fill-or-kill
# - FAK = fill-and-kill (default)
BUY_ORDER_TYPE=FAK
#
# Order type used for SELLs:
# - FOK = fill-or-kill
# - FAK = fill-and-kill (default)
SELL_ORDER_TYPE=FAK
# Optional: extra sell slippage buffer in bps (0 = disabled).
# ARBITRAGE_SELL_SLIPPAGE_BPS=25
###################
# Latency settings #
###################
# Used by `cmd/latency` (and also `cmd/benchmark` uses LATENCY_OUT_FILE as its --out default).
# LATENCY_LABEL=vpn-nyc
# LATENCY_OUT_FILE=./out/clob_rtds_latency.jsonl
#
# If set, `cmd/latency` will also probe `GET /book?token_id=...`:
# CLOB_TOKEN_ID=123456
#
# RTDS feed settings for `cmd/latency`:
RTDS_URL=wss://ws-live-data.polymarket.com
# RTDS_FILTERS=123456,789012