MCPcopy Create free account

hub / github.com/ConteurShadow/Polymarket-Trading-Bot-Rust / functions

Functions284 in github.com/ConteurShadow/Polymarket-Trading-Bot-Rust

↓ 37 callersFunctionpaint
(plain: &str, f: F)
src/term_ui.rs:77
↓ 36 callersMethodlog_to_file
Log to simulation file (and optionally to market-specific file)
src/simulation.rs:107
↓ 25 callersFunctionlog_trading_event
(event: &str)
src/lib.rs:45
↓ 21 callersMethodcheck_balance_only
Check token balance only (for redemption/portfolio scanning) via clob_sdk.
src/api.rs:1063
↓ 21 callersMethodget_market
Get market details by condition ID
src/api.rs:618
↓ 20 callersFunctioncopy_rust_to_c
(s: &str)
src/clob_sdk.rs:217
↓ 19 callersMethodcheck_balance_allowance
Check token balance and allowance before selling (via clob_sdk).
src/api.rs:1070
↓ 18 callersMethodplace_order
Place an order using clob_sdk (post_limit_order). Equivalent to JavaScript: client.createAndPostOrder(userOrder)
src/api.rs:707
↓ 16 callersMethodget_pending_limit_trade
Get a pending limit trade (keyed by `"{period}_{token_id}_limit"`)
src/trader.rs:261
↓ 15 callersMethoddisplay_name
(&self)
src/detector.rs:70
↓ 15 callersMethodflush
(&mut self)
src/bin/main_dual_limit_045_5m_btc.rs:48
↓ 14 callersMethodexecute_buy
Execute buy when momentum opportunity is detected Buys any token (BTC Up/Down, ETH Up/Down) when price reaches trigger_price after 10 minutes
src/trader.rs:491
↓ 13 callersFunctionuse_color
()
src/term_ui.rs:43
↓ 12 callersMethodupdate_balance_allowance_for_sell
Refresh cached allowance for outcome token before selling (via clob_sdk).
src/api.rs:1091
↓ 10 callersMethodcancel_pending_limit_buy
Cancel a pending LIMIT BUY order for the given token/period and remove it from tracking
src/trader.rs:322
↓ 10 callersMethodget_market_by_slug
Get market by slug (e.g., "btc-updown-15m-1767726000") The API returns an event object with a markets array
src/api.rs:568
↓ 10 callersFunctionload_lib
()
src/clob_sdk.rs:106
↓ 10 callersFunctionpolygon
Polygon chain ID from clob_sdk (137).
src/api.rs:62
↓ 9 callersMethodensure_clob_client
Ensure CLOB client is created and return handle. Call after authenticate() or when placing orders/checking balance.
src/api.rs:315
↓ 9 callersFunctionmerge_up_down_amounts
Compute how many complete sets (Up + Down pairs) can be formed, and the remainders. - `complete_sets = min(up_amount, down_amount)` - `remaining_up =
src/merge.rs:28
↓ 8 callersMethodcheck_token
Check a single token for opportunity
src/detector.rs:115
↓ 8 callersMethodis_simulation
Get the effective simulation mode If --no-simulation is used, forces production If --backtest is used, it overrides everything
src/config.rs:37
↓ 8 callersMethodlog_trend_analysis
Log trend analysis for a token (useful for debugging)
src/simulation.rs:323
↓ 8 callersMethodmark_limit_trade_filled_by_hedge
attribute the balance increase to a "limit fill" and log "LIMIT BUY ORDER FILLED" again. Uses max(current_balance, existing t.units) for units so a st
src/trader.rs:371
↓ 8 callersFunctionprint_outcome_token_id
One outcome token (📈 UP / 📉 DOWN) for CLOB order books.
src/term_ui.rs:305
↓ 8 callersMethodtrack_price
Track price for trend analysis Call this whenever you receive new price data
src/simulation.rs:263
↓ 6 callersMethodauthenticate
Authenticate with signature and get JWT token Note: You'll need to sign the message with your private key
src/bin/test_predict_fun.rs:120
↓ 6 callersMethoddiscover_current_market
Discover current BTC or ETH 15-minute market Similar to main bot's discover_market function
src/api.rs:784
↓ 6 callersFunctiondiscover_market
( api: &PolymarketApi, market_name: &str, slug_prefixes: &[&str], current_time: u64, seen_
src/bin/main_dual_limit_045_same_size.rs:2979
↓ 6 callersMethodplace_market_order
Place a market order (FOK/FAK) for immediate execution This is used for emergency selling or when you want immediate execution at market price. Equiv
src/api.rs:1597
↓ 5 callersMethodexecute_sell
Execute sell order with configurable order type order_type: None or "FAK" for Fill-and-Kill (allows partial fills), "FOK" for Fill-or-Kill Default: FA
src/trader.rs:3039
↓ 5 callersMethodget_best_price
Get best bid/ask prices for a token (from orderbook)
src/api.rs:688
↓ 5 callersMethodget_market_file
Get or create a market-specific log file Skips dummy markets - they should only log to simulation.toml
src/simulation.rs:77
↓ 5 callersMethodget_price
Get price for a token (for trading) side: "BUY" or "SELL"
src/api.rs:648
↓ 5 callersMethodget_simulation_tracker
(&self)
src/trader.rs:29
↓ 5 callersMethodget_token_balance_shares
After a market-order hedge for the unfilled side, mark the pending _limit trade for that token as filled (confirmed_balance + buy_order_confirmed) so
src/trader.rs:358
↓ 4 callersMethodcheck_is_approved_for_all
Check if setApprovalForAll was already set for the Exchange contract
src/api.rs:1097
↓ 4 callersFunctioncontract_config
Get contract config from the loaded SDK .so. Same as SDK's contract_config(chain_id, is_neg_risk).
src/clob_sdk.rs:155
↓ 4 callersFunctiondiscover_market
( api: &PolymarketApi, _market_name: &str, slug_prefixes: &[&str], current_time: u64, seen
src/bin/main_trailing.rs:814
↓ 4 callersMethodflush
(&mut self)
src/bin/main_dual_limit_045_same_size.rs:84
↓ 4 callersMethodget_current_condition_ids
Get current market condition IDs (for checking if markets are closed)
src/monitor.rs:191
↓ 4 callersMethodget_or_create_api_credentials
(&self)
src/api.rs:282
↓ 4 callersMethodget_pending_limit_trade_by_market
Get a pending limit trade by market (period, condition_id, token_type). Use this when the current snapshot's token_id might differ from the token_id u
src/trader.rs:269
↓ 4 callersMethodget_pending_trade_for_period_token
Get a pending trade for (period, token_id) from any key: _limit, _individual_hedge, or _standard_hedge. Used by dual-limit same-size low-price exit to
src/trader.rs:310
↓ 4 callersMethodget_portfolio_tokens_all
Get all tokens in portfolio with balance > 0 Get all tokens in portfolio with balance > 0, checking recent markets (not just current) Uses REDEEM_SCAN
src/api.rs:822
↓ 4 callersFunctionlog_to_history
Logging functions - modules will use these
src/lib.rs:31
↓ 4 callersMethodlog_to_market
Log to both main file and market-specific file For dummy markets, only logs to simulation.toml (no separate market file)
src/simulation.rs:118
↓ 4 callersFunctionmaybe_hedge_pair
( trader: &Trader, condition_id: &str, up: &Option
src/bin/main_dual_limit_045_same_size.rs:2120
↓ 4 callersFunctionprint_discover_section_start
One line for `log_to_history` / stderr (ANSI stripped for files).
src/term_ui.rs:192
↓ 4 callersFunctionpush_lib_pair
(out: &mut Vec<String>, name: &str)
src/clob_sdk.rs:49
↓ 4 callersFunctionread_string_from_ffi
( lib: &Library, fn_name: &[u8], chain_id: u64, neg_risk: bool, )
src/clob_sdk.rs:135
↓ 4 callersMethodsigner_address
(&self)
src/api.rs:168
↓ 4 callersFunctiontoken_type_for
(market_name: &str, is_up: bool)
src/bin/main_trailing.rs:149
↓ 4 callersFunctiontrailing_window_label
Returns human-readable time-window label for trailing-stop logs.
src/bin/main_trailing.rs:90
↓ 4 callersMethodupdate_markets
Update markets when a new period starts
src/monitor.rs:146
↓ 3 callersMethodadd_limit_order
Add a limit order to simulation tracking
src/simulation.rs:135
↓ 3 callersFunctionbalance_allowance
Fetch balance and allowance for token. asset_type: "Collateral" (pUSD) or "Conditional".
src/clob_sdk.rs:417
↓ 3 callersMethodcalculate_trend
Calculate the current trend using linear regression and pattern analysis
src/simulation.rs:1058
↓ 3 callersMethodcheck_all_approvals
Check all approvals for all contracts. Returns (contract_name, usdc_approved, ctf_approved).
src/api.rs:1133
↓ 3 callersFunctiondisabled_eth_market
()
src/bin/main_dual_limit_045_same_size.rs:2902
↓ 3 callersFunctiondisabled_solana_market
()
src/bin/main_dual_limit_045_same_size.rs:2919
↓ 3 callersFunctiondisabled_xrp_market
()
src/bin/main_dual_limit_045_same_size.rs:2936
↓ 3 callersMethodget_current_market_timestamp
Get the current market's timestamp from the BTC market slug
src/monitor.rs:198
↓ 3 callersMethodget_orderbook
Get order book for a specific token
src/api.rs:597
↓ 3 callersMethodget_total_spending_and_earnings
Get total spending and earnings across all positions
src/simulation.rs:863
↓ 3 callersMethodlog_market_start
Log market start event Logs once to simulation.toml and writes to market-specific files (without duplicating main log)
src/simulation.rs:872
↓ 3 callersMethodmid_price
(&self)
src/models.rs:54
↓ 3 callersMethodopposite
Get the opposite token type (Up <-> Down)
src/detector.rs:84
↓ 3 callersFunctionprint_section_title
(title: &str)
src/term_ui.rs:153
↓ 3 callersFunctionredeem_token
Redeem a winning token
src/bin/test_redeem.rs:322
↓ 3 callersMethodredeem_tokens
for pUSD collateral at 1:1 notional after market resolution. Parameters: - condition_id: The condition ID of the resolved market - token_id: The toke
src/api.rs:1816
↓ 3 callersMethodrequest_api_credentials
(&self, method: reqwest::Method, path: &str)
src/api.rs:263
↓ 3 callersMethodreset_period
Reset for new period (detector state is reset elsewhere). We do NOT remove pending trades here: unsold/unredeemed positions from the previous period m
src/trader.rs:3790
↓ 3 callersFunctionsell_token
( api: &PolymarketApi, token_id: &str, balance: f64, shares: Option<f64>, check_only: bool
src/bin/test_sell.rs:192
↓ 3 callersMethodstart_monitoring
Start monitoring markets continuously Returns a callback function that can be used to update markets when new period starts
src/monitor.rs:771
↓ 2 callersMethodadd_auth_headers
Add authentication headers to a request
src/api.rs:484
↓ 2 callersMethodapply_env_overrides
(&mut self)
src/config.rs:249
↓ 2 callersFunctionask_f64
Ask price for recording and calculation (we buy at ask). Falls back to bid if ask missing.
src/bin/main_trailing.rs:140
↓ 2 callersMethodcheck_limit_orders
Check if any limit orders should be filled based on current prices
src/simulation.rs:404
↓ 2 callersMethodcheck_market_result
(&self, condition_id: &str, token_id: &str)
src/trader.rs:3737
↓ 2 callersMethodcheck_usdc_balance_allowance
Check pUSD (CLOB V2 collateral) balance and allowance for buying tokens (via clob_sdk). Returns (balance, allowance) as Decimal values (names `usdc_*`
src/api.rs:1054
↓ 2 callersMethodclear
Clear all price history (useful when starting a new period)
src/simulation.rs:1162
↓ 2 callersFunctionderive_proxy_wallet_for_signer
Derive deterministic Polymarket proxy wallet for a signer EOA on Polygon.
src/api.rs:67
↓ 2 callersFunctionderive_safe_wallet_for_signer
Derive deterministic Polymarket Safe wallet for a signer EOA on Polygon.
src/api.rs:75
↓ 2 callersFunctiondisabled_eth_market
()
src/bin/main_dual_limit_045_5m_btc.rs:1026
↓ 2 callersFunctiondisabled_eth_market
()
src/bin/main_trailing.rs:930
↓ 2 callersFunctiondisabled_solana_market
()
src/bin/main_dual_limit_045_5m_btc.rs:1043
↓ 2 callersFunctiondisabled_solana_market
()
src/bin/main_trailing.rs:947
↓ 2 callersFunctiondisabled_xrp_market
()
src/bin/main_dual_limit_045_5m_btc.rs:1060
↓ 2 callersFunctiondisabled_xrp_market
()
src/bin/main_trailing.rs:964
↓ 2 callersFunctiondiscover_btc_5m_market
( api: &PolymarketApi, current_time: u64, seen_ids: &mut std::collections::HashSet<String>, )
src/bin/main_dual_limit_045_5m_btc.rs:996
↓ 2 callersFunctiondiscover_solana_market
( api: &PolymarketApi, current_time: u64, seen_ids: &mut std::collections::HashSet<String>, )
src/bin/main_dual_limit_045_same_size.rs:2953
↓ 2 callersFunctiondiscover_xrp_market
( api: &PolymarketApi, current_time: u64, seen_ids: &mut std::collections::HashSet<String>, )
src/bin/main_dual_limit_045_same_size.rs:2966
↓ 2 callersMethodexecute_limit_buy
Execute limit buy order - places limit buy for both Up and Down tokens When a buy order fills, immediately places ONE limit sell order at sell_price (
src/trader.rs:1075
↓ 2 callersFunctionfirst_buy_units_and_investment
Returns (units, investment) so that investment = units * price >= MIN_FIRST_BUY_COST and units >= base_shares. Rounds units up to 2 decimals for API.
src/bin/main_trailing.rs:32
↓ 2 callersMethodget_opposite_token_id
Get the opposite token ID for a given token type and condition ID Returns the token ID of the opposite token (Up <-> Down)
src/trader.rs:175
↓ 2 callersFunctionget_or_discover_markets
( api: &PolymarketApi, enable_eth: bool, enable_solana: bool, enable_xrp: bool, )
src/bin/main_trailing.rs:870
↓ 2 callersFunctionget_or_discover_markets
Copy helper functions from main.rs
src/bin/main_dual_limit_045_same_size.rs:2801
↓ 2 callersMethodget_pending_order_token_ids
Get all token IDs from pending limit orders
src/simulation.rs:771
↓ 2 callersMethodget_position_summary
Get position summary
src/simulation.rs:688
next →1–100 of 284, ranked by callers