polymarket
polymarket cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.
🔌 Looking for raw exchange endpoints? See the polymarket implicit API — every endpoint in this exchange's API exposed as an implicit method.
polymarket
Kind: global class
Extends: Exchange
- fetchTime
- fetchStatus
- fetchCurrencies
- fetchMarkets
- fetchTicker
- fetchTickers
- fetchBidsAsks
- fetchOrderBook
- fetchTrades
- fetchOHLCV
- fetchFundingRate
- fetchFundingRates
- fetchFundingRateHistory
- fetchOpenInterest
- fetchOpenInterests
- fetchTradingFees
- createOrder
- createOrders
- cancelOrder
- cancelOrders
- cancelAllOrders
- cancelAllOrdersAfter
- editOrder
- fetchBalance
- fetchPositions
- fetchPosition
- fetchOpenOrders
- fetchOrders
- fetchOrder
- fetchMyTrades
- fetchFundingHistory
- fetchDeposits
- fetchWithdrawals
- withdraw
- fetchLeverage
- fetchMarginMode
- setLeverage
- setMarginMode
- addMargin
- reduceMargin
- createProxyCredentials
polymarket
Polymarket perpetual futures - a hybrid dex with an off-chain order book and on-chain settlement of collateral. The venue trades linear perpetual contracts on crypto, indices, equities and commodities, quoted using USD and collateralized exclusively with pUSD. The prediction-market CLOB is a separate product, integrated separately under ccxt.prediction.polymarket
polymarket.polymarket ()fetchTime
fetches the current integer timestamp in milliseconds from the exchange server
Kind: instance method of polymarket
Returns: int - the current integer timestamp in milliseconds from the exchange server
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchTime (params?)fetchStatus
the latest known information on the availability of the exchange api
Kind: instance method of polymarket
Returns: object - a status structure
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchStatus (params?)fetchCurrencies
fetches all available currencies on an exchange - every instrument base, the usd quote and the collateral asset
Kind: instance method of polymarket
Returns: object - an associative dictionary of currencies
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchCurrencies (params?)fetchMarkets
retrieves data on all markets for polymarket perps
Kind: instance method of polymarket
Returns: Array<object> - an array of objects representing market data
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchMarkets (params?)fetchTicker
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market, merging the ticker, statistics and best bid and ask endpoints
Kind: instance method of polymarket
Returns: object - a ticker structure
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch the ticker for |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchTicker (symbol, params?)fetchTickers
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market, merging the ticker, statistics and best bid and ask endpoints
Kind: instance method of polymarket
Returns: object - a dictionary of ticker structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchTickers (symbols?, params?)fetchBidsAsks
fetches the best bid and ask price and volume for multiple markets
Kind: instance method of polymarket
Returns: object - a dictionary of ticker structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchBidsAsks (symbols?, params?)fetchOrderBook
fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of polymarket
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch the order book for |
| limit | int | No | the maximum amount of order book entries to return, must be one of 10, 100, 500 or 1000, the default is 100 |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchOrderBook (symbol, limit?, params?)fetchTrades
get the list of the most recent trades for a particular symbol
Kind: instance method of polymarket
Returns: Array<Trade> - a list of trade structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch trades for |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum number of trades to fetch, the venue serves at most 100 per request |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest trade to fetch |
polymarket.fetchTrades (symbol, since?, limit?, params?)fetchOHLCV
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of polymarket
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | string | Yes | the length of time each candle represents |
| since | int | No | timestamp in ms of the earliest candle to fetch |
| limit | int | No | the maximum amount of candles to fetch, the venue serves at most 1000 per request |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest candle to fetch |
| params.paginate | boolean | No | default false, when true will automatically paginate by calling the endpoint multiple times |
polymarket.fetchOHLCV (symbol, timeframe, since?, limit?, params?)fetchFundingRate
fetch the current funding rate
Kind: instance method of polymarket
Returns: object - a funding rate structure
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchFundingRate (symbol, params?)fetchFundingRates
fetches the current funding rates for multiple markets
Kind: instance method of polymarket
Returns: object - a dictionary of funding rate structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | unified market symbols |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchFundingRates (symbols?, params?)fetchFundingRateHistory
fetches historical funding rate prices
Kind: instance method of polymarket
Returns: Array<object> - a list of funding rate structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for |
| since | int | No | timestamp in ms of the earliest funding rate to fetch |
| limit | int | No | the maximum amount of funding rate structures to fetch, the venue serves at most 100 per request |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest funding rate to fetch |
| params.paginate | boolean | No | default false, when true will automatically paginate by calling the endpoint multiple times |
polymarket.fetchFundingRateHistory (symbol, since?, limit?, params?)fetchOpenInterest
retrieves the open interest of a contract trading pair
Kind: instance method of polymarket
Returns: object - an open interest structure
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchOpenInterest (symbol, params?)fetchOpenInterests
retrieves the open interest of multiple contract trading pairs
Kind: instance method of polymarket
Returns: object - a dictionary of open interest structures
See: https://docs.polymarket.com/perps/market-data
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | unified market symbols, all markets are returned if not assigned |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchOpenInterests (symbols?, params?)fetchTradingFees
fetches the default trading fees for multiple markets
Kind: instance method of polymarket
Returns: object - a dictionary of fee structures indexed by market symbols
See: https://docs.polymarket.com/perps/learn-about-trading/fees
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchTradingFees (params?)createOrder
create a trade order
Kind: instance method of polymarket
Returns: object - an order structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to create an order in |
| type | string | Yes | 'market' or 'limit', a market order executes like an immediate-or-cancel order without a price |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | how much you want to trade in units of the base currency |
| price | float | No | the price to fulfill the order at, a market order accepts one to act like a protective bound |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' |
| params.postOnly | bool | No | true to place a maker only order |
| params.reduceOnly | bool | No | true to reduce an open position only |
| params.clientOrderId | string | No | a client order id, exactly 32 lowercase hex characters |
| params.exp | int | No | expiry timestamp of the signed command in ms, bounds how long the gateway may hold the request |
polymarket.createOrder (symbol, type, side, amount, price?, params?)createOrders
create a list of trade orders in one signed batch
Kind: instance method of polymarket
Returns: Array<object> - a list of order structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.exp | int | No | expiry timestamp of the signed command in ms, bounds how long the gateway may hold the request |
polymarket.createOrders (orders, params?)cancelOrder
cancels an open order
Kind: instance method of polymarket
Returns: object - an order structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | No | not used by polymarket cancelOrder |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | string | No | cancel by the client order id instead of the exchange order id |
polymarket.cancelOrder (id, symbol?, params?)cancelOrders
cancel multiple orders in one signed batch
Kind: instance method of polymarket
Returns: Array<object> - a list of order structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> | Yes | order ids |
| symbol | string | No | not used by polymarket cancelOrders |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderIds | Array<string> | No | cancel by client order ids instead of the exchange order ids |
polymarket.cancelOrders (ids, symbol?, params?)cancelAllOrders
cancel all open orders, optionally scoped to a single market
Kind: instance method of polymarket
Returns: Array<object> - a list with the raw acknowledgement of the venue
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol, cancels the orders of every market when omitted |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.cancelAllOrders (symbol?, params?)cancelAllOrdersAfter
arms or clears a dead man's switch that cancels every open order once the deadline passes
Kind: instance method of polymarket
Returns: object - the raw acknowledgement of the venue
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer, the venue requires at least 5 seconds |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.cancelAllOrdersAfter (timeout, params?)editOrder
edit a resting standalone gtc limit order, only the price and the total quantity can change
Kind: instance method of polymarket
Returns: object - an order structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | Yes | unified symbol of the market the order was made in |
| type | string | Yes | not used by polymarket editOrder |
| side | string | Yes | not used by polymarket editOrder |
| amount | float | Yes | the new total order quantity, it must exceed the already filled quantity |
| price | float | Yes | the new order price |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.editOrder (id, symbol, type, side, amount, price, params?)fetchBalance
query for the account equity, the free order margin and the used initial margin
Kind: instance method of polymarket
Returns: object - a balance structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchBalance (params?)fetchPositions
fetch all open positions
Kind: instance method of polymarket
Returns: Array<object> - a list of position structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | list of unified market symbols |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchPositions (symbols?, params?)fetchPosition
fetch data on a single open contract trade position
Kind: instance method of polymarket
Returns: object - a position structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market the position is held in |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchPosition (symbol, params?)fetchOpenOrders
fetch all unfilled currently open orders
Kind: instance method of polymarket
Returns: Array<Order> - a list of order structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol |
| since | int | No | not sent to the venue, applied client-side |
| limit | int | No | the maximum number of open order structures to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchOpenOrders (symbol?, since?, limit?, params?)fetchOrders
fetches the latest known snapshot of up to one hundred orders
Kind: instance method of polymarket
Returns: Array<Order> - a list of order structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol of the market orders were made in |
| since | int | No | timestamp in ms of the earliest order |
| limit | int | No | not sent to the venue, applied client-side |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest order |
| params.clientOrderId | string | No | fetch the order with this client order id only |
polymarket.fetchOrders (symbol?, since?, limit?, params?)fetchOrder
fetches information on an order made by the user
Kind: instance method of polymarket
Returns: object - an order structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the order id |
| symbol | string | No | not used by polymarket fetchOrder |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchOrder (id, symbol?, params?)fetchMyTrades
fetch all trades made by the user
Kind: instance method of polymarket
Returns: Array<Trade> - a list of trade structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol, the venue serves fills of every market, filtered client-side |
| since | int | No | timestamp in ms of the earliest trade |
| limit | int | No | the maximum number of trade structures to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest trade |
| params.cursor | string | No | opaque pagination cursor returned by the previous page |
polymarket.fetchMyTrades (symbol?, since?, limit?, params?)fetchFundingHistory
fetch the funding payments paid and received on the open positions of the account
Kind: instance method of polymarket
Returns: Array<object> - a list of funding history structures
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | No | unified market symbol |
| since | int | No | timestamp in ms of the earliest funding payment |
| limit | int | No | the maximum number of funding payment structures to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest funding payment |
polymarket.fetchFundingHistory (symbol?, since?, limit?, params?)fetchDeposits
fetch all deposits made to the account
Kind: instance method of polymarket
Returns: Array<object> - a list of transaction structures
See: https://docs.polymarket.com/perps/fund-your-account
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | unified currency code |
| since | int | No | timestamp in ms of the earliest deposit |
| limit | int | No | the maximum number of transaction structures to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest deposit |
polymarket.fetchDeposits (code?, since?, limit?, params?)fetchWithdrawals
fetch all withdrawals made from the account
Kind: instance method of polymarket
Returns: Array<object> - a list of transaction structures
See: https://docs.polymarket.com/perps/fund-your-account
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | unified currency code |
| since | int | No | timestamp in ms of the earliest withdrawal |
| limit | int | No | the maximum number of transaction structures to return |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp in ms of the latest withdrawal |
polymarket.fetchWithdrawals (code?, since?, limit?, params?)withdraw
withdraw the collateral asset to the polymarket wallet of the account, the request is signed by the wallet key with the withdraw struct of the deposit contract
Kind: instance method of polymarket
Returns: object - a transaction structure
See: https://docs.polymarket.com/perps/fund-your-account
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| amount | float | Yes | the amount to withdraw |
| address | string | Yes | the address to withdraw to |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.withdraw (code, amount, address, params?)fetchLeverage
fetch the leverage and the margin mode configured for a market
Kind: instance method of polymarket
Returns: object - a leverage structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchLeverage (symbol, params?)fetchMarginMode
fetches the margin mode configured for a market
Kind: instance method of polymarket
Returns: object - a margin mode structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.fetchMarginMode (symbol, params?)setLeverage
set the level of leverage for a market, optionally switching the margin mode at the same time
Kind: instance method of polymarket
Returns: object - the raw acknowledgement of the venue
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| leverage | float | Yes | the rate of leverage |
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.marginMode | string | No | 'cross' or 'isolated', the venue keeps the current mode when omitted is not supported - the default is cross |
polymarket.setLeverage (leverage, symbol, params?)setMarginMode
set the margin mode of a market, the venue updates the mode and the leverage together
Kind: instance method of polymarket
Returns: object - the raw acknowledgement of the venue
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| marginMode | string | Yes | 'cross' or 'isolated' |
| symbol | string | No | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.leverage | float | Yes | the rate of leverage to set together with the mode |
polymarket.setMarginMode (marginMode, symbol?, params?)addMargin
add margin to an isolated position
Kind: instance method of polymarket
Returns: object - a margin structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| amount | float | Yes | amount of margin to add |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.addMargin (symbol, amount, params?)reduceMargin
remove margin from an isolated position
Kind: instance method of polymarket
Returns: object - a margin structure
See: https://docs.polymarket.com/perps/trading
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| amount | float | Yes | the amount of margin to remove |
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.reduceMargin (symbol, amount, params?)createProxyCredentials
provisions fresh trading session credentials - generates a proxy keypair, registers it with an EIP-712 CreateProxy message signed by the wallet key and caches the returned secret, the venue keeps the session valid for the requested lifetime
Kind: instance method of polymarket
Returns: object - the session credentials, holding the proxy address, the proxy private key, the secret and the expiry timestamp
See: https://docs.polymarket.com/perps/authenticated-sessions
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
polymarket.createProxyCredentials (params?)