⚙️AI API Usage Guide

Base Url

https://apis.xtreamly.io/api/inference/predict/v1

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>. Unless stated, all apis require header authentication

Headers

NameValue

x-api-key

<API-Token>

Important Note:

For all apis, you can either set the block_number parameter or set the start_block and end_block. You can't set them together (e.g. block_number and end_block) nor you can't set them (In next version we would use the latest block as block_number so it would be completely optional)

Gas Fee Prediction

GET /gas-fee

Predict gas fee (base price) for the next block

Query Parameters

NameTypeDescription

block_number

int (Optional)

Block number at which prediction is requested

start_block

int (Optional)

Block number at which prediction is started

end_block

int (Optional)

Block number at which prediction is ended

Eample

curl "https://apis.xtreamly.io/api/inference/predict/v1/gas-fee?start_block=20358410&end_block=20358412" \
-H "x-api-key: lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa"
# {"prediction": 21660749824}

Pool volatility prediction

GET /volatility

Predicts the volatility of the selected Uniswap liquidity pool for next 24 hours

Query Parameters

NameTypeDescription

pool_address

string

Pool address of Uniswap LP

block_number

int (Optional)

Block number at which prediction is requested

start_block

int (Optional)

Block number at which prediction is started

end_block

int (Optional)

Block number at which prediction is ended

Here is the list of accepted pool addresses:

  • 0x11b815efB8f581194ae79006d24E0d814B7697F6

  • 0x4e68Ccd3E89f51C3074ca5072bbAC773960dFa36

  • 0xC5aF84701f98Fa483eCe78aF83F11b6C38ACA71D

  • 0xc7bBeC68d12a0d1830360F8Ec58fA599bA1b0e9b

  • 0xE0554a476A092703abdB3Ef35c80e0D76d32939F

  • 0x7BeA39867e4169DBe237d55C8242a8f2fcDcc387

  • 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8

  • 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640

Eample

curl "https://apis.xtreamly.io/api/inference/predict/v1/volatility?pool_address=0x11b815efb8f581194ae79006d24e0d814b7697f6" \
-H "x-api-key: lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa"
# {"prediction":12.433452606201172}

Price prediction

GET /price

Predicts the price of selected symbol pair for next 15 minutes

Query Parameters

NameTypeDescription

symbol

string

Trading pair symbol

block_number

int (Optional)

Block number at which prediction is requested

start_block

int (Optional)

Block number at which prediction is started

end_block

int (Optional)

Block number at which prediction is ended

Here is the list of accepted symbols:

  • ETH-USDT

  • ETH-USDC

Example

curl "https://apis.xtreamly.io/api/inference/predict/v1/price?symbol=ETH-USDT" \
-H "x-api-key: lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa"
# {"prediction":3128.8271484375}

Slippage Prediction

GET /slippage

Predicts the slippage percentage associated with a hypotetical swap on UniswapV3

Query Parameters

NameTypeDescription

symbol

string

Trading pair symbol

pool_address

string

Pool address of Uniswap LP that swap uses

amountin

number

Amount of token that is going to be swapped

quotedprice

number

Quoted price given by Uniswap Quoter contract for the swap in floating point (e.g. 3216.85 for WETH-USDT or 0.00312 for 0.000334 for USDT-WETH)

priceimpactpercentage

number

The price impact as determined by Uniswap Router for the swap

gasprice

number

Gas price in Wei at the time of swap initialized

block_number

int (Optional)

Block number at which prediction is requested

start_block

int (Optional)

Block number at which prediction is started

end_block

int (Optional)

Block number at which prediction is ended

Symbol can be either:

  • WETH-USDT

  • WETH-USDC

  • USDC-WETH

  • USDT-WETH

Example

curl "https://apis.xtreamly.io/api/inference/predict/v1/slippage?symbol=WETH-USDT&amountin=2.333&quotedprice=3810.5&priceimpactpercentage=0.02&gasprice=15192389632" \
-H "x-api-key: lKwdtPEe3xaW5nq1bMNaQtrI0ffTdIUhU6cMAa"
# {"prediction":-4.984075546264648}

Last updated