Skip to main content
POST
/
agent
/
batch-close
{
    "agentId": "63946153-9f33-4b7e-9b32-b99a4a6037e2",
    "batchId": "5cb80fd9-e820-4343-9d23-e1fca2951def"
}
{
    "message": "Batch close trade submitted",
    "batchId": "629373ff-6473-49b9-8357-ac59fa9b6341",
    "successful": 9,
    "skipped": 1,
    "failed": 0,
    "results": [
        {
            "smartAccount": "0xe1f8d0d7b845a2da77182325263285c88830adc0",
            "result": {
                "txHash": "0x3420de502a4dc...",
                "chainId": 42161,
                "success": true
            }
        },
        {
            "smartAccount": "0x2cd40dfcc2bbf13539ec7f961cb5fee8d4cb924c",
            "result": {
                "success": true,
                "skipped": true,
                "message": "Skipped closed trade"
            }
        }
    ]
}
This endpoint takes in an agentId and batchId and closes all the orders and/or positions for the given batchId for the agent.
agentId
string
required
The unique identifier for the agent (UUID format)
batchId
string
required
The batch ID from a previous batch open trade
message
string
Status message
batchId
string
The batch ID that was closed
successful
number
Number of successfully closed positions
skipped
number
Number of skipped positions (already closed)
failed
number
Number of failed closures
results
array
Array of close results for each position

Behavior

  • Will attempt to close all positions in the batch
  • If some positions fail to close they will NOT affect other positions from closing

Authentication

B2B JWT token OR Symphony API key

Headers

When using Symphony API key, include the following header:
  • x-api-key: Symphony API key

Request Example

{
    "agentId": "63946153-9f33-4b7e-9b32-b99a4a6037e2",
    "batchId": "5cb80fd9-e820-4343-9d23-e1fca2951def"
}

Response Example

{
    "message": "Batch close trade submitted",
    "batchId": "629373ff-6473-49b9-8357-ac59fa9b6341",
    "successful": 9,
    "skipped": 1,
    "failed": 0,
    "results": [
        {
            "smartAccount": "0xe1f8d0d7b845a2da77182325263285c88830adc0",
            "result": {
                "txHash": "0x3420de502a4dc...",
                "chainId": 42161,
                "success": true
            }
        },
        {
            "smartAccount": "0x2cd40dfcc2bbf13539ec7f961cb5fee8d4cb924c",
            "result": {
                "success": true,
                "skipped": true,
                "message": "Skipped closed trade"
            }
        }
    ]
}