Skip to content

feat: add orderbook command, Polymarket withdraw/balance#7

Merged
juntao merged 2 commits intomainfrom
feat/orderbook-polymarket-withdraw
Mar 8, 2026
Merged

feat: add orderbook command, Polymarket withdraw/balance#7
juntao merged 2 commits intomainfrom
feat/orderbook-polymarket-withdraw

Conversation

@juntao
Copy link
Copy Markdown
Member

@juntao juntao commented Mar 8, 2026

Summary

  • Orderbook command: Add fintool orderbook <SYMBOL> (spot) and fintool perp orderbook <SYMBOL> with support for Hyperliquid, Binance, and Coinbase. Includes spread/mid-price calculation, human-readable and JSON output modes.
  • Polymarket withdraw: Add fintool withdraw USDC --amount N --to base --exchange polymarket using the Polymarket bridge SDK. Supports Base, Ethereum, and Arbitrum destinations. JSON mode included.
  • Polymarket balance: Add fintool balance --exchange polymarket to query USDC balance via the CLOB API.
  • JSON dispatch fix: The withdraw JSON command now passes the exchange parameter (was hardcoded to "auto").
  • Example bots: Refactored funding_arb/bot.py to use fintool for all data (removed direct HL API calls), added orderbook spread/depth analysis. Both bots now require API keys as in-file constants.
  • Docs: Added orderbook command to README.md (TOC, Quick Guides, Exchange Matrix, full command docs) and skills/SKILL.md.
  • Tests: Added tests/polymarket/withdraw.sh and a Step 7 (withdraw entire balance to Base) in tests/polymarket/predict_btc.sh.

Test plan

  • cargo build compiles cleanly
  • fintool orderbook HYPE — spot orderbook from Hyperliquid
  • fintool perp orderbook BTC — perp orderbook from Hyperliquid
  • fintool orderbook ETH --levels 10 — custom depth
  • fintool --json '{"command":"orderbook","symbol":"HYPE"}' — JSON mode
  • fintool withdraw USDC --amount 10 --to base --exchange polymarket — Polymarket withdraw
  • fintool --json '{"command":"withdraw","asset":"USDC","amount":10,"to":"base","exchange":"polymarket"}' — JSON withdraw
  • fintool --json '{"command":"balance","exchange":"polymarket"}' — Polymarket balance
  • ./tests/polymarket/withdraw.sh — withdraw test script
  • ./tests/polymarket/predict_btc.sh — full e2e with withdraw step

🤖 Generated with Claude Code

juntao and others added 2 commits March 8, 2026 05:47
…ple bots

- Add `fintool orderbook <SYMBOL>` (spot) and `fintool perp orderbook <SYMBOL>`
  with support for Hyperliquid, Binance, and Coinbase exchanges
- Add Polymarket withdraw support via bridge API (`--exchange polymarket`)
- Add Polymarket USDC balance query (`balance --exchange polymarket`)
- Fix JSON dispatch to pass `exchange` param for withdraw command
- Update example bots: use fintool for all data (no direct HL API calls),
  require API keys as in-file constants
- Add orderbook docs to README.md and skills/SKILL.md
- Add tests/polymarket/withdraw.sh and withdraw step to predict_btc.sh

Signed-off-by: Michael Yuan <michael@secondstate.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Michael Yuan <michael@secondstate.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@juntao juntao merged commit 03d90ea into main Mar 8, 2026
2 checks passed
@juntao juntao deleted the feat/orderbook-polymarket-withdraw branch March 8, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant