At each 15-minute market start, places limit buys for BTC (and optionally ETH, Solana, XRP) Up/Down at a fixed price (default $0.45).
- Node.js >= 18
config.jsonwith Polymarketprivate_key(and optional API creds)
npm install
cp config.json.example config.json # or copy from Rust project
# Edit config.json: set polymarket.private_key (hex, with or without 0x)-
Simulation (default) – no real orders, logs what would be placed:
npm run dev # or npx tsx src/main-dual-limit-045.ts -
Production – place real limit orders:
npx tsx src/main-dual-limit-045.ts --no-simulation
-
Config path:
npx tsx src/main-dual-limit-045.ts -c /path/to/config.json
- Console: colored in development, JSON lines when
NODE_ENV=production. - Levels:
LOG_LEVEL=debug|info|warn|error(defaultinfo). UseLOG_DEBUG=trueto force debug. - File (optional): set
LOG_FILE=true, optionalLOG_FILE_PATH=logs/bot.log,LOG_ROTATION=1H|1D|1W,LOG_MAX_FILES=7. - Slack / Discord / Telegram (optional): set
SLACK_WEBHOOK_URL,DISCORD_WEBHOOK_URL, orTELEGRAM_BOT_TOKEN+TELEGRAM_CHAT_ID. Hook minimum level:MB_LOG_HOOK_LEVEL(defaulterror).
.env is loaded automatically via dotenv. See .env.logging.example.
In code: import log from "./logger.js" then log.info(), log.warn(), log.error(), log.debug(), or import { tag } from "./logger.js" for scoped loggers.
Same shape as the Rust bot:
polymarket.gamma_api_url,polymarket.clob_api_url– API base URLspolymarket.private_key– EOA private key (hex)polymarket.proxy_wallet_address– optional proxy/Magic wallettrading.dual_limit_price– limit price (default 0.45)trading.dual_limit_shares– optional fixed shares per ordertrading.enable_eth_trading,enable_solana_trading,enable_xrp_trading– enable extra markets
src/config.ts– load config, parse CLI argssrc/types.ts– Market, Token, BuyOpportunity, MarketSnapshotsrc/api.ts– Gamma API (market by slug), CLOB order booksrc/clob.ts– CLOB client (ethers + @polymarket/clob-client), place limit ordersrc/monitor.ts– fetch snapshot (prices, time remaining)src/logger.ts– @slackgram/logger setup (env, file, webhooks)src/trader.ts– hasActivePosition, executeLimitBuysrc/main-dual-limit-045.ts– discover markets, monitor loop, place limit orders at period start
npm run build
node dist/main-dual-limit-045.js