mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 08:18:07 +00:00
1019 lines
39 KiB
Markdown
1019 lines
39 KiB
Markdown
|
|
<a name="bitmex" id="bitmex"></a>
|
|
|
|
## bitmex{docsify-ignore}
|
|
**Kind**: global class
|
|
**Extends**: <code>Exchange</code>
|
|
|
|
* [fetchCurrencies](#fetchcurrencies)
|
|
* [fetchMarkets](#fetchmarkets)
|
|
* [fetchBalance](#fetchbalance)
|
|
* [fetchOrderBook](#fetchorderbook)
|
|
* [fetchOrder](#fetchorder)
|
|
* [fetchOrders](#fetchorders)
|
|
* [fetchOpenOrders](#fetchopenorders)
|
|
* [fetchClosedOrders](#fetchclosedorders)
|
|
* [fetchMyTrades](#fetchmytrades)
|
|
* [fetchLedger](#fetchledger)
|
|
* [fetchDepositsWithdrawals](#fetchdepositswithdrawals)
|
|
* [fetchTicker](#fetchticker)
|
|
* [fetchTickers](#fetchtickers)
|
|
* [fetchOHLCV](#fetchohlcv)
|
|
* [fetchTrades](#fetchtrades)
|
|
* [createOrder](#createorder)
|
|
* [cancelOrder](#cancelorder)
|
|
* [cancelOrders](#cancelorders)
|
|
* [cancelAllOrders](#cancelallorders)
|
|
* [cancelAllOrdersAfter](#cancelallordersafter)
|
|
* [fetchLeverages](#fetchleverages)
|
|
* [fetchPositions](#fetchpositions)
|
|
* [withdraw](#withdraw)
|
|
* [fetchFundingRates](#fetchfundingrates)
|
|
* [fetchFundingRateHistory](#fetchfundingratehistory)
|
|
* [setLeverage](#setleverage)
|
|
* [setMarginMode](#setmarginmode)
|
|
* [fetchDepositAddress](#fetchdepositaddress)
|
|
* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees)
|
|
* [fetchLiquidations](#fetchliquidations)
|
|
* [watchTicker](#watchticker)
|
|
* [watchTickers](#watchtickers)
|
|
* [watchLiquidations](#watchliquidations)
|
|
* [watchLiquidationsForSymbols](#watchliquidationsforsymbols)
|
|
* [watchBalance](#watchbalance)
|
|
* [watchTrades](#watchtrades)
|
|
* [watchPositions](#watchpositions)
|
|
* [watchOrders](#watchorders)
|
|
* [watchMyTrades](#watchmytrades)
|
|
* [watchOrderBook](#watchorderbook)
|
|
* [watchOrderBookForSymbols](#watchorderbookforsymbols)
|
|
* [watchTradesForSymbols](#watchtradesforsymbols)
|
|
* [watchOHLCV](#watchohlcv)
|
|
|
|
<a name="fetchCurrencies" id="fetchcurrencies"></a>
|
|
|
|
### fetchCurrencies{docsify-ignore}
|
|
fetches all available currencies on an exchange
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an associative dictionary of currencies
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchCurrencies ([params])
|
|
```
|
|
|
|
|
|
<a name="fetchMarkets" id="fetchmarkets"></a>
|
|
|
|
### fetchMarkets{docsify-ignore}
|
|
retrieves data on all markets for bitmex
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - an array of objects representing market data
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActive
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchMarkets ([params])
|
|
```
|
|
|
|
|
|
<a name="fetchBalance" id="fetchbalance"></a>
|
|
|
|
### fetchBalance{docsify-ignore}
|
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/User/User_getMargin
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchBalance ([params])
|
|
```
|
|
|
|
|
|
<a name="fetchOrderBook" id="fetchorderbook"></a>
|
|
|
|
### fetchOrderBook{docsify-ignore}
|
|
fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/OrderBook/OrderBook_getL2
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
|
|
| limit | <code>int</code> | No | the maximum amount of order book entries to return |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchOrderBook (symbol[, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchOrder" id="fetchorder"></a>
|
|
|
|
### fetchOrder{docsify-ignore}
|
|
fetches information on an order made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - An [order structure](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| id | <code>string</code> | Yes | the order id |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market the order was made in |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchOrder (id, symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchOrders" id="fetchorders"></a>
|
|
|
|
### fetchOrders{docsify-ignore}
|
|
fetches information on multiple orders made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Order></code> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch orders for |
|
|
| limit | <code>int</code> | No | the maximum number of order structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.until | <code>int</code> | No | the earliest time in ms to fetch orders for |
|
|
| params.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchOrders (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchOpenOrders" id="fetchopenorders"></a>
|
|
|
|
### fetchOpenOrders{docsify-ignore}
|
|
fetch all unfilled currently open orders
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Order></code> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch open orders for |
|
|
| limit | <code>int</code> | No | the maximum number of open orders structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchOpenOrders (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchClosedOrders" id="fetchclosedorders"></a>
|
|
|
|
### fetchClosedOrders{docsify-ignore}
|
|
fetches information on multiple closed orders made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Order></code> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch orders for |
|
|
| limit | <code>int</code> | No | the maximum number of order structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchClosedOrders (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchMyTrades" id="fetchmytrades"></a>
|
|
|
|
### fetchMyTrades{docsify-ignore}
|
|
fetch all trades made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Trade></code> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch trades for |
|
|
| limit | <code>int</code> | No | the maximum number of trades structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchMyTrades (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchLedger" id="fetchledger"></a>
|
|
|
|
### 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 [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [ledger structure](https://docs.ccxt.com/#/?id=ledger)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| code | <code>string</code> | No | unified currency code, default is undefined |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest ledger entry, default is undefined |
|
|
| limit | <code>int</code> | No | max number of ledger entries to return, default is undefined |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchLedger ([code, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchDepositsWithdrawals" id="fetchdepositswithdrawals"></a>
|
|
|
|
### fetchDepositsWithdrawals{docsify-ignore}
|
|
fetch history of deposits and withdrawals
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| code | <code>string</code> | No | unified currency code for the currency of the deposit/withdrawals, default is undefined |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined |
|
|
| limit | <code>int</code> | No | max number of deposit/withdrawals to return, default is undefined |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchDepositsWithdrawals ([code, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchTicker" id="fetchticker"></a>
|
|
|
|
### fetchTicker{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 [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the ticker for |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchTicker (symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchTickers" id="fetchtickers"></a>
|
|
|
|
### fetchTickers{docsify-ignore}
|
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code>, <code>undefined</code> | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchTickers (symbols[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchOHLCV" id="fetchohlcv"></a>
|
|
|
|
### 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 [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Array<int>></code> - A list of candles ordered as timestamp, open, high, low, close, volume
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch OHLCV data for |
|
|
| timeframe | <code>string</code> | Yes | the length of time each candle represents |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest candle to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of candles to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchOHLCV (symbol, timeframe[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="fetchTrades" id="fetchtrades"></a>
|
|
|
|
### fetchTrades{docsify-ignore}
|
|
get the list of most recent trades for a particular symbol
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Trade></code> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch trades for |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest trade to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of trades to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchTrades (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="createOrder" id="createorder"></a>
|
|
|
|
### createOrder{docsify-ignore}
|
|
create a trade order
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_new
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to create an order in |
|
|
| type | <code>string</code> | Yes | 'market' or 'limit' |
|
|
| side | <code>string</code> | Yes | 'buy' or 'sell' |
|
|
| amount | <code>float</code> | Yes | how much of currency you want to trade in units of base currency |
|
|
| price | <code>float</code> | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.triggerPrice | <code>object</code> | No | the price at which a trigger order is triggered at |
|
|
| params.triggerDirection | <code>object</code> | No | the direction whenever the trigger happens with relation to price - 'ascending' or 'descending' |
|
|
| params.trailingAmount | <code>float</code> | No | the quote amount to trail away from the current market price |
|
|
|
|
|
|
```javascript
|
|
bitmex.createOrder (symbol, type, side, amount[, price, params])
|
|
```
|
|
|
|
|
|
<a name="cancelOrder" id="cancelorder"></a>
|
|
|
|
### cancelOrder{docsify-ignore}
|
|
cancels an open order
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - An [order structure](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| id | <code>string</code> | Yes | order id |
|
|
| symbol | <code>string</code> | Yes | not used by bitmex cancelOrder () |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.cancelOrder (id, symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="cancelOrders" id="cancelorders"></a>
|
|
|
|
### cancelOrders{docsify-ignore}
|
|
cancel multiple orders
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| ids | <code>Array<string></code> | Yes | order ids |
|
|
| symbol | <code>string</code> | Yes | not used by bitmex cancelOrders () |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.cancelOrders (ids, symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="cancelAllOrders" id="cancelallorders"></a>
|
|
|
|
### cancelAllOrders{docsify-ignore}
|
|
cancel all open orders
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAll
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.cancelAllOrders (symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="cancelAllOrdersAfter" id="cancelallordersafter"></a>
|
|
|
|
### cancelAllOrdersAfter{docsify-ignore}
|
|
dead man's switch, cancel all orders after the given timeout
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - the api result
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAllAfter
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| timeout | <code>number</code> | Yes | time in milliseconds, 0 represents cancel the timer |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.cancelAllOrdersAfter (timeout[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchLeverages" id="fetchleverages"></a>
|
|
|
|
### fetchLeverages{docsify-ignore}
|
|
fetch the set leverage for all contract markets
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code> | No | a list of unified market symbols |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchLeverages ([symbols, params])
|
|
```
|
|
|
|
|
|
<a name="fetchPositions" id="fetchpositions"></a>
|
|
|
|
### fetchPositions{docsify-ignore}
|
|
fetch all open positions
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code>, <code>undefined</code> | Yes | list of unified market symbols |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchPositions (symbols[, params])
|
|
```
|
|
|
|
|
|
<a name="withdraw" id="withdraw"></a>
|
|
|
|
### withdraw{docsify-ignore}
|
|
make a withdrawal
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/User/User_requestWithdrawal
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| code | <code>string</code> | Yes | unified currency code |
|
|
| amount | <code>float</code> | Yes | the amount to withdraw |
|
|
| address | <code>string</code> | Yes | the address to withdraw to |
|
|
| tag | <code>string</code> | Yes | |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.withdraw (code, amount, address, tag[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchFundingRates" id="fetchfundingrates"></a>
|
|
|
|
### fetchFundingRates{docsify-ignore}
|
|
fetch the funding rate for multiple markets
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code>, <code>undefined</code> | Yes | list of unified market symbols |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchFundingRates (symbols[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchFundingRateHistory" id="fetchfundingratehistory"></a>
|
|
|
|
### fetchFundingRateHistory{docsify-ignore}
|
|
Fetches the history of funding rates
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Funding/Funding_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the funding rate history for |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest funding rate to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.until | <code>int</code> | No | timestamp in ms for ending date filter |
|
|
| params.reverse | <code>bool</code> | No | if true, will sort results newest first |
|
|
| params.start | <code>int</code> | No | starting point for results |
|
|
| params.columns | <code>string</code> | No | array of column names to fetch in info, if omitted, will return all columns |
|
|
| params.filter | <code>string</code> | No | generic table filter, send json key/value pairs, such as {"key": "value"}, you can key on individual fields, and do more advanced querying on timestamps, see the [timestamp docs](https://www.bitmex.com/app/restAPI#Timestamp-Filters) for more details |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchFundingRateHistory (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="setLeverage" id="setleverage"></a>
|
|
|
|
### setLeverage{docsify-ignore}
|
|
set the level of leverage for a market
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - response from the exchange
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_updateLeverage
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| leverage | <code>float</code> | Yes | the rate of leverage |
|
|
| symbol | <code>string</code> | Yes | unified market symbol |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.setLeverage (leverage, symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="setMarginMode" id="setmarginmode"></a>
|
|
|
|
### setMarginMode{docsify-ignore}
|
|
set margin mode to 'cross' or 'isolated'
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - response from the exchange
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_isolateMargin
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| marginMode | <code>string</code> | Yes | 'cross' or 'isolated' |
|
|
| symbol | <code>string</code> | Yes | unified market symbol |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.setMarginMode (marginMode, symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchDepositAddress" id="fetchdepositaddress"></a>
|
|
|
|
### fetchDepositAddress{docsify-ignore}
|
|
fetch the deposit address for a currency associated with this account
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an [address structure](https://docs.ccxt.com/#/?id=address-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/User/User_getDepositAddress
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| code | <code>string</code> | Yes | unified currency code |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
| params.network | <code>string</code> | No | deposit chain, can view all chains via this.publicGetWalletAssets, default is eth, unless the currency has a default chain within this.options['networks'] |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchDepositAddress (code[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchDepositWithdrawFees" id="fetchdepositwithdrawfees"></a>
|
|
|
|
### fetchDepositWithdrawFees{docsify-ignore}
|
|
fetch deposit and withdraw fees
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| codes | <code>Array<string></code>, <code>undefined</code> | Yes | list of unified currency codes |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchDepositWithdrawFees (codes[, params])
|
|
```
|
|
|
|
|
|
<a name="fetchLiquidations" id="fetchliquidations"></a>
|
|
|
|
### fetchLiquidations{docsify-ignore}
|
|
retrieves the public liquidations of a trading pair
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure)
|
|
|
|
**See**: https://www.bitmex.com/api/explorer/#!/Liquidation/Liquidation_get
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified CCXT market symbol |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch liquidations for |
|
|
| limit | <code>int</code> | No | the maximum number of liquidation structures to retrieve |
|
|
| params | <code>object</code> | No | exchange specific parameters for the bitmex api endpoint |
|
|
| params.until | <code>int</code> | No | timestamp in ms of the latest liquidation |
|
|
| params.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
|
|
|
|
|
|
```javascript
|
|
bitmex.fetchLiquidations (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchTicker" id="watchticker"></a>
|
|
|
|
### 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 [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the ticker for |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchTicker (symbol[, params])
|
|
```
|
|
|
|
|
|
<a name="watchTickers" id="watchtickers"></a>
|
|
|
|
### watchTickers{docsify-ignore}
|
|
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 [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code> | Yes | unified symbol of the market to fetch the ticker for |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchTickers (symbols[, params])
|
|
```
|
|
|
|
|
|
<a name="watchLiquidations" id="watchliquidations"></a>
|
|
|
|
### watchLiquidations{docsify-ignore}
|
|
watch the public liquidations of a trading pair
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Liquidation
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified CCXT market symbol |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch liquidations for |
|
|
| limit | <code>int</code> | No | the maximum number of liquidation structures to retrieve |
|
|
| params | <code>object</code> | No | exchange specific parameters for the bitmex api endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchLiquidations (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchLiquidationsForSymbols" id="watchliquidationsforsymbols"></a>
|
|
|
|
### watchLiquidationsForSymbols{docsify-ignore}
|
|
watch the public liquidations of a trading pair
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Liquidation
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code> | Yes | |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch liquidations for |
|
|
| limit | <code>int</code> | No | the maximum number of liquidation structures to retrieve |
|
|
| params | <code>object</code> | No | exchange specific parameters for the bitmex api endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchLiquidationsForSymbols (symbols[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchBalance" id="watchbalance"></a>
|
|
|
|
### watchBalance{docsify-ignore}
|
|
watch balance and get the amount of funds available for trading or funds locked in orders
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchBalance ([params])
|
|
```
|
|
|
|
|
|
<a name="watchTrades" id="watchtrades"></a>
|
|
|
|
### watchTrades{docsify-ignore}
|
|
get the list of most recent trades for a particular symbol
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch trades for |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest trade to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of trades to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchTrades (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchPositions" id="watchpositions"></a>
|
|
|
|
### watchPositions{docsify-ignore}
|
|
watch all open positions
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code>, <code>undefined</code> | Yes | list of unified market symbols |
|
|
| since | <code>int</code> | No | the earliest time in ms to watch positions for |
|
|
| limit | <code>int</code> | No | the maximum number of positions to retrieve |
|
|
| params | <code>object</code> | Yes | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchPositions (symbols[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchOrders" id="watchorders"></a>
|
|
|
|
### watchOrders{docsify-ignore}
|
|
watches information on multiple orders made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol of the market orders were made in |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch orders for |
|
|
| limit | <code>int</code> | No | the maximum number of order structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchOrders (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchMyTrades" id="watchmytrades"></a>
|
|
|
|
### watchMyTrades{docsify-ignore}
|
|
watches information on multiple trades made by the user
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified market symbol of the market trades were made in |
|
|
| since | <code>int</code> | No | the earliest time in ms to fetch trades for |
|
|
| limit | <code>int</code> | No | the maximum number of trade structures to retrieve |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchMyTrades (symbol[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchOrderBook" id="watchorderbook"></a>
|
|
|
|
### watchOrderBook{docsify-ignore}
|
|
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#OrderBookL2
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
|
|
| limit | <code>int</code> | No | the maximum amount of order book entries to return |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchOrderBook (symbol[, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchOrderBookForSymbols" id="watchorderbookforsymbols"></a>
|
|
|
|
### watchOrderBookForSymbols{docsify-ignore}
|
|
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>object</code> - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#OrderBookL2
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code> | Yes | unified array of symbols |
|
|
| limit | <code>int</code> | No | the maximum amount of order book entries to return |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchOrderBookForSymbols (symbols[, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchTradesForSymbols" id="watchtradesforsymbols"></a>
|
|
|
|
### watchTradesForSymbols{docsify-ignore}
|
|
get the list of most recent trades for a list of symbols
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<object></code> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades)
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbols | <code>Array<string></code> | Yes | unified symbol of the market to fetch trades for |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest trade to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of trades to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchTradesForSymbols (symbols[, since, limit, params])
|
|
```
|
|
|
|
|
|
<a name="watchOHLCV" id="watchohlcv"></a>
|
|
|
|
### watchOHLCV{docsify-ignore}
|
|
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
|
|
**Kind**: instance method of [<code>bitmex</code>](#bitmex)
|
|
**Returns**: <code>Array<Array<int>></code> - A list of candles ordered as timestamp, open, high, low, close, volume
|
|
|
|
**See**: https://www.bitmex.com/app/wsAPI#Subscriptions
|
|
|
|
| Param | Type | Required | Description |
|
|
| --- | --- | --- | --- |
|
|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch OHLCV data for |
|
|
| timeframe | <code>string</code> | Yes | the length of time each candle represents |
|
|
| since | <code>int</code> | No | timestamp in ms of the earliest candle to fetch |
|
|
| limit | <code>int</code> | No | the maximum amount of candles to fetch |
|
|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
|
|
|
|
|
|
```javascript
|
|
bitmex.watchOHLCV (symbol, timeframe[, since, limit, params])
|
|
```
|
|
|