Trade Bots API

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:

  • vela-api-key: {Your_Api_Key} (for bot authenticated endpoints)

  • vela-key-id: {Your_Key_Id} (for bot authenticated endpoints)

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.

Headers

vela-api-key: {Your_Api_Key} vela-key-id: {Your_Key_Id}

Path Parameters

The path parameter should be your chainId. Replace :chainId in the URL with your actual Chain ID.

Request Example

For instance, if you want to fetch open orders, your request would look something like this:

With the headers:

GET Function Examples:

Get Deposits:

Get Withdrawals:

Get Open Orders:

Get Open Positions:

Get Closed Positions:

Get Portfolios:

Get Balances:

Get Pair Info:

You can find velaId here

Get Referrals:

Check Referrals:

Pair Info Result:

Remember to replace {Your_Api_Key}, {Your_Key_Id} and {Your_Chain_Id} with your actual API Key, Key ID, and Chain ID.

POST /trade-bots/execute

This endpoint allows you to execute a function. The request body should contain name, chainId, and params attributes.

Headers

  • vela-api-key: {Your_Api_Key}

  • vela-key-id: {Your_Key_Id}

Request Body

The request body should be a JSON object with the following structure:

POST Function Examples:

Deposit

  • depositSelf or depositSelfUSDC

depositSelfAllUSDC

Create Order without TPSL

  • newPositionOrder or newPositionOrderPacked

Create Order with TPSL

  • newPositionOrderWithTPSL

Decrease or Close Position

  • decreasePosition or decreasePositionPacked

Add Position

  • addPosition or addPositionPacked

Increase Collateral

  • addCollateral

Increase Leverage

  • removeCollateral

Add TPSL

  • addTPSL or addTPSLPacked

Cancel Pending Order or TPSL

  • cancelPendingOrder

  • cancelTPSL

Add Trailing Stop

  • addTrailingStop

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

  • setPlatformUsed

Charts

getCryptoChart

This endpoint is part of the Trade-Bots module and it provides candle chart data for a given cryptocurrency pair, during a specified time period.

Response

The response will be a JSON object with the result of the execution. The structure of this object will depend on the function that was executed.

Last updated