Gather Cryptocurrency derivative trades using Deribit API v2
Explore the docs »
See code
The deribit_historical_trades repository gathers cryptocurrency (BTC, ETH, SOL, USDC) derivatives traded on the cryptocurrency derivative platform Deribit. All crypto derivatives trades since the start of the platform are publicly available in the Deribit API v2.1.1 under 'https://history.deribit.com/api/v2/public/get_last_trades_by_currency' using REST requests. For further information and the documentations see https://docs.deribit.com/#public-get_last_trades_by_currency_and_time.
To use this script, you will need to have Python 3 and the following libraries installed:
- json
- requests
- pandas
- datetime
-
Open the script (Deribit_derivative_data.py) in your preferred Python editor.
-
Ensure that the required libraries are installed.
-
Set the query parameters for the API endpoint in the function derivative_data():
derivative_data(currency, start_date, end_date, kind = 'any', count = 10000)
-
Run the script.
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
currency | true | string | BTC ETH SOL USDC |
The currency symbol |
start_date | true | datetime object | The earliest datetime object to return result for | |
end_date | true | datetime object | The most recent datetime object to return result for | |
kind | false | string | future option future_combo option_combo combo any |
Instrument kind, combo for any combo or any for all. If not provided instruments of all kinds are considered |
count | false | integer | Number of requested items, default - 10000 |
If you find a bug or would like to suggest an enhancement, please create an issue or submit a pull request. We welcome any contributions or feedback to make this script more useful and user-friendly for the cryptocurrency community.