Skip to content

Latest commit

 

History

History
132 lines (100 loc) · 8.91 KB

TradeApi.md

File metadata and controls

132 lines (100 loc) · 8.91 KB

TradeApi

All URIs are relative to https://www.bitmex.com/api/v1

Method HTTP request Description
tradeGet GET /trade Get Trades.
tradeGetBucketed GET /trade/bucketed Get previous trades in time buckets.

tradeGet

List<Trade> tradeGet(symbol, filter, columns, count, start, reverse, startTime, endTime)

Get Trades.

Please note that indices (symbols starting with `.`) post trades at intervals to the trade feed. These have a `size` of 0 and are used only to indicate a changing price. See the FIX Spec for explanations of these fields.

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.TradeApi;


TradeApi apiInstance = new TradeApi();
String symbol = "symbol_example"; // String | Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`.  Symbols are case-insensitive.
String 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.
String 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.
Integer count = 100; // Integer | Number of results to fetch. Must be a positive integer.
Integer start = 0; // Integer | Starting point for results.
Boolean reverse = false; // Boolean | If true, will sort results newest first.
OffsetDateTime startTime = OffsetDateTime.now(); // OffsetDateTime | Starting date filter for results.
OffsetDateTime endTime = OffsetDateTime.now(); // OffsetDateTime | Ending date filter for results.
try {
    List<Trade> result = apiInstance.tradeGet(symbol, filter, columns, count, start, reverse, startTime, endTime);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TradeApi#tradeGet");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
symbol String Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`. Symbols are case-insensitive. [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 Integer Number of results to fetch. Must be a positive integer. [optional] [default to 100]
start Integer Starting point for results. [optional] [default to 0]
reverse Boolean If true, will sort results newest first. [optional] [default to false]
startTime OffsetDateTime Starting date filter for results. [optional]
endTime OffsetDateTime Ending date filter for results. [optional]

Return type

List<Trade>

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

tradeGetBucketed

List<TradeBin> tradeGetBucketed(binSize, partial, symbol, filter, columns, count, start, reverse, startTime, endTime)

Get previous trades in time buckets.

Timestamps returned by our bucketed endpoints are the end of the period, indicating when the bucket was written to disk. Some other common systems use the timestamp as the beginning of the period. Please be aware of this when using this endpoint. Also note the `open` price is equal to the `close` price of the previous timeframe bucket.

Example

// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.TradeApi;


TradeApi apiInstance = new TradeApi();
String binSize = "1m"; // String | Time interval to bucket by. Available options: [1m,5m,1h,1d].
Boolean partial = false; // Boolean | If true, will send in-progress (incomplete) bins for the current time period.
String symbol = "symbol_example"; // String | Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`.  Symbols are case-insensitive.
String 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.
String 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.
Integer count = 100; // Integer | Number of results to fetch. Must be a positive integer.
Integer start = 0; // Integer | Starting point for results.
Boolean reverse = false; // Boolean | If true, will sort results newest first.
OffsetDateTime startTime = OffsetDateTime.now(); // OffsetDateTime | Starting date filter for results.
OffsetDateTime endTime = OffsetDateTime.now(); // OffsetDateTime | Ending date filter for results.
try {
    List<TradeBin> result = apiInstance.tradeGetBucketed(binSize, partial, symbol, filter, columns, count, start, reverse, startTime, endTime);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TradeApi#tradeGetBucketed");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
binSize String Time interval to bucket by. Available options: [1m,5m,1h,1d]. [optional] [default to 1m]
partial Boolean If true, will send in-progress (incomplete) bins for the current time period. [optional] [default to false]
symbol String Instrument symbol. Send a bare series (e.g. XBT) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. `XBT:quarterly`. Timeframes are `nearest`, `daily`, `weekly`, `monthly`, `quarterly`, `biquarterly`, and `perpetual`. Symbols are case-insensitive. [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 Integer Number of results to fetch. Must be a positive integer. [optional] [default to 100]
start Integer Starting point for results. [optional] [default to 0]
reverse Boolean If true, will sort results newest first. [optional] [default to false]
startTime OffsetDateTime Starting date filter for results. [optional]
endTime OffsetDateTime Ending date filter for results. [optional]

Return type

List<TradeBin>

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