wiki/exchanges/derive.md
<a name="derive" id="derive"></a>
Kind: global class
Extends: <code>Exchange</code>
<a name="fetchTime" id="fetchtime"></a>
fetches the current integer timestamp in milliseconds from the exchange server
Kind: instance method of <code>derive</code>
Returns: <code>int</code> - the current integer timestamp in milliseconds from the exchange server
See: https://docs.derive.xyz/reference/post_public-get-time
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchTime ([params])
<a name="fetchCurrencies" id="fetchcurrencies"></a>
fetches all available currencies on an exchange
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - an associative dictionary of currencies
See: https://docs.derive.xyz/reference/post_public-get-all-currencies
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchCurrencies ([params])
<a name="fetchMarkets" id="fetchmarkets"></a>
retrieves data on all markets for bybit
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - an array of objects representing market data
See: https://docs.derive.xyz/reference/post_public-get-all-instruments
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchMarkets ([params])
<a name="fetchTicker" id="fetchticker"></a>
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>derive</code>
Returns: <code>object</code> - a ticker structure
See: https://docs.derive.xyz/reference/post_public-get-ticker
| 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 |
derive.fetchTicker (symbol[, params])
<a name="fetchTrades" id="fetchtrades"></a>
get the list of most recent trades for a particular symbol
Kind: instance method of <code>derive</code>
Returns: <code>Array<Trade></code> - a list of trade structures
See: https://docs.derive.xyz/reference/post_public-get-trade-history
| 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.until | <code>int</code> | No | the latest time in ms to fetch trades for |
derive.fetchTrades (symbol[, since, limit, params])
<a name="fetchFundingRateHistory" id="fetchfundingratehistory"></a>
fetches historical funding rate prices
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of funding rate structures
See: https://docs.derive.xyz/reference/post_public-get-funding-rate-history
| 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 to fetch |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchFundingRateHistory (symbol[, since, limit, params])
<a name="fetchFundingRate" id="fetchfundingrate"></a>
fetch the current funding rate
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - a funding rate structure
See: https://docs.derive.xyz/reference/post_public-get-funding-rate-history
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchFundingRate (symbol[, params])
<a name="createOrder" id="createorder"></a>
create a trade order
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - an order structure
See: https://docs.derive.xyz/reference/post_private-order
| 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.subaccount_id | <code>string</code> | No | required the subaccount id |
| params.triggerPrice | <code>float</code> | No | The price a trigger order is triggered at |
| params.takeProfit | <code>object</code> | No | takeProfit object in params containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) |
| params.takeProfit.triggerPrice | <code>float</code> | No | take profit trigger price |
| params.stopLoss | <code>object</code> | No | stopLoss object in params containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) |
| params.stopLoss.triggerPrice | <code>float</code> | No | stop loss trigger price |
| params.max_fee | <code>float</code> | No | required the maximum fee you are willing to pay for the order |
derive.createOrder (symbol, type, side, amount[, price, params])
<a name="editOrder" id="editorder"></a>
edit a trade order
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - an order structure
See: https://docs.derive.xyz/reference/post_private-replace
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| 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.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.editOrder (id, symbol, type, side, amount[, price, params])
<a name="cancelOrder" id="cancelorder"></a>
cancels an open order
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - An order structure
See: https://docs.derive.xyz/reference/post_private-cancel
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | 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 |
| params.trigger | <code>boolean</code> | No | whether the order is a trigger/algo order |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.cancelOrder (id, symbol[, params])
<a name="cancelAllOrders" id="cancelallorders"></a>
cancel all open orders in a market
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - an list of order structures
See
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.cancelAllOrders (symbol[, params])
<a name="fetchOrders" id="fetchorders"></a>
fetches information on multiple orders made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<Order></code> - a list of order structures
See: https://docs.derive.xyz/reference/post_private-get-orders
| 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.paginate | <code>boolean</code> | No | set to true if you want to fetch orders with pagination |
| params.trigger | <code>boolean</code> | No | whether the order is a trigger/algo order |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchOrders (symbol[, since, limit, params])
<a name="fetchOpenOrders" id="fetchopenorders"></a>
fetches information on multiple orders made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<Order></code> - a list of order structures
See: https://docs.derive.xyz/reference/post_private-get-orders
| 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.paginate | <code>boolean</code> | No | set to true if you want to fetch orders with pagination |
derive.fetchOpenOrders (symbol[, since, limit, params])
<a name="fetchClosedOrders" id="fetchclosedorders"></a>
fetches information on multiple orders made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<Order></code> - a list of order structures
See: https://docs.derive.xyz/reference/post_private-get-orders
| 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.paginate | <code>boolean</code> | No | set to true if you want to fetch orders with pagination |
derive.fetchClosedOrders (symbol[, since, limit, params])
<a name="fetchCanceledOrders" id="fetchcanceledorders"></a>
fetches information on multiple canceled orders made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://docs.derive.xyz/reference/post_private-get-orders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified market symbol of the market the 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.paginate | <code>boolean</code> | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters |
derive.fetchCanceledOrders (symbol[, since, limit, params])
<a name="fetchOrderTrades" id="fetchordertrades"></a>
fetch all the trades made from a single order
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of trade structures
See: https://docs.derive.xyz/reference/post_private-get-trade-history
| Param | Type | Required | Description |
|---|---|---|---|
| id | <code>string</code> | Yes | order id |
| 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 to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchOrderTrades (id, symbol[, since, limit, params])
<a name="fetchMyTrades" id="fetchmytrades"></a>
fetch all trades made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<Trade></code> - a list of trade structures
See: https://docs.derive.xyz/reference/post_private-get-trade-history
| 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 | set to true if you want to fetch trades with pagination |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchMyTrades (symbol[, since, limit, params])
<a name="fetchPositions" id="fetchpositions"></a>
fetch all open positions
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of position structure
See: https://docs.derive.xyz/reference/post_private-get-positions
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | <code>Array<string></code> | No | not used by kraken fetchPositions () |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchPositions ([symbols, params])
<a name="fetchFundingHistory" id="fetchfundinghistory"></a>
fetch the history of funding payments paid and received on this account
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - a funding history structure
See: https://docs.derive.xyz/reference/post_private-get-funding-history
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | No | unified market symbol |
| since | <code>int</code> | No | the earliest time in ms to fetch funding history for |
| limit | <code>int</code> | No | the maximum number of funding history 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 |
derive.fetchFundingHistory ([symbol, since, limit, params])
<a name="fetchBalance" id="fetchbalance"></a>
query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - a balance structure
See: https://docs.derive.xyz/reference/post_private-get-all-portfolios
| Param | Type | Required | Description |
|---|---|---|---|
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.fetchBalance ([params])
<a name="fetchDeposits" id="fetchdeposits"></a>
fetch all deposits made to an account
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of transaction structures
See: https://docs.derive.xyz/reference/post_private-get-deposit-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| since | <code>int</code> | No | the earliest time in ms to fetch deposits for |
| limit | <code>int</code> | No | the maximum number of deposits structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchDeposits (code[, since, limit, params])
<a name="fetchWithdrawals" id="fetchwithdrawals"></a>
fetch all withdrawals made from an account
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of transaction structures
See: https://docs.derive.xyz/reference/post_private-get-withdrawal-history
| Param | Type | Required | Description |
|---|---|---|---|
| code | <code>string</code> | Yes | unified currency code |
| since | <code>int</code> | No | the earliest time in ms to fetch withdrawals for |
| limit | <code>int</code> | No | the maximum number of withdrawals structures to retrieve |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.fetchWithdrawals (code[, since, limit, params])
<a name="watchOrderBook" id="watchorderbook"></a>
watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - A dictionary of order book structures indexed by market symbols
See: https://docs.derive.xyz/reference/orderbook-instrument_name-group-depth
| 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 |
derive.watchOrderBook (symbol[, limit, params])
<a name="watchTicker" id="watchticker"></a>
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>derive</code>
Returns: <code>object</code> - a ticker structure
See: https://docs.derive.xyz/reference/ticker-instrument_name-interval
| 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 |
derive.watchTicker (symbol[, params])
<a name="unWatchOrderBook" id="unwatchorderbook"></a>
unsubscribe from the orderbook channel
Kind: instance method of <code>derive</code>
Returns: <code>object</code> - A dictionary of order book structures indexed by market symbols
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to fetch the order book for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
| params.limit | <code>int</code> | No | orderbook limit, default is undefined |
derive.unWatchOrderBook (symbol[, params])
<a name="unWatchTrades" id="unwatchtrades"></a>
unsubscribe from the trades channel
Kind: instance method of <code>derive</code>
Returns: <code>any</code> - status of the unwatch request
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | <code>string</code> | Yes | unified symbol of the market to unwatch the trades for |
| params | <code>object</code> | No | extra parameters specific to the exchange API endpoint |
derive.unWatchTrades (symbol[, params])
<a name="watchTrades" id="watchtrades"></a>
watches information on multiple trades made in a market
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of trade structures
See: https://docs.derive.xyz/reference/trades-instrument_name
| 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 |
derive.watchTrades (symbol[, since, limit, params])
<a name="watchOrders" id="watchorders"></a>
watches information on multiple orders made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of order structures
See: https://docs.derive.xyz/reference/subaccount_id-orders
| 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.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.watchOrders (symbol[, since, limit, params])
<a name="watchMyTrades" id="watchmytrades"></a>
watches information on multiple trades made by the user
Kind: instance method of <code>derive</code>
Returns: <code>Array<object></code> - a list of trade structures
See: https://docs.derive.xyz/reference/subaccount_id-trades
| 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.subaccount_id | <code>string</code> | No | required the subaccount id |
derive.watchMyTrades (symbol[, since, limit, params])