33 KiB
cex{docsify-ignore}
Kind: global class
Extends: Exchange
- fetchCurrencies
- fetchMarkets
- fetchTime
- fetchTicker
- fetchTickers
- fetchTrades
- fetchOrderBook
- fetchOHLCV
- fetchTradingFees
- fetchBalance
- fetchOrders
- fetchClosedOrders
- fetchOpenOrders
- fetchOpenOrder
- fetchClosedOrder
- createOrder
- cancelOrder
- cancelAllOrders
- fetchLedger
- fetchDepositsWithdrawals
- transfer
- fetchDepositAddress
- watchBalance
- watchTrades
- watchTicker
- watchTickers
- fetchTickerWs
- fetchBalanceWs
- watchOrders
- watchMyTrades
- watchOrderBook
- watchOHLCV
- fetchOrderWs
- fetchOpenOrdersWs
- createOrderWs
- editOrderWs
- cancelOrderWs
- cancelOrdersWs
fetchCurrencies{docsify-ignore}
fetches all available currencies on an exchange
Kind: instance method of cex
Returns: dict - an associative dictionary of currencies
See: https://trade.cex.io/docs/#rest-public-api-calls-currencies-info
| Param | Type | Required | Description |
|---|---|---|---|
| params | dict |
No | extra parameters specific to the exchange API endpoint |
cex.fetchCurrencies ([params])
fetchMarkets{docsify-ignore}
retrieves data on all markets for ace
Kind: instance method of cex
Returns: Array<object> - an array of objects representing market data
See: https://trade.cex.io/docs/#rest-public-api-calls-pairs-info
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchMarkets ([params])
fetchTime{docsify-ignore}
fetches the current integer timestamp in milliseconds from the exchange server
Kind: instance method of cex
Returns: int - the current integer timestamp in milliseconds from the exchange server
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchTime ([params])
fetchTicker{docsify-ignore}
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of cex
Returns: object - a dictionary of ticker structures
See: https://trade.cex.io/docs/#rest-public-api-calls-ticker
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchTicker (symbol[, params])
fetchTickers{docsify-ignore}
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of cex
Returns: object - a dictionary of ticker structures
See: https://trade.cex.io/docs/#rest-public-api-calls-ticker
| 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 |
cex.fetchTickers (symbols[, params])
fetchTrades{docsify-ignore}
get the list of most recent trades for a particular symbol
Kind: instance method of cex
Returns: Array<Trade> - a list of trade structures
See: https://trade.cex.io/docs/#rest-public-api-calls-trade-history
| 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 |
| params.until | int |
No | timestamp in ms of the latest entry |
cex.fetchTrades (symbol[, since, limit, params])
fetchOrderBook{docsify-ignore}
fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of cex
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://trade.cex.io/docs/#rest-public-api-calls-order-book
| 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 |
cex.fetchOrderBook (symbol[, limit, params])
fetchOHLCV{docsify-ignore}
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of cex
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://trade.cex.io/docs/#rest-public-api-calls-candles
| 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 |
| params.until | int |
No | timestamp in ms of the latest entry |
cex.fetchOHLCV (symbol, timeframe[, since, limit, params])
fetchTradingFees{docsify-ignore}
fetch the trading fees for multiple markets
Kind: instance method of cex
Returns: object - a dictionary of fee structures indexed by market symbols
See: https://trade.cex.io/docs/#rest-public-api-calls-candles
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchTradingFees ([params])
fetchBalance{docsify-ignore}
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of cex
Returns: object - a balance structure
See: https://trade.cex.io/docs/#rest-private-api-calls-account-status-v3
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.method | object |
No | 'privatePostGetMyWalletBalance' or 'privatePostGetMyAccountStatusV3' |
| params.account | object |
No | in case 'privatePostGetMyAccountStatusV3' is chosen, this can specify the account name (default is empty string) |
cex.fetchBalance ([params])
fetchOrders{docsify-ignore}
fetches information on multiple orders made by the user
Kind: instance method of cex
Returns: Array<Order> - a list of order structures
See: https://trade.cex.io/docs/#rest-private-api-calls-orders
| Param | Type | Required | Description |
|---|---|---|---|
| status | string |
Yes | order status to fetch for |
| 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.until | int |
No | timestamp in ms of the latest entry |
cex.fetchOrders (status, symbol[, since, limit, params])
fetchClosedOrders{docsify-ignore}
fetches information on multiple canceled orders made by the user
Kind: instance method of cex
Returns: object - a list of order structures
See: https://trade.cex.io/docs/#rest-private-api-calls-orders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | timestamp in ms of the earliest order, default is undefined |
| limit | int |
No | max number of orders to return, default is undefined |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchClosedOrders (symbol[, since, limit, params])
fetchOpenOrders{docsify-ignore}
fetches information on multiple canceled orders made by the user
Kind: instance method of cex
Returns: object - a list of order structures
See: https://trade.cex.io/docs/#rest-private-api-calls-orders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | timestamp in ms of the earliest order, default is undefined |
| limit | int |
No | max number of orders to return, default is undefined |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchOpenOrders (symbol[, since, limit, params])
fetchOpenOrder{docsify-ignore}
fetches information on an open order made by the user
Kind: instance method of cex
Returns: object - an order structure
See: https://trade.cex.io/docs/#rest-private-api-calls-orders
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | order id |
| symbol | string |
No | unified symbol of the market the order was made in |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchOpenOrder (id[, symbol, params])
fetchClosedOrder{docsify-ignore}
fetches information on an closed order made by the user
Kind: instance method of cex
Returns: object - an order structure
See: https://trade.cex.io/docs/#rest-private-api-calls-orders
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | order id |
| symbol | string |
No | unified symbol of the market the order was made in |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchClosedOrder (id[, symbol, params])
createOrder{docsify-ignore}
create a trade order
Kind: instance method of cex
Returns: object - an order structure
See: https://trade.cex.io/docs/#rest-private-api-calls-new-order
| 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.accountId | string |
No | account-id to use (default is empty string) |
| params.triggerPrice | float |
No | the price at which a trigger order is triggered at |
cex.createOrder (symbol, type, side, amount[, price, params])
cancelOrder{docsify-ignore}
cancels an open order
Kind: instance method of cex
Returns: object - An order structure
See: https://trade.cex.io/docs/#rest-private-api-calls-cancel-order
| 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 |
cex.cancelOrder (id, symbol[, params])
cancelAllOrders{docsify-ignore}
cancel all open orders in a market
Kind: instance method of cex
Returns: Array<object> - a list of order structures
See: https://trade.cex.io/docs/#rest-private-api-calls-cancel-all-orders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.cancelAllOrders (symbol[, params])
fetchLedger{docsify-ignore}
fetch the history of changes, actions done by the user or operations that altered the balance of the user
Kind: instance method of cex
Returns: object - a ledger structure
See: https://trade.cex.io/docs/#rest-private-api-calls-transaction-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
No | unified currency code |
| since | int |
No | timestamp in ms of the earliest ledger entry |
| limit | int |
No | max number of ledger entries to return |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.until | int |
No | timestamp in ms of the latest ledger entry |
cex.fetchLedger ([code, since, limit, params])
fetchDepositsWithdrawals{docsify-ignore}
fetch history of deposits and withdrawals
Kind: instance method of cex
Returns: object - a list of transaction structure
See: https://trade.cex.io/docs/#rest-private-api-calls-funding-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
No | unified currency code for the currency of the deposit/withdrawals, default is undefined |
| since | int |
No | timestamp in ms of the earliest deposit/withdrawal, default is undefined |
| limit | int |
No | max number of deposit/withdrawals to return, default is undefined |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.fetchDepositsWithdrawals ([code, since, limit, params])
transfer{docsify-ignore}
transfer currency internally between wallets on the same account
Kind: instance method of cex
Returns: object - a transfer structure
See: https://trade.cex.io/docs/#rest-private-api-calls-internal-transfer
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
Yes | unified currency code |
| amount | float |
Yes | amount to transfer |
| fromAccount | string |
Yes | 'SPOT', 'FUND', or 'CONTRACT' |
| toAccount | string |
Yes | 'SPOT', 'FUND', or 'CONTRACT' |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.transfer (code, amount, fromAccount, toAccount[, params])
fetchDepositAddress{docsify-ignore}
fetch the deposit address for a currency associated with this account
Kind: instance method of cex
Returns: object - an address structure
See: https://trade.cex.io/docs/#rest-private-api-calls-deposit-address
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
Yes | unified currency code |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.accountId | string |
No | account-id (default to empty string) to refer to (at this moment, only sub-accounts allowed by exchange) |
cex.fetchDepositAddress (code[, params])
watchBalance{docsify-ignore}
watch balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of cex
Returns: object - a balance structure
See: https://cex.io/websocket-api#get-balance
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.watchBalance ([params])
watchTrades{docsify-ignore}
get the list of most recent trades for a particular symbol. Note: can only watch one symbol at a time.
Kind: instance method of cex
Returns: Array<object> - a list of trade structures
See: https://cex.io/websocket-api#old-pair-room
| 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 |
cex.watchTrades (symbol[, since, limit, params])
watchTicker{docsify-ignore}
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of cex
Returns: object - a ticker structure
See: https://cex.io/websocket-api#ticker-subscription
| 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 |
| params.method | string |
No | public or private |
cex.watchTicker (symbol[, params])
watchTickers{docsify-ignore}
watches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of cex
Returns: object - a dictionary of ticker structures
See: https://cex.io/websocket-api#ticker-subscription
| 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 |
cex.watchTickers (symbols[, params])
fetchTickerWs{docsify-ignore}
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of cex
Returns: object - a ticker structure
See: https://docs.cex.io/#ws-api-ticker-deprecated
| 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 cex api endpoint |
cex.fetchTickerWs (symbol[, params])
fetchBalanceWs{docsify-ignore}
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of cex
Returns: object - a balance structure
See: https://docs.cex.io/#ws-api-get-balance
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the cex api endpoint |
cex.fetchBalanceWs ([params])
watchOrders{docsify-ignore}
get the list of orders associated with the user. Note: In CEX.IO system, orders can be present in trade engine or in archive database. There can be time periods (~2 seconds or more), when order is done/canceled, but still not moved to archive database. That means, you cannot see it using calls: archived-orders/open-orders.
Kind: instance method of cex
Returns: Array<object> - a list of trade structures
See: https://docs.cex.io/#ws-api-open-orders
| 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 |
cex.watchOrders (symbol[, since, limit, params])
watchMyTrades{docsify-ignore}
get the list of trades associated with the user. Note: In CEX.IO system, orders can be present in trade engine or in archive database. There can be time periods (~2 seconds or more), when order is done/canceled, but still not moved to archive database. That means, you cannot see it using calls: archived-orders/open-orders.
Kind: instance method of cex
Returns: Array<object> - a list of trade structures
See: https://docs.cex.io/#ws-api-open-orders
| 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 |
cex.watchMyTrades (symbol[, since, limit, params])
watchOrderBook{docsify-ignore}
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of cex
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://cex.io/websocket-api#orderbook-subscribe
| 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 |
cex.watchOrderBook (symbol[, limit, params])
watchOHLCV{docsify-ignore}
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market. It will return the last 120 minutes with the selected timeframe and then 1m candle updates after that.
Kind: instance method of cex
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://cex.io/websocket-api#minute-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 |
| params | object |
No | extra parameters specific to the exchange API endpoint |
cex.watchOHLCV (symbol, timeframe[, since, limit, params])
fetchOrderWs{docsify-ignore}
fetches information on an order made by the user
Kind: instance method of cex
Returns: object - An order structure
See: https://docs.cex.io/#ws-api-get-order
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | the order id |
| symbol | string |
Yes | not used by cex fetchOrder |
| params | object |
No | extra parameters specific to the cex api endpoint |
cex.fetchOrderWs (id, symbol[, params])
fetchOpenOrdersWs{docsify-ignore}
fetch all unfilled currently open orders
Kind: instance method of cex
Returns: Array<Order> - a list of order structures
See: https://docs.cex.io/#ws-api-open-orders
| 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 orders structures to retrieve |
| params | object |
No | extra parameters specific to the cex api endpoint |
cex.fetchOpenOrdersWs (symbol[, since, limit, params])
createOrderWs{docsify-ignore}
create a trade order
Kind: instance method of cex
Returns: object - an order structure
See: https://docs.cex.io/#ws-api-order-placement
| 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 |
Yes | 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 kraken api endpoint |
| params.maker_only | boolean |
No | Optional, maker only places an order only if offers best sell (<= max) or buy(>= max) price for this pair, if not order placement will be rejected with an error - "Order is not maker" |
cex.createOrderWs (symbol, type, side, amount, price[, params])
editOrderWs{docsify-ignore}
edit a trade order
Kind: instance method of cex
Returns: object - an order structure
See: https://docs.cex.io/#ws-api-cancel-replace
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | 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 the currency you want to trade in units of the base currency |
| price | float, undefined |
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 cex api endpoint |
cex.editOrderWs (id, symbol, type, side, amount[, price, params])
cancelOrderWs{docsify-ignore}
cancels an open order
Kind: instance method of cex
Returns: object - An order structure
See: https://docs.cex.io/#ws-api-order-cancel
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | order id |
| symbol | string |
Yes | not used by cex cancelOrder () |
| params | object |
No | extra parameters specific to the cex api endpoint |
cex.cancelOrderWs (id, symbol[, params])
cancelOrdersWs{docsify-ignore}
cancel multiple orders
Kind: instance method of cex
Returns: object - a list of order structures
See: https://docs.cex.io/#ws-api-mass-cancel-place
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> |
Yes | order ids |
| symbol | string |
Yes | not used by cex cancelOrders() |
| params | object |
No | extra parameters specific to the cex api endpoint |
cex.cancelOrdersWs (ids, symbol[, params])