API description
Several services of Bluefin Pro have different base URLs for API requests:
- Exchange endpoints: https://api.{env}.bluefin.io/v1/exchange
- Account endpoints: https://api.{env}.bluefin.io/api/v1/account
- Trade endpoints: https://trade.api.{env}.bluefin.io/api/v1
- Auth endpoints: https://auth.api.{env}.bluefin.io/auth
- Websockets endpoints: wss://stream.api.{env}.bluefin.io/ws
The Bluefin API adheres to RESTful conventions when feasible, executing most operations through GET, POST, PUT, and DELETE requests on page and database resources. Both request and response bodies are formatted in JSON.
Setting your environment and handling the API responses
Note that every base URL described above has an {env} variable that can be set to either sui-prod (Mainnet) or sui-staging (Testnet). You can do so in the integrated editor at the right of each endpoint page.
Additionally, to understand how to handle the responses you receive from each endpoint you can scroll to the bottom of the page and expand the 200 response code in the Request & Response section. This will allow you to see each field in the response JSON along with a brief description of what each of them represents.
Number Representation
Most numbers will be represented in a 9 decimal format (order sizes, position sizes, prices, funding rates, etc.); a base number must be shifted by 9 decimals before sending it to on-chain contracts.
- A trade of 2 ETH at price 2,232.11 USDC will be represented as
2 x 10^9
and2232.11 x 10^9
respectively on chain.