⚙️AI API Usage Guide

Dynamic Slippage prediction (First API release)

https://api.xtreamly.io/predict_slippage

Authentication

The API requires a x-api-token token for authentication, which will be provided separately to testers. It should be included in the request header as follows:x-api-key: <YOUR_TOKEN>Note that each API key is good for 100 calls per day.

Query Parameters

The API expects following query parameters:

parameter

type

amountIn

float

tokenInAddress

string

decimalIn

int

tokenOutAddress

string

decimalOut

int

fee

int

isBuy

boolean

Response

The response of the API is in this format

{
  "execution_price": 2219.7975302177338, // the actual expected execution price
  "slippage": -3.04353021773386  // the actual expected slippage percentage for the given parameteres
}

Example

Here is an example call using curl:

curl -G https://api.xtreamly.io/predict_slippage \
-H "x-api-key: lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa" \
-d "tokenInAddress=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" \
-d "decimalIn=18" \
-d "tokenOutAddress=0xdac17f958d2ee523a2206206994597c13d831ec7" \
-d "decimalOut=6" \
-d "amountIn=1.0" \
-d "fee=500" \
-d "isBuy=true"

Same call using python:

import requestsurl = "https://api.xtreamly.io/predict_slippage"
headers = {"x-api-key": "lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa",}
query_parameters = {
    'tokenInAddress': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    'decimalIn': '18',
    'tokenOutAddress': '0xdac17f958d2ee523a2206206994597c13d831ec7',
    'decimalOut': '6',
    'amountIn': 1.0,
    'fee': 500,
    'isBuy': True
}
response = requests.get(url, params=query_parameters, headers=headers)

Last updated