phemex
phemex cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.
phemex
Kind: global class
Extends: Exchange
- fetchMarkets
- fetchCurrencies
- fetchOrderBook
- fetchOHLCV
- fetchTicker
- fetchTickers
- fetchTrades
- fetchBalance
- createOrder
- editOrder
- cancelOrder
- cancelAllOrders
- fetchOrder
- fetchOrders
- fetchOpenOrders
- fetchClosedOrders
- fetchMyTrades
- fetchDepositAddress
- fetchDeposits
- fetchWithdrawals
- fetchPositions
- fetchPositionHistory
- fetchFundingHistory
- fetchFundingRate
- setMargin
- setMarginMode
- setPositionMode
- fetchLeverageTiers
- setLeverage
- transfer
- fetchTransfers
- fetchFundingRateHistory
- withdraw
- fetchOpenInterest
- fetchConvertQuote
- createConvertTrade
- fetchConvertTradeHistory
- fetchPositionADLRank
- watchBalance
- watchTicker
- watchTickers
- watchTrades
- watchOrderBook
- watchOHLCV
- watchMyTrades
- watchOrders
fetchMarkets
retrieves data on all markets for phemex
Kind: instance method of phemex
Returns: Array<object> - an array of objects representing market data
See: https://phemex-docs.github.io/#query-product-information-3
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchMarkets (params?)fetchCurrencies
fetches all available currencies on an exchange
Kind: instance method of phemex
Returns: object - an associative dictionary of currencies
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchCurrencies (params?)fetchOrderBook
fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of phemex
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchOrderBook (symbol, 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 phemex
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline
| 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 | only used for USDT settled contracts, otherwise is emulated and not supported by the exchange timestamp in ms of the earliest candle to fetch |
| limit | int | No | the maximum amount of candles to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | USDT settled/ linear swaps only end time in ms |
phemex.fetchOHLCV (symbol, timeframe, since?, limit?, params?)fetchTicker
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of phemex
Returns: object - a ticker structure
| 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 |
phemex.fetchTicker (symbol, params?)fetchTickers
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of phemex
Returns: object - a dictionary of ticker structures
See
- https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 // spot
- https://phemex-docs.github.io/#query-24-ticker-for-all-symbols // linear
- https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols // inverse
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string>, undefined | Yes | 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 |
phemex.fetchTickers (symbols, params?)fetchTrades
get the list of most recent trades for a particular symbol
Kind: instance method of phemex
Returns: Array<Trade> - a list of trade structures
See: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades
| 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 amount of trades to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchTrades (symbol, since?, limit?, params?)fetchBalance
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of phemex
Returns: object - a balance structure
See
- https://phemex-docs.github.io/#query-wallets
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
- https://phemex-docs.github.io/#query-trading-account-and-positions
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.type | string | No | spot or swap |
| params.code | string | No | swap only currency code of the balance to query (USD, USDT, etc), default is USDT |
phemex.fetchBalance (params?)createOrder
create a trade order
Kind: instance method of phemex
Returns: object - an order structure
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
- https://phemex-docs.github.io/#place-order-http-put-prefered-3
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to create an order in |
| type | string | Yes | 'market' or 'limit' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | how much of currency you want to trade in units of base currency |
| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.trigger | float | No | trigger price for conditional orders |
| params.takeProfit | object | No | swap only takeProfit object in params containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) |
| params.takeProfit.triggerPrice | float | No | take profit trigger price |
| params.stopLoss | object | No | swap only stopLoss object in params containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) |
| params.stopLoss.triggerPrice | float | No | stop loss trigger price |
| params.posSide | string | No | swap only "Merged" for one way mode, "Long" for buy side of hedged mode, "Short" for sell side of hedged mode |
| params.hedged | bool | No | swap only true for hedged mode, false for one way mode, default is false |
phemex.createOrder (symbol, type, side, amount, price?, params?)editOrder
edit a trade order
Kind: instance method of phemex
Returns: object - an order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | cancel order id |
| symbol | string | Yes | unified symbol of the market to create an order in |
| type | string | Yes | 'market' or 'limit' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | how much of currency you want to trade in units of base currency |
| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.posSide | string | No | either 'Merged' or 'Long' or 'Short' |
phemex.editOrder (id, symbol, type, side, amount, price?, params?)cancelOrder
cancels an open order
Kind: instance method of phemex
Returns: object - An order structure
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| symbol | string | Yes | unified symbol of the market the order was made in |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.posSide | string | No | either 'Merged' or 'Long' or 'Short' |
phemex.cancelOrder (id, symbol, params?)cancelAllOrders
cancel all open orders in a market
Kind: instance method of phemex
Returns: Array<object> - a list of order structures
See: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market to cancel orders in |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.cancelAllOrders (symbol, params?)fetchOrder
fetches information on an order made by the user
Kind: instance method of phemex
Returns: object - An order structure
See: https://phemex-docs.github.io/#query-orders-by-ids
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the order id |
| symbol | string | Yes | unified symbol of the market the order was made in |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchOrder (id, symbol, params?)fetchOrders
fetches information on multiple orders made by the user
Kind: instance method of phemex
Returns: Array<Order> - a list of order structures
See: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchOrders (symbol, since?, limit?, params?)fetchOpenOrders
fetch all unfilled currently open orders
Kind: instance method of phemex
Returns: Array<Order> - a list of order structures
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| since | int | No | the earliest time in ms to fetch open orders for |
| limit | int | No | the maximum number of open order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchOpenOrders (symbol, since?, limit?, params?)fetchClosedOrders
fetches information on multiple closed orders made by the user
Kind: instance method of phemex
Returns: Array<Order> - a list of order structures
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.settle | string | No | the settlement currency to fetch orders for |
phemex.fetchClosedOrders (symbol, since?, limit?, params?)fetchMyTrades
fetch all trades made by the user
Kind: instance method of phemex
Returns: Array<Trade> - a list of trade structures
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| since | int | No | the earliest time in ms to fetch trades for |
| limit | int | No | the maximum number of trades structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchMyTrades (symbol, since?, limit?, params?)fetchDepositAddress
fetch the deposit address for a currency associated with this account
Kind: instance method of phemex
Returns: object - an address structure
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.network | string | No | the chain name to fetch the deposit address e.g. ETH, TRX, EOS, SOL, etc. |
phemex.fetchDepositAddress (code, params?)fetchDeposits
fetch all deposits made to an account
Kind: instance method of phemex
Returns: Array<object> - a list of transaction structures
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| since | int | No | the earliest time in ms to fetch deposits for |
| limit | int | No | the maximum number of deposits structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchDeposits (code, since?, limit?, params?)fetchWithdrawals
fetch all withdrawals made from an account
Kind: instance method of phemex
Returns: Array<object> - a list of transaction structures
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| since | int | No | the earliest time in ms to fetch withdrawals for |
| limit | int | No | the maximum number of withdrawals structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchWithdrawals (code, since?, limit?, params?)fetchPositions
fetch all open positions
Kind: instance method of phemex
Returns: Array<object> - a list of position structure
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
- https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | list of unified market symbols |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.code | string | No | the currency code to fetch positions for, USD, BTC or USDT, USDT is the default |
| params.method | string | No | USDT contracts only 'privateGetGAccountsAccountPositions' or 'privateGetGAccountsAccountPositions' default is 'privateGetGAccountsAccountPositions' |
phemex.fetchPositions (symbols?, params?)fetchPositionHistory
fetches historical positions
Kind: instance method of phemex
Returns: Array<object> - a list of position structures
See: https://phemex-docs.github.io/#query-closed-positions
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified contract symbol |
| since | int | No | the earliest time in ms to fetch positions for |
| limit | int | No | the maximum amount of records to fetch |
| params | object | No | extra parameters specific to the exchange api endpoint |
| params.until | int | No | the latest time in ms to fetch positions for |
phemex.fetchPositionHistory (symbol, since?, limit?, params?)fetchFundingHistory
fetch the history of funding payments paid and received on this account
Kind: instance method of phemex
Returns: object - a funding history structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| since | int | No | the earliest time in ms to fetch funding history for |
| limit | int | No | the maximum number of funding history structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchFundingHistory (symbol, since?, limit?, params?)fetchFundingRate
fetch the current funding rate
Kind: instance method of phemex
Returns: object - a funding rate structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchFundingRate (symbol, params?)setMargin
Either adds or reduces margin in an isolated position in order to set the margin to a specific value
Kind: instance method of phemex
Returns: object - A margin structure
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market to set margin in |
| amount | float | Yes | the amount to set the margin to |
| params | object | No | parameters specific to the exchange API endpoint |
phemex.setMargin (symbol, amount, params?)setMarginMode
set margin mode to 'cross' or 'isolated'
Kind: instance method of phemex
Returns: object - response from the exchange
See: https://phemex-docs.github.io/#set-leverage
| Param | Type | Required | Description |
|---|---|---|---|
| marginMode | string | Yes | 'cross' or 'isolated' |
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.setMarginMode (marginMode, symbol, params?)setPositionMode
set hedged to true or false for a market
Kind: instance method of phemex
Returns: object - response from the exchange
| Param | Type | Required | Description |
|---|---|---|---|
| hedged | bool | Yes | set to true to use dualSidePosition |
| symbol | string | Yes | not used by binance setPositionMode () |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.setPositionMode (hedged, symbol, params?)fetchLeverageTiers
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
Kind: instance method of phemex
Returns: object - a dictionary of leverage tiers structures, indexed by market symbols
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string>, undefined | Yes | list of unified market symbols |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchLeverageTiers (symbols, params?)setLeverage
set the level of leverage for a market
Kind: instance method of phemex
Returns: object - response from the exchange
See: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
| Param | Type | Required | Description |
|---|---|---|---|
| leverage | float | Yes | the rate of leverage, 100 > leverage > -100 excluding numbers between -1 to 1 |
| symbol | string | Yes | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.hedged | bool | No | set to true if hedged position mode is enabled (by default long and short leverage are set to the same value) |
| params.longLeverageRr | float | No | hedged mode only set the leverage for long positions |
| params.shortLeverageRr | float | No | hedged mode only set the leverage for short positions |
phemex.setLeverage (leverage, symbol, params?)transfer
transfer currency internally between wallets on the same account
Kind: instance method of phemex
Returns: object - a transfer structure
See
- https://phemex-docs.github.io/#transfer-between-spot-and-futures
- https://phemex-docs.github.io/#universal-transfer-main-account-only-transfer-between-sub-to-main-main-to-sub-or-sub-to-sub
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| amount | float | Yes | amount to transfer |
| fromAccount | string | Yes | account to transfer from |
| toAccount | string | Yes | account to transfer to |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.bizType | string | No | for transferring between main and sub-acounts either 'SPOT' or 'PERPETUAL' default is 'SPOT' |
phemex.transfer (code, amount, fromAccount, toAccount, params?)fetchTransfers
fetch a history of internal transfers made on an account
Kind: instance method of phemex
Returns: Array<object> - a list of transfer structures
See: https://phemex-docs.github.io/#query-transfer-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code of the currency transferred |
| since | int | No | the earliest time in ms to fetch transfers for |
| limit | int | No | the maximum number of transfers structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchTransfers (code, since?, limit?, params?)fetchFundingRateHistory
fetches historical funding rate prices
Kind: instance method of phemex
Returns: Array<object> - a list of funding rate structures
See: https://phemex-docs.github.io/#query-funding-rate-history-2
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters |
| params.until | int | No | timestamp in ms of the latest funding rate |
phemex.fetchFundingRateHistory (symbol, since?, limit?, params?)withdraw
make a withdrawal
Kind: instance method of phemex
Returns: object - a transaction structure
See: https://phemex-docs.github.io/#create-withdraw-request
| 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 |
| tag | string | Yes | |
| params | object | No | extra parameters specific to the phemex api endpoint |
| params.network | string | No | unified network code |
phemex.withdraw (code, amount, address, tag, params?)fetchOpenInterest
retrieves the open interest of a trading pair
Kind: instance method of phemex
Returns: object - an open interest structure/docs/manual#open-interest-structure
See: https://phemex-docs.github.io/#query-24-hours-ticker
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified CCXT market symbol |
| params | object | No | exchange specific parameters |
phemex.fetchOpenInterest (symbol, params?)fetchConvertQuote
fetch a quote for converting from one currency to another
Kind: instance method of phemex
Returns: object - a conversion structure
See: https://phemex-docs.github.io/#rfq-quote
| Param | Type | Required | Description |
|---|---|---|---|
| fromCode | string | Yes | the currency that you want to sell and convert from |
| toCode | string | Yes | the currency that you want to buy and convert into |
| amount | float | Yes | how much you want to trade in units of the from currency |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.fetchConvertQuote (fromCode, toCode, amount, params?)createConvertTrade
convert from one currency to another
Kind: instance method of phemex
Returns: object - a conversion structure
See: https://phemex-docs.github.io/#convert
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the id of the trade that you want to make |
| fromCode | string | Yes | the currency that you want to sell and convert from |
| toCode | string | Yes | the currency that you want to buy and convert into |
| amount | float | No | how much you want to trade in units of the from currency |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.createConvertTrade (id, fromCode, toCode, amount?, params?)fetchConvertTradeHistory
fetch the users history of conversion trades
Kind: instance method of phemex
Returns: Array<object> - a list of conversion structures
See: https://phemex-docs.github.io/#query-convert-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | No | the unified currency code |
| since | int | No | the earliest time in ms to fetch conversions for |
| limit | int | No | the maximum number of conversion structures to retrieve, default 20, max 200 |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | string | No | the end time in ms |
| params.fromCurrency | string | No | the currency that you sold and converted from |
| params.toCurrency | string | No | the currency that you bought and converted into |
phemex.fetchConvertTradeHistory (code?, since?, limit?, params?)fetchPositionADLRank
fetches the auto deleveraging rank and risk percentage for a list of symbols
Kind: instance method of phemex
Returns: object - an array of auto de leverage structures
See
- https://phemex-docs.github.io/#query-account-positions
- https://phemex-docs.github.io/#query-trading-account-and-positions
- https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | list of unified market symbols |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.code | string | No | the currency code to fetch ranks for, USD, BTC or USDT, USDT is the default |
| params.method | string | No | USDT contracts only 'privateGetGAccountsAccountPositions' or 'privateGetGAccountsAccountPositions' default is 'privateGetGAccountsAccountPositions' |
phemex.fetchPositionADLRank (symbols?, params?)watchBalance
watch balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of phemex
Returns: object - a balance structure
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-account-order-position-aop
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-account-order-position-aop
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-wallet-order-messages
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.settle | string | No | set to USDT to use hedged perpetual api |
phemex.watchBalance (params?)watchTicker
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of phemex
Returns: object - a ticker structure
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-24-hours-ticker
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-24-hours-ticker
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-24-hours-ticker
| 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 |
phemex.watchTicker (symbol, params?)watchTickers
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
Kind: instance method of phemex
Returns: object - a ticker structure
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-24-hours-ticker
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-24-hours-ticker
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-24-hours-ticker
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers |
phemex.watchTickers (symbols?, params?)watchTrades
get the list of most recent trades for a particular symbol
Kind: instance method of phemex
Returns: Array<object> - a list of trade structures
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-trade
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-trade
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-trade
| 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 amount of trades to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.watchTrades (symbol, since?, limit?, params?)watchOrderBook
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of phemex
Returns: object - A dictionary of order book structures indexed by market symbols
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.watchOrderBook (symbol, limit?, params?)watchOHLCV
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of phemex
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-kline
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-kline
- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-kline
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.watchOHLCV (symbol, timeframe, since?, limit?, params?)watchMyTrades
watches information on multiple trades made by the user
Kind: instance method of phemex
Returns: Array<object> - a list of trade structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market trades were made in |
| since | int | No | the earliest time in ms to fetch trades for |
| limit | int | No | the maximum number of trade structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.watchMyTrades (symbol, since?, limit?, params?)watchOrders
watches information on multiple orders made by the user
Kind: instance method of phemex
Returns: Array<object> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
phemex.watchOrders (symbol, since?, limit?, params?)