{
  "opencollection": "1.0.0",
  "info": {
    "name": "Broker Account Activities Trading API",
    "version": "1.0.0"
  },
  "request": {
    "auth": {
      "type": "basic",
      "username": "{{username}}",
      "password": "{{password}}"
    }
  },
  "items": [
    {
      "info": {
        "name": "Trading",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "List open positions for an account",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/positions",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              }
            ]
          },
          "docs": "List open positions for an account"
        },
        {
          "info": {
            "name": "Close All Positions for an Account",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/positions",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "cancel_orders",
                "value": "",
                "type": "query",
                "description": "If true is specified, cancel all open orders before liquidating all positions."
              }
            ]
          },
          "docs": "Closes (liquidates) all of the account’s open long and short positions. A response will be provided for each order that is attempted to be cancelled. If an order is no longer cancelable, the server will respond with status 500 and reject the request."
        },
        {
          "info": {
            "name": "Get an Open Position for account by Symbol or AssetId",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/positions/:symbol_or_asset_id",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "symbol_or_asset_id",
                "value": "",
                "type": "path",
                "description": "The symbol or asset_id "
              }
            ]
          },
          "docs": "Retrieves the account’s open position for the given symbol or asset_id."
        },
        {
          "info": {
            "name": "Close a Position for an Account",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/positions/:symbol_or_asset_id",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "symbol_or_asset_id",
                "value": "",
                "type": "path",
                "description": "The symbol or asset_id "
              },
              {
                "name": "qty",
                "value": "",
                "type": "query",
                "description": "Optional the number of shares to liquidate. Can accept up to 9 decimal points. Cannot work with percentage"
              },
              {
                "name": "percentage",
                "value": "",
                "type": "query",
                "description": "percentage of position to liquidate. Must be between 0 and 100. Would only sell fractional if position is originally fractional. Can accept up to 9 decimal points. Cannot work with qty"
              }
            ]
          },
          "docs": "Closes (liquidates) the account’s open position for the given symbol. Works for both long and short positions."
        },
        {
          "info": {
            "name": "Retrieves a single order for the given order_id.",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders/:order_id",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "order_id",
                "value": "",
                "type": "path",
                "description": "Order identifier."
              }
            ]
          },
          "docs": "Retrieves a single order for the given order_id."
        },
        {
          "info": {
            "name": "Replaces a single order with updated parameters",
            "type": "http"
          },
          "http": {
            "method": "PATCH",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders/:order_id",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "order_id",
                "value": "",
                "type": "path",
                "description": "Order identifier."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Replaces a single order with updated parameters. Each parameter overrides the corresponding attribute of the existing order. The other attributes remain the same as the existing order.\n\nA success return code from a replaced order does NOT guarantee the existing open order has been replaced. If the existing open order is filled before the replacing (new) order reaches the execution venue, the replacing (new) order is rejected, and these events are sent in the trade_updates stream channel found [h"
        },
        {
          "info": {
            "name": "Attempts to cancel an open order.",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders/:order_id",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "order_id",
                "value": "",
                "type": "path",
                "description": "Order identifier."
              }
            ]
          },
          "docs": "Attempts to cancel an open order. If the order is no longer cancelable (for example if the status is \"filled\"), the server will respond with status 422, and reject the request.\n\nUpon acceptance of the cancel request, it returns status 204."
        },
        {
          "info": {
            "name": "Retrieves a list of orders for the account, filtered by the supplied query parameters.",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              },
              {
                "name": "status",
                "value": "",
                "type": "query",
                "description": "Order status to be queried. open, closed or all. Defaults to open."
              },
              {
                "name": "limit",
                "value": "",
                "type": "query",
                "description": "The maximum number of orders in response. Defaults to 50 and max is 500."
              },
              {
                "name": "after",
                "value": "",
                "type": "query",
                "description": "The response will include only ones submitted after this timestamp (exclusive.)"
              },
              {
                "name": "until",
                "value": "",
                "type": "query",
                "description": "The response will include only ones submitted until this timestamp (exclusive.)"
              },
              {
                "name": "direction",
                "value": "",
                "type": "query",
                "description": "The chronological order of response based on the submission time. asc or desc. Defaults to desc."
              },
              {
                "name": "nested",
                "value": "",
                "type": "query",
                "description": "If true, the result will roll up multi-leg orders under the legs field of primary order."
              },
              {
                "name": "symbols",
                "value": "",
                "type": "query",
                "description": "A comma-separated list of symbols to filter by."
              }
            ]
          },
          "docs": "Retrieves a list of orders for the account, filtered by the supplied query parameters.\n\nEndpoint defaults to open orders if no parameters are provided."
        },
        {
          "info": {
            "name": "Create an order for an account.",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Create an order for an account."
        },
        {
          "info": {
            "name": "Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled.",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/:account_id/orders",
            "params": [
              {
                "name": "account_id",
                "value": "",
                "type": "path",
                "description": "Account identifier."
              }
            ]
          },
          "docs": "Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled."
        },
        {
          "info": {
            "name": "Subscribe to Trade Events (SSE)",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://broker-api.sandbox.alpaca.markets/v1/events/trades",
            "params": [
              {
                "name": "since",
                "value": "",
                "type": "query",
                "description": "Format: YYYY-MM-DD"
              },
              {
                "name": "until",
                "value": "",
                "type": "query",
                "description": "Format: YYYY-MM-DD"
              },
              {
                "name": "since_id",
                "value": "",
                "type": "query"
              },
              {
                "name": "until_id",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "The Events API provides event push as well as historical queries via SSE (server sent events).\n\nYou can listen to events related to trade updates. Most market trades sent during market hours are filled instantly; you can listen to limit order updates through this endpoint.\n\nHistorical events are streamed immediately if queried, and updates are pushed as events occur.\n\nQuery Params Rules:\n- `since` required if `until` specified\n- `since_id` required if `until_id` specified\n- `since` and `since_id"
        }
      ]
    }
  ],
  "bundled": true
}