/api/v1/extension/token/trade
This endpoint allows you to buy or sell token
token
Your extension token
chain
One of the available options
CHAIN_SOL
direction
One of the available options
TRADE_DIRECTION_BUY
input
Token address or pool address
2kmgscz3mCNgBxWX1Ck4pBmRcXpf5iV8umK417wRpump
amount
Unformatted amount or percentage of the balance
0.1
/ 100%
settings
Optional swap settings. If this field is omitted Echo will use your default settings. If you've provided settings be sure to fill out all values
strategies
Optional strategies to trigger auto limit-order creation and run. Keep in mind that you must specify ONLY ONE strategy: either takeProfit or stopLoss
{
"strategies": [
{
"takeProfit": {
"target": "50",
"amount": "100"
}
},
{
"stopLoss": {
"target": "50",
"amount": "100"
}
}
]
}
walletId
Optional wallet_id to execute trade. If empty, primary wallet will be used
CHAIN_UNSPECIFIED
Possible values: TRADE_DIRECTION_UNSPECIFIED
Possible values: A successful response.
An unexpected error response.
POST /api/v1/extension/token/trade HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 336
{
"token": "text",
"chain": "CHAIN_UNSPECIFIED",
"direction": "TRADE_DIRECTION_UNSPECIFIED",
"input": "text",
"amount": "text",
"settings": {
"buyFee": 1,
"sellFee": 1,
"buyTip": 1,
"sellTip": 1,
"buySlippage": 1,
"sellSlippage": 1
},
"strategies": [
{
"takeProfit": {
"target": "text",
"amount": "text"
},
"stopLoss": {
"target": "text",
"amount": "text"
}
}
],
"walletId": "text"
}
{
"result": {
"transactionId": "text",
"poolAddress": "text",
"poolPlatform": "PLATFORM_UNSPECIFIED",
"tokenInInfo": {
"address": "text",
"name": "text",
"symbol": "text",
"decimals": 1,
"isStable": true
},
"tokenOutInfo": {
"address": "text",
"name": "text",
"symbol": "text",
"decimals": 1,
"isStable": true
},
"tokenInAmount": "text",
"tokenOutAmount": "text",
"poolMcapUsd": "text"
},
"errors": [
{
"strategyIdx": 1,
"error": "text"
}
]
}
Last updated