Skip to content

Latest commit

 

History

History
228 lines (160 loc) · 8.43 KB

InstrumentApi.md

File metadata and controls

228 lines (160 loc) · 8.43 KB

BitMexApi.InstrumentApi

All URIs are relative to https://localhost/api/v1

Method HTTP request Description
instrumentGet GET /instrument Get instruments.
instrumentGetActive GET /instrument/active Get all active instruments and instruments that have expired in <24hrs.
instrumentGetActiveAndIndices GET /instrument/activeAndIndices Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.
instrumentGetActiveIntervals GET /instrument/activeIntervals Return all active contract series and interval pairs.
instrumentGetIndices GET /instrument/indices Get all price indices.

instrumentGet

[Instrument] instrumentGet(opts)

Get instruments.

This returns all instruments and indices, including those that have settled or are unlisted. Use this endpoint if you want to query for individual instruments or use a complex filter. Use `/instrument/active` to return active instruments, or use a filter like `{&quot;state&quot;: &quot;Open&quot;}`.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.InstrumentApi();

var opts = { 
  'symbol': "symbol_example", // String | Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
  'filter': "filter_example", // String | 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.
  'columns': "columns_example", // String | Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
  'count': 100, // Number | Number of results to fetch.
  'start': 0, // Number | Starting point for results.
  'reverse': false, // Boolean | If true, will sort results newest first.
  'startTime': new Date("2013-10-20"), // Date | Starting date filter for results.
  'endTime': new Date("2013-10-20") // Date | Ending date filter for results.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.instrumentGet(opts, callback);

Parameters

Name Type Description Notes
symbol String Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`. [optional]
filter String Generic table filter. Send JSON key/value pairs, such as `{&quot;key&quot;: &quot;value&quot;}`. You can key on individual fields, and do more advanced querying on timestamps. See the Timestamp Docs for more details. [optional]
columns String Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect. [optional]
count Number Number of results to fetch. [optional] [default to 100]
start Number Starting point for results. [optional] [default to 0]
reverse Boolean If true, will sort results newest first. [optional] [default to false]
startTime Date Starting date filter for results. [optional]
endTime Date Ending date filter for results. [optional]

Return type

[Instrument]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

instrumentGetActive

[Instrument] instrumentGetActive()

Get all active instruments and instruments that have expired in <24hrs.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.InstrumentApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.instrumentGetActive(callback);

Parameters

This endpoint does not need any parameter.

Return type

[Instrument]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

instrumentGetActiveAndIndices

[Instrument] instrumentGetActiveAndIndices()

Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.InstrumentApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.instrumentGetActiveAndIndices(callback);

Parameters

This endpoint does not need any parameter.

Return type

[Instrument]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

instrumentGetActiveIntervals

InstrumentInterval instrumentGetActiveIntervals()

Return all active contract series and interval pairs.

This endpoint is useful for determining which pairs are live. It returns two arrays of strings. The first is intervals, such as `[&quot;BVOL:daily&quot;, &quot;BVOL:weekly&quot;, &quot;XBU:daily&quot;, &quot;XBU:monthly&quot;, ...]`. These identifiers are usable in any query's `symbol` param. The second array is the current resolution of these intervals. Results are mapped at the same index.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.InstrumentApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.instrumentGetActiveIntervals(callback);

Parameters

This endpoint does not need any parameter.

Return type

InstrumentInterval

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

instrumentGetIndices

[Instrument] instrumentGetIndices()

Get all price indices.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.InstrumentApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.instrumentGetIndices(callback);

Parameters

This endpoint does not need any parameter.

Return type

[Instrument]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript