Skip to content

Latest commit

 

History

History
164 lines (129 loc) · 10.8 KB

ExecutionApi.md

File metadata and controls

164 lines (129 loc) · 10.8 KB

bitmex_client.ExecutionApi

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

Method HTTP request Description
execution_get GET /execution Get all raw executions for your account.
execution_get_trade_history GET /execution/tradeHistory Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.

execution_get

list[Execution] execution_get(symbol=symbol, filter=filter, columns=columns, count=count, start=start, reverse=reverse, start_time=start_time, end_time=end_time)

Get all raw executions for your account.

This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at /execution/tradeHistory. You may also use the filter param to target your query. Specify an array as a filter value, such as {\"execType\": [\"Settlement\", \"Trade\"]} to filter on multiple values. See the FIX Spec for explanations of these fields.

Example

from __future__ import print_function
import time
import bitmex_client
from bitmex_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiKey
configuration = bitmex_client.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: apiNonce
configuration = bitmex_client.Configuration()
configuration.api_key['api-nonce'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-nonce'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = bitmex_client.Configuration()
configuration.api_key['api-signature'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-signature'] = 'Bearer'

# create an instance of the API class
api_instance = bitmex_client.ExecutionApi(bitmex_client.ApiClient(configuration))
symbol = 'symbol_example' # str | 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 = 'filter_example' # str | 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. (optional)
columns = 'columns_example' # str | 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 = 100 # float | Number of results to fetch. (optional) (default to 100)
start = 0 # float | Starting point for results. (optional) (default to 0)
reverse = false # bool | If true, will sort results newest first. (optional) (default to false)
start_time = '2013-10-20T19:20:30+01:00' # datetime | Starting date filter for results. (optional)
end_time = '2013-10-20T19:20:30+01:00' # datetime | Ending date filter for results. (optional)

try: 
    # Get all raw executions for your account.
    api_response = api_instance.execution_get(symbol=symbol, filter=filter, columns=columns, count=count, start=start, reverse=reverse, start_time=start_time, end_time=end_time)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ExecutionApi->execution_get: %s\n" % e)

Parameters

Name Type Description Notes
symbol str 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 str 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 for more details. [optional]
columns str 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 float Number of results to fetch. [optional] [default to 100]
start float Starting point for results. [optional] [default to 0]
reverse bool If true, will sort results newest first. [optional] [default to false]
start_time datetime Starting date filter for results. [optional]
end_time datetime Ending date filter for results. [optional]

Return type

list[Execution]

Authorization

apiKey, apiNonce, apiSignature

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

execution_get_trade_history

list[Execution] execution_get_trade_history(symbol=symbol, filter=filter, columns=columns, count=count, start=start, reverse=reverse, start_time=start_time, end_time=end_time)

Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.

Example

from __future__ import print_function
import time
import bitmex_client
from bitmex_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiKey
configuration = bitmex_client.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-key'] = 'Bearer'
# Configure API key authorization: apiNonce
configuration = bitmex_client.Configuration()
configuration.api_key['api-nonce'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-nonce'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = bitmex_client.Configuration()
configuration.api_key['api-signature'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api-signature'] = 'Bearer'

# create an instance of the API class
api_instance = bitmex_client.ExecutionApi(bitmex_client.ApiClient(configuration))
symbol = 'symbol_example' # str | 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 = 'filter_example' # str | 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. (optional)
columns = 'columns_example' # str | 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 = 100 # float | Number of results to fetch. (optional) (default to 100)
start = 0 # float | Starting point for results. (optional) (default to 0)
reverse = false # bool | If true, will sort results newest first. (optional) (default to false)
start_time = '2013-10-20T19:20:30+01:00' # datetime | Starting date filter for results. (optional)
end_time = '2013-10-20T19:20:30+01:00' # datetime | Ending date filter for results. (optional)

try: 
    # Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.
    api_response = api_instance.execution_get_trade_history(symbol=symbol, filter=filter, columns=columns, count=count, start=start, reverse=reverse, start_time=start_time, end_time=end_time)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ExecutionApi->execution_get_trade_history: %s\n" % e)

Parameters

Name Type Description Notes
symbol str 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 str 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 for more details. [optional]
columns str 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 float Number of results to fetch. [optional] [default to 100]
start float Starting point for results. [optional] [default to 0]
reverse bool If true, will sort results newest first. [optional] [default to false]
start_time datetime Starting date filter for results. [optional]
end_time datetime Ending date filter for results. [optional]

Return type

list[Execution]

Authorization

apiKey, apiNonce, apiSignature

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]