Onboarding information for Arbitrageurs, Algo, Convergence and Pro-Traders
The EMDX team created this guide to help market makers, liquidity providers, and arbitrageurs get started. Please read the entire document before beginning any integration steps.
To get access to EMDX's API repository and perpetual API, fill out the form with the information requested and the team will contact you with the access. Remember to specify whether you want to interact with mainnet, testnet, or both, as the access tokens differ.
You can also request testnet AVAX to interact with the Fuji C chain via Avalanche's official faucet https://faucet.avax-test.network/. If you require testnet USDC, please contact us via Discord or Telegram.
EMDX has three types of endpoints:
- Read only: This type of endpoint enables the trader to obtain information about the pairs, markets, funding, and so on. For example: - All
/markets
endpoints - All/trader
endpoints - All/calculations
endpoints -/metadata
endpoints -/position/open/calculate
-/position/read
- Transaction creation: This type of endpoints returns all the data needed to sign and send the transaction. For example: -
/allowance/add
-/allowance/remove
-/position/open
-/position/close
- Transaction broadcast: This is the endpoint
/transaction/send
. This route broadcasts the signed transaction to the blockchain.
This example is based on the BTC/USDC pair in testnet. In order to get started you need to have a testnet API token and authenticate on the Authorize section in Swagger. The execution endpoints like allowance or open/close position returns all the data needed to sign and broadcast the transaction. You can check an example of signing a transaction here.
- 1.
- 2.
- 3.This step is optional, but if you want to know more about the trade you're about to execute, such as the entry price, fee, etc; you can use the calculate endpoint.
- 4.
- 5.
- 6.
- 1.In order to close an open position just execute the close endpoint, sign the transaction and broadcast it.
EMDX developed a set of scripts to help users on-boarding the API usage. For this tutorial, we will use the JS example, but the same scripts are available in Python:
- 1.
- 2.Navigate to nodejs folder
- 3.Copy the .env.example to .env
- 4.Fill the environment variables
- 1.To open the position, you must first add allowance so that the clearing house contract can use the collateral. You have to use the add-allowance.js script.
- 2.After you added the allowance, you can open the position with the open-position.js. Simply change the pair you want to operate and some parameters such as collateral, leverage, slippage, etc.
- 3.
- 1.
Last modified 9mo ago