This API allows you to place trades on a user's behalf using their 1CT ( one-click trading ) wallet. The user must first go to their settings page and generate an API Key and Key ID.
Base URL
The base URL for all the API endpoints is https://api.vela.exchange/trade-bots.
Common Headers
All API requests must include the following headers:
Content-Type: application/json
Depending on the endpoint and its purpose, you might also need to include:
Replace {Your_Token}, {Your_Api_Key}, and {Your_Key_Id} with your actual token, API key, and key ID, respectively.
Errors
In case of an error, the API returns a response with HTTP status code 500 and a body like the following:
{"error":"Something went wrong"}
Rate Limiting
As of the current version of the API, there is no rate limiting.
How to Create an API Key on the Vela App
Here are the steps to generate your API key and key ID:
Step 1: Sign into the Vela App
Step 2: Once you're signed in, navigate to "Settings".
Step 3: Inside "Settings", find and select "API keys".
Step 4: Click on "Create API Key".
Step 5: You have now created an API key and Key ID. Keep these credentials safe as you will need them for future API calls.
Remember, don't share your API key and Key ID with anyone. Keep them confidential to ensure your account's security.
Endpoints
GET /trade-bots/data/{data_type}/:chainId
This endpoint allows you to fetch different types of data. Replace {data_type} with the type of data you wish to fetch (deposits, withdraws, open_orders, open_positions, closed_positions, portfolios). The endpoint should also contain your chainId.
{"name":"newPositionOrder","chainId":"42161","params": {"tokenId":"2",// required,"isLong":true,// required,"positionType":"Market",// required, Enum: "Market" "Limit" "Stop Market" "Stop Limit", "lmtPrice":"1912.5",//Optional, price for "Limit", "Stop Limit""slippage":"0.3",// Optional, percentage for "Market", 0.3%"stpPrice":"1910.2",// Optional, price for "Stop Market" and "Stop Limit""collateral":"20.0",// required, it should be at least 20"size":"20.0"// required }}
Create Order with TPSL
newPositionOrderWithTPSL
{"name":"newPositionOrderWithTPSL","chainId":"42161","params": {"tokenId":"2",// required,"isLong":true,// required,"positionType":"Market",// required, Enum: "Market" "Limit" "Stop Market" "Stop Limit", "lmtPrice":"1912.5",//Optional, price for "Limit", "Stop Limit""slippage":"0.3",// Optional, percentage for "Market", 0.3%"stpPrice":"1910.2",// Optional, price for "Stop Market" and "Stop Limit""collateral":"20.0",// required, it should be at least 20"size":"20.0"// required"takeProfit": "1920.2",// Optional, If you want to place TP, then pass TP Price, if or not, dont pass"stopLoss":"1812.5"// Optional, if you want to place SL, then pass SL Price, if or not, dont pass SL Price }}
{"name":"addTPSL","chainId":"42161","params": {"posId":"10","tpPrice":"1812.2",// Only for TP"tpAmountPercent":"100.0",// percentage, Only for TP"slPrice":"1812.2",// Only for SL"slAmountPercent":"100.0",// percentage, Only for SL }}
{"name":"addTrailingStop","chainId":"42161","params": {"posId":"10",// required"collateral":"10.0",// required"size":"20.0",// required"amountPercent":"100",//required percentage"trailType":"PERCENT",//required Enum: "PERCENT" "AMOUNT""stopLossPrice":"1920.0",// required"trailingAmount":"0.2"//required if trailType is "PERCENT", this is 0.2%, if it is "AMOUNT", then 0.2 }}
Associate customer with your trade bot
If you are a bot builder, please reach out to the Vela team to have your trade bot platform address registered