For the complete documentation index, see llms.txt. This page is also available as Markdown.

🌊API Example Flow

Step 1 β€” Get an access token:

curl -X POST https://auth.quant.fun/oauth2/token \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>"

Step 2 β€” Submit a trade (go 50% long ETH and 50% short BTC, close anything else):

curl -X POST https://api.quant.fun/vaults/my-vault/trades \ -H "Authorization: Bearer <ACCESS_TOKEN>" \ -H "Content-Type: application/json" \ -d '[ { "type": "perp", "marketIndex": 0, "direction": "long", "portfolioAllocation": 0.5, "leverage": 4 }, { "type": "perp", "marketIndex": 1, "direction": "short", "portfolioAllocation": 0.5, "leverage": 4 }, { "type": "closeAll" } ]'

Returns immediately with a transaction ID:

{ "result": { "transactionId": "550e8400-e29b-41d4-a716-446655440000" } }

Step 3 β€” Poll for completion:

curl https://api.quant.fun/vaults/my-vault/transactions/550e8400-e29b-41d4-a716-446655440000 \ -H "Authorization: Bearer <ACCESS_TOKEN>"

{ "result": { "requestStatus": "COMPLETED", "portfolioCompositionResponse": [ { "success": true, "orderIds": [123456], "adjustmentTradeDirection": "long", "allocation": { "marketIndex": 0 } }, { "success": true, "orderIds": [123457], "adjustmentTradeDirection": "short", "allocation": { "marketIndex": 1 } } ] } }

Poll every 2–3 seconds until requestStatus is COMPLETED or FAILED. Typical execution completes within 30–60 seconds depending on maker fill rates.

Last updated