CRYPTOCURRENCY

Ethereum: Understanding Kraken Trades API (market/limit)

Understanding of the API of Kraken Trades: a guide to the construction of historical data

As a seller or analyst, access to reliable and accurate historical data is crucial to make conscious decisions on your investments. However, when it comes to commercial platforms, such as Kraken, providing such data can be a significant challenge. In this article, we will examine the API Kraken Trades interface, which allows users to access historical commercial data using the Open Source Python library.

Why are historical data needed?

Historical data are necessary for various reasons:

  • To analyze price movements and identify trends

  • To set the purchase and sale signals based on market conditions

  • To optimize commercial strategies

Without reliable historical data, it may be difficult to make accurate forecasts regarding future market movements.

API of Kraken Trades: first steps

To start building your OHLC historical data from Kraken Trades, you need to take these steps:

  • Record an account : Create a free account on the Kraken website.

2.

With the help of the API, Kraken markets from Python

After accessing the API certificates, you can start building historical data using the following steps:

Step 1: Install the requested bookstores

To use the API Kraken Trades interface with Python, you need to install the “Request” library to send HTTP requests and the “Pandas” library to manipulate data.

`Bash

Pip installs Panda requests

`

passage 2: configure the API connection

Create a new file calledkraken_trades.pyis and add the following code:

`Python

Import requests

It matters Panda as PD

Configure the Cands API operations

Api_key = "Your_api_key"

Api_secret = 'Your_api_secret'

Configure the final point of the API

endpoint = f'https: //api.kraken.com/3/trades? Secret = {Api_Secret} & Key & Key = {Api_key} & Country = 1000 '

Send an GET request to the API's end point

Answer = Requests.get (end point)

Check if the answer has been successful

If the answer.status_code == 200:

Evapse the Json response to the data frame

DF = Pd.json_normalizza (Reply.json ())

DF

Otherwise:

Print (f'error: {Reply.text} ')

Do not return anyone

passage 3: filter and delete data

After receiving the data, it is necessary to filter and clean them before importing them into the favorite data format.

Python

Filter any incorrect or missing data

DF = DF [DF ['Time']> 0]

Convert the column "open" in a numerical type (float) if possible

DF ['Open'] = Pd.to_numeric (DF ['Open'])

passage 4: save and export data

Now you can save a clean and filtered frame of data in the favorite file format.

Python

Matters the marinade

Save the data frame on the Marinata file

With Open ("Krazen_Trades.pkl", "WB") as F:

Pickle.dump (DF, F)

Examples of use

Here is an example of how you can use this code to create historic OHLC data from Kraken Trades:

` Python

It matters Canner_trades

Get your API certificates

Api_key = “Your_api_key”

Api_secret = ‘Your_api_secret’

Configure the final point of the API

endpoint = f’https: //api.kraken.com/3/trades? Secret = {Api_Secret} & Key & Key = {Api_key} & Country = 1000 ‘

Send an GET request to the API’s end point and analyze the answer as a data setting

DF = kaken_trades.get_trades_dataframe (end point)

Filter any incorrect or missing data

DF = DF [DF [‘Time’]> 0]

Convert the column “open” in a numerical type (float) if possible

DF [‘Open’] = Pd.to_numeric (DF [‘Open’])

Save and export the data frame to the marinade file

With Open (“Krazen_Trades.pkl”, “WB”) as F:

marinated.

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *