MCPcopy Create free account

hub / github.com/MrFadiAi/Polymarket-bot / functions

Functions792 in github.com/MrFadiAi/Polymarket-bot

↓ 5 callersMethodgetWalletProfile
* Get comprehensive wallet profile with PnL analysis
src/services/wallet-service.ts:243
↓ 5 callersMethodisConnected
* Check if connected
src/services/realtime-service-v2.ts:320
↓ 5 callersFunctionloadHistory
()
src/dashboard/session-history.ts:94
↓ 5 callersFunctionrecordTrade
(profit: number, strategy: string)
bot-with-dashboard.ts:316
↓ 5 callersFunctionsendCommand
(command: string, payload: unknown)
dashboard/src/hooks/useWebSocket.ts:100
↓ 5 callersFunctionsleep
(ms: number)
scripts/arb/token-rebalancer.ts:417
↓ 5 callersMethodstart
* Start SDK - initialize trading + connect WebSocket * * One method to do everything: * - Initialize trading service (derive API credentials)
src/index.ts:514
↓ 5 callersFunctionvalidateSize
( size: number, minOrderSize = 0.1 )
src/utils/price-utils.ts:104
↓ 4 callersFunctioncalculateDipArbProfitRate
(totalCost: number)
src/services/dip-arb-types.ts:648
↓ 4 callersMethodcheckPool
* Check if a pool exists for a token pair
src/services/swap-service.ts:219
↓ 4 callersFunctiondepositUsdc
( signer: ethers.Wallet, amount: number, options: DepositOptions = {} )
src/clients/bridge-client.ts:535
↓ 4 callersMethodenableAutoRotate
* Configure and enable auto-rotate * * Auto-rotate 会自动: * 1. 监控当前市场到期时间 * 2. 在市场结束前预加载下一个市场 * 3. 市场结束时自动结算(redeem 或 sell) * 4. 无缝切换到
src/services/dip-arb-service.ts:1565
↓ 4 callersFunctionformatCurrency
(value: number, decimals: number = 2)
dashboard/src/components/BalanceCards.tsx:43
↓ 4 callersFunctionformatDate
(dateStr: string)
dashboard/src/components/HistoryPage.tsx:52
↓ 4 callersMethodgetBalances
* Get balances for all supported tokens
src/services/swap-service.ts:455
↓ 4 callersFunctiongetExplorerUrl
(chainId: number, txHash: string)
src/clients/bridge-client.ts:826
↓ 4 callersMethodgetGlobalOpenInterest
* 获取全局 Open Interest
src/clients/subgraph.ts:437
↓ 4 callersMethodgetKLines
* Get K-Line candles for a market (single token) * * @param conditionId - Market condition ID * @param interval - K-line interval (1s, 5s, 15
src/services/market-service.ts:607
↓ 4 callersMethodgetMarketResolution
* Check if a market is resolved and get payout info
src/clients/ctf-client.ts:689
↓ 4 callersMethodgetSplits
* 获取用户的 Split 事件
src/clients/subgraph.ts:331
↓ 4 callersMethodgetTrades
* Get recent trades * * @param params - Query parameters (P2: user, side, takerOnly, etc.) * * @example * ```typescript * // Get mar
src/clients/data-api.ts:630
↓ 4 callersMethodinitialize
* Initialize the SDK (required for trading operations)
src/index.ts:486
↓ 4 callersFunctionisDipArbLeg1Signal
(signal: DipArbSignal)
src/services/dip-arb-types.ts:710
↓ 4 callersFunctionprintSummary
()
scripts/arb-tests/03-e2e-tests.ts:97
↓ 4 callersMethodquickScan
* Quick scan for best arbitrage opportunities * * @param minProfit Minimum profit threshold (default: 0.005 = 0.5%) * @param limit Maximum nu
src/services/arbitrage-service.ts:1810
↓ 4 callersFunctionroundSize
(size: number)
src/utils/price-utils.ts:63
↓ 4 callersFunctionrpcCall
(url: string, method: string, params: any[])
scripts/benchmark/rpc-latency.ts:45
↓ 4 callersMethodstartAutoCopyTrading
* Start auto copy trading - 自动跟单 * * @example * ```typescript * const sub = await smartMoneyService.startAutoCopyTrading({ * targetAd
src/services/smart-money-service.ts:915
↓ 4 callersMethodsubscribeMarket
* Subscribe to a single market (YES + NO tokens) * Also emits derived price updates compatible with old API
src/services/realtime-service-v2.ts:403
↓ 4 callersMethodsubscribeSmartMoneyTrades
* Subscribe to trades from specific addresses * * @example * ```typescript * const sub = smartMoneyService.subscribeSmartMoneyTrades( *
src/services/smart-money-service.ts:803
↓ 3 callersMethodaggregateToKLines
* Aggregate trades into K-Line candles * * Note: Polymarket API may return timestamps in seconds or milliseconds. * This function normalizes
src/services/market-service.ts:951
↓ 3 callersFunctionanalyzeTrend
(symbol: 'BTCUSDT' | 'ETHUSDT' | 'SOLUSDT')
bot-config.ts:684
↓ 3 callersFunctionanalyzeTrend
(symbol: 'BTCUSDT' | 'ETHUSDT' | 'SOLUSDT')
bot-with-dashboard.ts:816
↓ 3 callersMethodapproveAll
* Set up all required approvals for trading * * @returns Results of all approval transactions
src/services/onchain-service.ts:228
↓ 3 callersFunctionbroadcast
(message: WebSocketMessage)
src/dashboard/server.ts:23
↓ 3 callersMethodbuildPieChart
* Build pie chart data
src/services/smart-money-service.ts:2223
↓ 3 callersFunctioncalculateBuyAmount
(price: number, size: number)
src/utils/price-utils.ts:125
↓ 3 callersFunctioncalculatePnL
( entryPrice: number, currentPrice: number, size: number, side: 'long' | 'short' = 'long' )
src/utils/price-utils.ts:290
↓ 3 callersMethodcalculateRebalanceAction
* Calculate recommended rebalance action based on current state
src/services/arbitrage-service.ts:626
↓ 3 callersFunctioncalculateSharesForAmount
( amount: number, price: number )
src/utils/price-utils.ts:147
↓ 3 callersMethodcheckAllowances
* Check all ERC20 and ERC1155 allowances required for trading * * @returns Status of all allowances and whether trading is ready
src/services/onchain-service.ts:219
↓ 3 callersMethodcheckAllowances
* Check all ERC20 and ERC1155 allowances required for trading * * @returns Status of all allowances and whether trading is ready
src/services/authorization-service.ts:128
↓ 3 callersMethodcheckReadyForCTF
* Check if wallet is ready for CTF trading operations * * Verifies: * - Has sufficient USDC.e (not native USDC) * - Has MATIC for gas fees
src/clients/ctf-client.ts:256
↓ 3 callersMethodclearPositions
* Clear all positions in a market using the best strategy * * Strategy: * - Active market: Merge paired tokens → Sell remaining unpaired toke
src/services/arbitrage-service.ts:927
↓ 3 callersMethoddetectArbitrage
* Detect arbitrage opportunity * * 使用有效价格计算套利机会(正确考虑镜像订单) * 详细文档见: docs/01-polymarket-orderbook-arbitrage.md
src/index.ts:587
↓ 3 callersMethoddisconnect
* Disconnect all services and clean up * @deprecated Use stop() instead
src/index.ts:558
↓ 3 callersFunctionestimateBridgeOutput
(amount: number, tokenSymbol: string)
src/clients/bridge-client.ts:804
↓ 3 callersMethodfindNearestPrice
* Find the nearest available price for a timestamp
src/services/market-service.ts:859
↓ 3 callersMethodfindNextMarket
()
src/services/dip-arb-service.ts:2059
↓ 3 callersMethodfromGammaMarket
(gamma: GammaMarket)
src/services/market-service.ts:1539
↓ 3 callersMethodgetAddress
* Get the wallet address
src/services/onchain-service.ts:178
↓ 3 callersMethodgetGasPrice
* Get current gas price info
src/services/onchain-service.ts:441
↓ 3 callersMethodgetKLines
* Get K-lines (candlestick data) for a symbol * * @param symbol - Trading pair (BTCUSDT, ETHUSDT, SOLUSDT) * @param interval - K-line interva
src/services/binance-service.ts:119
↓ 3 callersMethodgetMakerFills
* 获取用户作为 maker 的成交事件
src/clients/subgraph.ts:471
↓ 3 callersMethodgetMarket
* Get market by slug or condition ID
src/services/market-service.ts:503
↓ 3 callersMethodgetOpenOrders
(marketId?: string)
src/services/trading-service.ts:463
↓ 3 callersMethodgetOrderbook
* Get processed orderbook with analytics (alias for getProcessedOrderbook)
src/services/market-service.ts:1102
↓ 3 callersMethodgetPrice
* Get current price for a symbol * * @param symbol - Trading pair (BTCUSDT, ETHUSDT, SOLUSDT) * @returns Current price * * @example
src/services/binance-service.ts:164
↓ 3 callersMethodgetTickSize
* Get tick size for a token
src/services/trading-service.ts:252
↓ 3 callersMethodgetTokenOrderbook
* Get orderbook for a single token
src/services/market-service.ts:330
↓ 3 callersMethodgetTradesByMarket
* Get trades for a specific market
src/clients/data-api.ts:680
↓ 3 callersMethodgetUserPositions
* 获取用户持仓 (含 PnL)
src/clients/subgraph.ts:273
↓ 3 callersMethodinvalidate
(pattern: string)
src/core/unified-cache.ts:27
↓ 3 callersMethodisCacheValid
()
src/services/smart-money-service.ts:2264
↓ 3 callersMethodisInitialized
()
src/services/trading-service.ts:614
↓ 3 callersMethodlogOrderbookContext
* Log orderbook buffer around a signal/trade * Called when signal is detected to capture market context
src/services/dip-arb-service.ts:2248
↓ 3 callersFunctionnormalizeTimestamp
* Normalize timestamp to milliseconds. * Polymarket API sometimes returns timestamps in seconds. * Timestamps < 1e12 (year ~2001 in ms) are assumed
src/services/market-service.ts:56
↓ 3 callersMethodnormalizeTimestamp
(ts: unknown)
src/clients/data-api.ts:1043
↓ 3 callersMethodparseJsonArray
(value: unknown, fallback: T[])
src/clients/gamma-api.ts:616
↓ 3 callersFunctionquery
(endpoint: string, q: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:19
↓ 3 callersFunctionrecordTest
(name: string, passed: boolean, duration: number, error?: string, details?: any)
scripts/arb-tests/02-integration-tests.ts:35
↓ 3 callersFunctionrecordTrade
(profit: number, strategy: string)
bot-config.ts:343
↓ 3 callersFunctionrunTestSuite
(name: string, tests: TestCase[])
scripts/api-verification/04-data-api-params.ts:203
↓ 3 callersFunctionsaveHistory
(history: HistoryData)
src/dashboard/session-history.ts:125
↓ 3 callersFunctionsimulateTrade
(profit: number, strategy: string, description: string)
bot-with-dashboard.ts:339
↓ 3 callersMethodsplit
* Split USDC into YES + NO tokens * * @param conditionId - Market condition ID * @param amount - USDC amount (e.g., "100" for 100 USDC) *
src/services/onchain-service.ts:261
↓ 3 callersMethodstartRotateCheck
()
src/services/dip-arb-service.ts:1789
↓ 3 callersMethodswap
* Execute a token swap using QuickSwap V3
src/services/swap-service.ts:554
↓ 3 callersMethodtransfer
* Transfer an ERC20 token to another address
src/services/swap-service.ts:822
↓ 3 callersFunctionupdateBalance
()
scripts/archive/one-off-trading/faze-bo3-arb.ts:182
↓ 3 callersMethodvalidateSymbol
(symbol: string)
src/services/binance-service.ts:276
↓ 3 callersMethodwrapMatic
* Wrap native MATIC to WMATIC
src/services/swap-service.ts:510
↓ 2 callersFunctionaggregateToKLines
(trades: Trade[], interval: KLineInterval)
examples/04-kline-aggregation.ts:26
↓ 2 callersFunctioncalcStats
(arr: number[])
scripts/benchmark/ws-latency.ts:158
↓ 2 callersFunctioncalcStats
(arr: number[])
scripts/benchmark/rpc-latency.ts:214
↓ 2 callersFunctioncalcStats
(arr: number[])
scripts/benchmark/order-latency.ts:213
↓ 2 callersMethodcalculateCategoryDistributionFromClosed
* Calculate category distribution from closed positions
src/services/smart-money-service.ts:2025
↓ 2 callersMethodcalculateDerivedPrice
* Calculate derived price using Polymarket's display logic: * - If spread <= 0.10: use midpoint * - If spread > 0.10: use last trade price
src/services/realtime-service-v2.ts:1202
↓ 2 callersMethodcalculateGasCost
* Calculate gas cost from gas units
src/clients/ctf-client.ts:1166
↓ 2 callersFunctioncalculateMidpoint
(bid: number, ask: number)
src/utils/price-utils.ts:172
↓ 2 callersMethodcalculatePositionId
* Calculate position ID for a given outcome (INTERNAL USE ONLY) * * ⚠️ WARNING: This calculation does NOT produce correct Polymarket token IDs!
src/clients/ctf-client.ts:1117
↓ 2 callersMethodcalculateRealtimeSpread
* Calculate real-time spread from orderbook (for live trading) * * This uses orderbook bid/ask prices for accurate arbitrage detection. * Use
src/services/market-service.ts:1053
↓ 2 callersFunctioncalculateSellPayout
(price: number, size: number)
src/utils/price-utils.ts:136
↓ 2 callersFunctioncalculateSpread
(bid: number, ask: number)
src/utils/price-utils.ts:161
↓ 2 callersFunctioncanTrade
()
bot-with-dashboard.ts:235
↓ 2 callersMethodcancelOrder
(orderId: string)
src/services/trading-service.ts:415
↓ 2 callersFunctioncheckArbitrage
()
scripts/archive/one-off-trading/faze-bo3-arb.ts:219
↓ 2 callersMethodcheckMergeBalance
( balances: PositionBalance, amount: string )
src/clients/ctf-client.ts:1007
↓ 2 callersMethodcheckOpportunity
* Check for arbitrage opportunity based on current orderbook
src/services/arbitrage-service.ts:488
↓ 2 callersMethodcheckRotation
()
src/services/dip-arb-service.ts:1958
← previousnext →101–200 of 792, ranked by callers