Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Jonmaa/btc-polymarket-bot
/ functions
Functions
46 in github.com/Jonmaa/btc-polymarket-bot
⨍
Functions
46
◇
Types & classes
4
↓ 9 callers
Method
get_order_book
Get order book for a token.
src/simple_arb_bot.py:248
↓ 8 callers
Method
_compute_buy_fill
Compute fill information for buying `target_size` shares using the ask book. Returns: dict with keys: filled, vwap, wors
src/simple_arb_bot.py:210
↓ 8 callers
Method
get_time_remaining
Get remaining time until market closes.
src/simple_arb_bot.py:140
↓ 7 callers
Function
get_client
(settings: Settings)
src/trading.py:24
↓ 4 callers
Function
find_current_btc_15min_market
Find the current active BTC 15min market on Polymarket. Searches for markets matching the pattern 'btc-updown-15m-<timestamp>' and r
src/simple_arb_bot.py:42
↓ 3 callers
Method
__init__
(self, settings)
src/simple_arb_bot.py:85
↓ 3 callers
Function
_coerce_float
(val)
src/trading.py:202
↓ 3 callers
Method
check_arbitrage
Check if an arbitrage opportunity exists. Uses order book (best ask) to get REAL prices we can buy at. Also verifies
src/simple_arb_bot.py:302
↓ 3 callers
Method
execute_arbitrage
Execute arbitrage by buying both sides.
src/simple_arb_bot.py:376
↓ 3 callers
Function
fetch_market_from_slug
(slug: str)
src/lookup.py:15
↓ 3 callers
Method
show_final_summary
Show final summary when market closes.
src/simple_arb_bot.py:620
↓ 2 callers
Method
_book_from_state
(self, bid_levels: list[tuple[float, float]], ask_levels: list[tuple[float, float]])
src/simple_arb_bot.py:823
↓ 2 callers
Method
_levels_to_tuples
Convert OrderSummary-like objects into (price, size) tuples.
src/simple_arb_bot.py:196
↓ 2 callers
Method
get_balance
Get current USDC balance (or simulated balance in dry_run mode).
src/simple_arb_bot.py:156
↓ 2 callers
Method
get_book
(self, asset_id: str)
src/wss_market.py:101
↓ 2 callers
Method
run
Async generator yielding (asset_id, event_type) for each processed message.
src/wss_market.py:104
↓ 2 callers
Method
to_levels
(self)
src/wss_market.py:84
↓ 2 callers
Function
wait_for_terminal_order
Poll order state until it is terminal, filled, or timeout.
src/trading.py:254
↓ 1 callers
Method
_fetch_order_books_parallel
Fetch UP/DOWN order books concurrently to reduce per-scan latency.
src/simple_arb_bot.py:291
↓ 1 callers
Function
_now_s
()
src/wss_market.py:10
↓ 1 callers
Method
apply_price_changes
(self, msg: dict[str, Any])
src/wss_market.py:57
↓ 1 callers
Method
apply_snapshot
(self, msg: dict[str, Any])
src/wss_market.py:21
↓ 1 callers
Function
cancel_orders
(settings: Settings, order_ids: list[str])
src/trading.py:195
↓ 1 callers
Function
extract_order_id
Best-effort extraction of an order id from API responses.
src/trading.py:171
↓ 1 callers
Function
get_balance
Get USDC balance from Polymarket account.
src/trading.py:57
↓ 1 callers
Method
get_current_prices
Get current prices from order book (best ask = lowest price we can BUY at). Using best_ask ensures we get the actual availab
src/simple_arb_bot.py:163
↓ 1 callers
Method
get_market_result
Get which option won the market.
src/simple_arb_bot.py:596
↓ 1 callers
Function
get_order
(settings: Settings, order_id: str)
src/trading.py:190
↓ 1 callers
Function
get_positions
Get current positions (shares owned) for the user. Args: settings: Bot settings token_ids: Optional list of token IDs to
src/trading.py:296
↓ 1 callers
Function
load_settings
()
src/config.py:37
↓ 1 callers
Function
main
()
src/diagnose_config.py:14
↓ 1 callers
Function
main
Main entry point.
src/simple_arb_bot.py:989
↓ 1 callers
Function
main
()
src/test_balance.py:11
↓ 1 callers
Function
main
()
src/generate_api_key.py:6
↓ 1 callers
Method
monitor
Continuously monitor for opportunities.
src/simple_arb_bot.py:754
↓ 1 callers
Method
monitor_wss
Monitor using Polymarket CLOB Market WebSocket instead of polling.
src/simple_arb_bot.py:853
↓ 1 callers
Function
place_order
(settings: Settings, *, side: str, token_id: str, price: float, size: float, tif: str = "GTC")
src/trading.py:82
↓ 1 callers
Function
place_orders_fast
Place multiple orders as fast as possible. Strategy: pre-sign all orders first, then submit them together. This minimizes the time gap betwee
src/trading.py:119
↓ 1 callers
Method
run_once_async
Scan once for opportunities (async; fetches books in parallel).
src/simple_arb_bot.py:709
↓ 1 callers
Method
show_current_positions
Show current share positions for UP and DOWN tokens.
src/simple_arb_bot.py:579
↓ 1 callers
Function
summarize_order_state
Normalize an order payload into a small, stable summary. The API field names vary by version; this function is defensive.
src/trading.py:211
Method
__init__
(self, *, ws_base_url: str, asset_ids: list[str])
src/wss_market.py:96
Method
log_connect_throttled
(msg: str)
src/wss_market.py:110
Function
next_slug
(slug: str)
src/lookup.py:59
Function
parse_iso
(dt: str)
src/lookup.py:68
Method
run_once
Scan once for opportunities.
src/simple_arb_bot.py:664