← All operations
GET/api/v1/agents/{entityPublicId}/trading/perps

Trading_GetPerpsWorkspace

Authentication
required-user
Cache policy
private
Success and errors
200, 400, 401, 403, 404, 409, 422, 500
Stability
v1 stable contract

OpenAPI operation

{
  "operationId": "Trading_GetPerpsWorkspace",
  "summary": "GET /api/v1/agents/{entityPublicId}/trading/perps",
  "tags": [
    "Trading"
  ],
  "parameters": [
    {
      "name": "entityPublicId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      }
    },
    {
      "name": "walletPublicId",
      "in": "query",
      "required": false,
      "schema": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      }
    }
  ],
  "security": [
    {
      "cookieAuth": []
    }
  ],
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "data",
              "meta"
            ],
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "riskPolicy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "publicId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "ACTIVE",
                              "RETIRED"
                            ]
                          },
                          "venue": {
                            "type": "string"
                          },
                          "policyDigest": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "maxNotionalPerPositionAtomic": {
                            "type": "string"
                          },
                          "maxTotalNotionalAtomic": {
                            "type": "string"
                          },
                          "maxLeverageBps": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "maxCollateralAllocationBps": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "maxDailyRealizedLossAtomic": {
                            "type": "string"
                          },
                          "allowedMarketIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "maxOracleStalenessMs": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "minimumLiquidationDistanceBps": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "maxConcurrentPositions": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "mandatoryApprovalThresholdAtomic": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "activatedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                          }
                        },
                        "required": [
                          "publicId",
                          "version",
                          "state",
                          "venue",
                          "policyDigest",
                          "maxNotionalPerPositionAtomic",
                          "maxTotalNotionalAtomic",
                          "maxLeverageBps",
                          "maxCollateralAllocationBps",
                          "maxDailyRealizedLossAtomic",
                          "allowedMarketIds",
                          "maxOracleStalenessMs",
                          "minimumLiquidationDistanceBps",
                          "maxConcurrentPositions",
                          "mandatoryApprovalThresholdAtomic",
                          "activatedAt",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "account": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "walletPublicId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "venue": {
                            "type": "string"
                          },
                          "available": {
                            "type": "boolean"
                          },
                          "totalCollateralAtomic": {
                            "type": "string"
                          },
                          "availableCollateralAtomic": {
                            "type": "string"
                          },
                          "marginHealthPpm": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "collateral": {},
                          "observedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                          }
                        },
                        "required": [
                          "walletPublicId",
                          "venue",
                          "available",
                          "totalCollateralAtomic",
                          "availableCollateralAtomic",
                          "marginHealthPpm",
                          "collateral",
                          "observedAt"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "positions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "publicId": {
                          "type": "string"
                        },
                        "walletPublicId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "venue": {
                          "type": "string"
                        },
                        "marketId": {
                          "type": "string"
                        },
                        "providerPositionId": {
                          "type": "string"
                        },
                        "side": {
                          "type": "string",
                          "enum": [
                            "LONG",
                            "SHORT"
                          ]
                        },
                        "baseSizeAtomic": {
                          "type": "string"
                        },
                        "entryPriceAtomic": {
                          "type": "string"
                        },
                        "markPriceAtomic": {
                          "type": "string"
                        },
                        "collateralAtomic": {
                          "type": "string"
                        },
                        "leverageBps": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "unrealizedPnlAtomic": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9][0-9]{0,77})$"
                        },
                        "realizedPnlAtomic": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?(0|[1-9][0-9]{0,77})$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "fundingAccruedAtomic": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?(0|[1-9][0-9]{0,77})$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "liquidationPriceAtomic": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "liquidationDistanceBps": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "marginHealthPpm": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "observedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        }
                      },
                      "required": [
                        "publicId",
                        "walletPublicId",
                        "venue",
                        "marketId",
                        "providerPositionId",
                        "side",
                        "baseSizeAtomic",
                        "entryPriceAtomic",
                        "markPriceAtomic",
                        "collateralAtomic",
                        "leverageBps",
                        "unrealizedPnlAtomic",
                        "realizedPnlAtomic",
                        "fundingAccruedAtomic",
                        "liquidationPriceAtomic",
                        "liquidationDistanceBps",
                        "marginHealthPpm",
                        "observedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "markets": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "venue": {
                          "type": "string"
                        },
                        "providerApiVersion": {
                          "type": "string"
                        },
                        "marketId": {
                          "type": "string"
                        },
                        "network": {
                          "type": "string"
                        },
                        "baseAssetPublicId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "baseSymbol": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "collateralAssetPublicId": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "collateralSymbol": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "oracleReference": {
                          "type": "string"
                        },
                        "oraclePriceAtomic": {
                          "type": "string"
                        },
                        "oraclePriceScale": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "oracleObservedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        "oracleAgeMs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "oracleValid": {
                          "type": "boolean"
                        },
                        "fundingRatePpm": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "openInterestAtomic": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "marginParameters": {},
                        "observedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        }
                      },
                      "required": [
                        "venue",
                        "providerApiVersion",
                        "marketId",
                        "network",
                        "baseAssetPublicId",
                        "baseSymbol",
                        "collateralAssetPublicId",
                        "collateralSymbol",
                        "oracleReference",
                        "oraclePriceAtomic",
                        "oraclePriceScale",
                        "oracleObservedAt",
                        "oracleAgeMs",
                        "oracleValid",
                        "fundingRatePpm",
                        "openInterestAtomic",
                        "marginParameters",
                        "observedAt"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "enabled",
                  "riskPolicy",
                  "account",
                  "positions",
                  "markets"
                ],
                "additionalProperties": false
              },
              "meta": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "requestId",
                  "schemaVersion",
                  "buildVersion",
                  "generatedAt",
                  "freshness"
                ],
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "schemaVersion": {
                    "type": "string"
                  },
                  "buildVersion": {
                    "type": "string"
                  },
                  "generatedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "freshness": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "projectedAt",
                      "sourceWatermark"
                    ],
                    "properties": {
                      "projectedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      },
                      "sourceWatermark": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "invalid request",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "403": {
      "description": "forbidden",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "404": {
      "description": "not found",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "409": {
      "description": "conflict",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "422": {
      "description": "configuration missing",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "500": {
      "description": "internal error",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    }
  },
  "x-auth-mode": "required-user",
  "x-cache-policy": "private",
  "x-required-scopes": [],
  "x-rate-cost": 1,
  "x-stability": "STABLE"
}