openapi: 3.0.1
info:
  title: Anboto Trading API
  description: "Anboto Trading API <BR><BR> <B>Authentication</B><BR>Please visit\
    \ Anboto's website to generate an API key<BR>   Production:<BR>        - <a href=\"\
    https://api.pro.anboto.xyz\">https://api.pro.anboto.xyz</a> (<a href=\"https://pro.anboto.xyz/settings/api\"\
    >Settings API</a>)<BR>   Testnet:<BR>        - <a href=\"https://api.testnet.anboto.xyz\"\
    >https://api.testnet.anboto.xyz</a><BR>          <I>(All trades are simulated\
    \ on testnet and will not trade on any real exchange)</I><BR><BR>Select Your API\
    \ Key Type<BR>     1) <B>System-generated</B> API Keys: The API key generated\
    \ by Anboto use HMAC encryption. You will be provided with an API key and a secret\
    \ key, that can be used to trade, please keep the keys safe.<BR>   2) <B>Self-generated</B>\
    \ API keys operate with RSA encryption.      You must create your public and private\
    \ keys and only provide the public key to Anboto, we will never hold your private\
    \ key.<BR><BR><B>Parameters for Authenticated Endpoints</B>The following HTTP\
    \ header keys must be used for authentication on <U>any endpoint annotated with\
    \ <B>'ApiKeyAuth'</B></U>:<BR> - <B>X-API-KEY</B> - API key<BR> - <B>X-TIMESTAMP</B>\
    \ - timestamp in milliseconds from epoch<BR> - <B>X-SIGN</B> - a signature derived\
    \ from the request's parameters<BR> - <B>X-RECV-WINDOW</B> (unit in millisecond\
    \ and default value is 5,000) to specify how long an HTTP request is valid. A\
    \ smaller X-RECV-WINDOW is more secure, but your request may fail if the transmission\
    \ time is greater than your X-RECV-WINDOW.<BR><BR><B>Basic steps:</B><BR>1. The\
    \ string to sign should be a concatenation of 'timestamp + API key + (recv_window)\
    \ + (queryString | jsonBodyString)' The queryString should be assembled in alphabetical\
    \ order.<BR>2. Take your secret key and decode from Base64 into a byte array (standard\
    \ Base64 if the secret contains '+', '/' or ends with '='; otherwise URL-safe\
    \ Base64). Then use the HMAC_SHA256 (for system generated keys) or RSA_SHA256\
    \ algorithm to sign the string in step 1.<BR>3. Set X-SIGN to the standard Base64\
    \ encoding of the signed value (not hex) for both HMAC and RSA keys.<BR>4. Append\
    \ the sign parameter to request header, and send the HTTP request. <BR><BR>Examples\
    \ can be found here: <a href=\"https://github.com/anbotolabs/examples\">https://github.com/anbotolabs/examples</a><BR>Full\
    \ reference documentation: <a href=\"https://api-docs.anboto.xyz\">https://api-docs.anboto.xyz</a>;\
    \ the OpenAPI spec can be found here: <a href=\"https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml\"\
    >https://api-docs.anboto.xyz/spec/anboto-trading-api-2.0.yml</a><BR><BR><B>WebSocket\
    \ API</B><BR>Real-time order, trade, position and balance streams are available\
    \ over WebSocket — see the <a href=\"https://api-docs.anboto.xyz/reference/ws-index/\"\
    >WebSocket API</a> reference. Authenticate with a listenKey from GET /api/v2/trading/listenKey."
  version: "2.0"
paths:
  /api/v2/data/exchanges:
    get:
      tags:
      - Data Rest API
      summary: Returns a list of exchanges supported
      description: Return a list of exchanges available to trade
      operationId: exchanges
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The exchanges.
          content:
            application/json:
              schema:
                type: string
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/data/fundingRateHistory:
    get:
      tags:
      - Data Rest API
      summary: Returns funding rates history
      description: Return the funding rate history for a symbol on an exchange. Both
        'exchange' and 'symbol' are required.
      operationId: fundingRateHistory
      parameters:
      - name: exchange
        in: query
        description: The exchange to return funding rate history for
        schema:
          type: string
          nullable: true
      - name: symbol
        in: query
        description: The symbol to return funding rate history for
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The last funding rates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FundingRate'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/data/instruments:
    get:
      tags:
      - Data Rest API
      summary: Returns list of instruments
      description: Return all instruments based on filter parameters
      operationId: instruments
      parameters:
      - name: exchange
        in: query
        description: Return all instruments on this exchange for each asset
        schema:
          type: string
          nullable: true
      - name: symbol
        in: query
        description: Return instrument with this symbol
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The instruments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Instrument'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/data/lastFundingRates:
    get:
      tags:
      - Data Rest API
      summary: Returns last funding rates
      description: Return all funding rates based on filter parameters
      operationId: lastFundingRates
      parameters:
      - name: exchange
        in: query
        description: Return last funding rates on this exchange for each asset
        schema:
          type: string
          nullable: true
      - name: symbol
        in: query
        description: Return last funding rates for this asset on each exchange
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The last funding rates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FundingRate'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/data/preTradeAnalysis:
    get:
      tags:
      - Data Rest API
      summary: Pre-trade analysis of an order
      description: "Market impact of an order before it is placed, computed from Anboto's\
        \ live market snapshot (the same analysis as the trading UI): participation\
        \ in the 5m volume and in the order book, impact tier LOW / MEDIUM / HIGH\
        \ for TWAP / VWAP / IS at the given duration, the shortest low / medium impact\
        \ durations, sweep price, slippage and share of the 24h volume. For POV, give\
        \ `povRatio`: the impact tier at that participation, the estimated time to\
        \ fill and the low / medium / high participation presets (`pov`). `cost_estimate`\
        \ gives the expected slippage, price move and market risk from a market-impact\
        \ model (uncalibrated estimate). `supported: false` with `missing` explains\
        \ when the venue or symbol cannot be analysed (e.g. `exchange_not_supported`,\
        \ `timeout`); `market` and `execution` are then null when no snapshot could\
        \ be read or it is stale. The first call for a symbol can take a few seconds\
        \ while the snapshot is built; later calls are immediate."
      operationId: preTradeAnalysis
      parameters:
      - name: exchange
        in: query
        description: "Exchange, e.g. binance, bybit, okx"
        schema:
          type: string
          nullable: true
      - name: assetClass
        in: query
        description: "Asset class: spot or future"
        schema:
          type: string
          nullable: true
      - name: symbol
        in: query
        description: "Anboto symbol, e.g. BTC/USDT:USDT"
        schema:
          type: string
          nullable: true
      - name: quantity
        in: query
        description: Order quantity in base units (coins)
        schema:
          type: string
          nullable: true
      - name: strategy
        in: query
        description: "Strategy: twap, vwap, is, pov, iceberg, limit, market…"
        schema:
          type: string
          nullable: true
      - name: side
        in: query
        description: buy or sell; needed for the sweep price and slippage
        schema:
          type: string
          nullable: true
      - name: durationSeconds
        in: query
        description: Execution duration in seconds (TWAP / VWAP / IS)
        schema:
          type: string
          nullable: true
      - name: povRatio
        in: query
        description: "POV participation in percent of market volume, 0.01 to 33; required\
          \ for pov"
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The analysis.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreTradeAnalysis'
        "400":
          description: Invalid parameter
        "401":
          description: "Unauthorized: missing or unknown API key"
        "503":
          description: Pre-trade analysis is not available on this deployment
      security:
      - ApiKeyAuth: []
  /api/v2/portfolio/flows:
    get:
      tags:
      - Portfolio Rest API
      summary: "Returns deposits, withdrawals and internal transfers"
      description: "The flows the daily PnL subtracts, deduplicated and signed: `net_flow_usd`\
        \ is a flow's contribution to `net_flows` (positive in, negative out; 0 with\
        \ `counted_in_pnl: false` for transfers within one account and for unknown\
        \ directions). When the asset could not be priced, `usd_value` and `net_flow_usd`\
        \ are null (`counted_in_pnl: false`; transfers within one account stay 0)\
        \ and the flow is counted in `totals.unpriced_count`. The window is half-open,\
        \ [startMs, endMs): a flow at exactly endMs is not returned, so the next window\
        \ starts at `to_ms`. Oldest first; pass `next_cursor` back as `cursor` for\
        \ the next page; `totals` always cover the whole window."
      operationId: flows
      parameters:
      - name: accounts
        in: query
        description: "Comma-separated accounts: `binance` = every account on Binance\
          \ (main and subaccounts), `binance:` = the main account only, `binance:Sub1`\
          \ = that subaccount. Omit for every account of the team. At most 20 items.\
          \ Unlike /api/v2/trading/*, a missing subaccount means all accounts. Sign\
          \ the raw value, e.g. `accounts=binance:,bybit:Sub1`."
        schema:
          type: string
          nullable: true
        example: binance
      - name: startMs
        in: query
        description: "Start, ms since epoch (inclusive). Defaults to 30 days before\
          \ endMs. Must be before endMs"
        schema:
          type: integer
          format: int64
          nullable: true
      - name: endMs
        in: query
        description: "End, ms since epoch (exclusive: a flow at exactly endMs is not\
          \ returned). Defaults to now; at most 4102444800000 (2100-01-01). The window\
          \ spans at most 366 days"
        schema:
          type: integer
          format: int64
          nullable: true
      - name: types
        in: query
        description: "Comma-separated flow types: deposit, withdrawal, internal_transfer.\
          \ Default all"
        schema:
          type: string
          nullable: true
        example: "deposit,withdrawal"
      - name: external
        in: query
        description: "true: only flows that cross the team's boundary (deposits, withdrawals);\
          \ false: only transfers inside the team. Default both"
        schema:
          type: boolean
          nullable: true
      - name: limit
        in: query
        description: "Flows per page, 1 to 500 (default 500)"
        schema:
          maximum: 500
          minimum: 1
          type: integer
          nullable: true
          default: 500
      - name: cursor
        in: query
        description: '`next_cursor` of the previous page'
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The flows
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioFlowsResponse'
        "400":
          description: "Invalid parameter, {\"error\": \"...\"}"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "503":
          description: "The portfolio service is unavailable, {\"error\": \"...\"}"
      security:
      - ApiKeyAuth: []
  /api/v2/portfolio/pnl:
    get:
      tags:
      - Portfolio Rest API
      summary: Returns the daily PnL of the team (NAV based)
      description: "Daily PnL from equity closes at 00:00 UTC, net of deposits and\
        \ withdrawals: the same figures as the PnL page of the trading UI. `total`\
        \ covers the whole selection; with `groupBy`, `groups` splits it per exchange\
        \ or account (money values add up to the total, ratios do not). Every `*_pct`\
        \ value is in percent. `period_return_pct` is a simple return, not time-weighted;\
        \ `equity_prev` in each point gives the denominator for a time-weighted return.\
        \ `nav_usd` and `today_pnl` come from live equity (`as_of`). Exchanges without\
        \ daily PnL coverage are listed in `uncovered_exchanges` and never counted\
        \ as zero. Scope spot or future is recomputed per day and limited to 366 days."
      operationId: pnl
      parameters:
      - name: accounts
        in: query
        description: "Comma-separated accounts: `binance` = every account on Binance\
          \ (main and subaccounts), `binance:` = the main account only, `binance:Sub1`\
          \ = that subaccount. Omit for every account of the team. At most 20 items.\
          \ Unlike /api/v2/trading/*, a missing subaccount means all accounts. Sign\
          \ the raw value, e.g. `accounts=binance:,bybit:Sub1`."
        schema:
          type: string
          nullable: true
        example: "binance:,bybit:Sub1"
      - name: scope
        in: query
        description: "Wallet scope: total (default), spot or future"
        schema:
          type: string
          nullable: true
          enum:
          - total
          - spot
          - future
          default: total
      - name: groupBy
        in: query
        description: "Split the result into `groups`: none (default), exchange or\
          \ account"
        schema:
          type: string
          nullable: true
          enum:
          - none
          - exchange
          - account
          default: none
      - name: period
        in: query
        description: "Window ending at endDate: `<N>d` (N from 1 to 3660), week, month,\
          \ quarter or year. Default 30d. Ignored when startDate is given"
        schema:
          type: string
          nullable: true
        example: 90d
      - name: startDate
        in: query
        description: "First day, YYYY-MM-DD (UTC, inclusive)"
        schema:
          type: string
          format: date
          nullable: true
      - name: endDate
        in: query
        description: "Last day, YYYY-MM-DD (UTC, inclusive). At most today. The series\
          \ ends yesterday at the latest, the last closed day: the default, and the\
          \ day an endDate of today is answered up to (`to_date` gives the applied\
          \ end; today's PnL so far is `today_pnl`). The window spans at most 3660\
          \ days, or 366 days for scope spot or future"
        schema:
          type: string
          format: date
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The daily PnL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioPnlResponse'
        "400":
          description: "Invalid parameter, {\"error\": \"...\"}"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "503":
          description: "The portfolio service is unavailable, {\"error\": \"...\"}"
      security:
      - ApiKeyAuth: []
  /api/v2/portfolio/pnl/ledger:
    get:
      tags:
      - Portfolio Rest API
      summary: "Returns realized PnL, funding and fees by day and symbol"
      description: "Income from the exchange's own history: realized PnL, funding,\
        \ commissions, rebates and other income, in USD. Signs are from the account's\
        \ point of view: + is income, − is cost. `net` is the net realized PnL of\
        \ futures (Net realized (futures)). Spot income is trading fees only: they\
        \ are in `commission` and `fee_rebate` but not in `net`, and spot rows (and\
        \ a spot-only selection's `totals`) have null `realized_pnl`, `funding`, `other`\
        \ and `net`, never 0. `coverage` gives the ingestion status per account; venues\
        \ without ingestion are listed there as `unsupported` and are never reported\
        \ as zero. Today's figures are provisional. Results are paged: pass `next_cursor`\
        \ back as `cursor`; `totals` always cover the whole window."
      operationId: ledger
      parameters:
      - name: accounts
        in: query
        description: "Comma-separated accounts: `binance` = every account on Binance\
          \ (main and subaccounts), `binance:` = the main account only, `binance:Sub1`\
          \ = that subaccount. Omit for every account of the team. At most 20 items.\
          \ Unlike /api/v2/trading/*, a missing subaccount means all accounts. Sign\
          \ the raw value, e.g. `accounts=binance:,bybit:Sub1`."
        schema:
          type: string
          nullable: true
        example: 'binance:'
      - name: groupBy
        in: query
        description: "Row grouping: day, symbol or day_symbol (default)"
        schema:
          type: string
          nullable: true
          enum:
          - day
          - symbol
          - day_symbol
          default: day_symbol
      - name: symbol
        in: query
        description: "Only this Anboto symbol, e.g. BTC/USDT:USDT (futures) or BTC/USDT\
          \ (spot)"
        schema:
          type: string
          nullable: true
      - name: market
        in: query
        description: "Only this market: spot or future"
        schema:
          type: string
          nullable: true
          enum:
          - spot
          - future
      - name: period
        in: query
        description: "Window ending at endDate: `<N>d`, week, month, quarter or year.\
          \ Default 30d. Ignored when startDate is given"
        schema:
          type: string
          nullable: true
      - name: startDate
        in: query
        description: "First day, YYYY-MM-DD (UTC, inclusive)"
        schema:
          type: string
          format: date
          nullable: true
      - name: endDate
        in: query
        description: "Last day, YYYY-MM-DD (UTC, inclusive). Defaults to today; at\
          \ most today. The window spans at most 366 days"
        schema:
          type: string
          format: date
          nullable: true
      - name: limit
        in: query
        description: "Rows per page, 1 to 5000 (default 1000)"
        schema:
          maximum: 5000
          minimum: 1
          type: integer
          nullable: true
          default: 1000
      - name: cursor
        in: query
        description: '`next_cursor` of the previous page'
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The income ledger
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortfolioLedgerResponse'
        "400":
          description: "Invalid parameter, {\"error\": \"...\"}"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "503":
          description: "The portfolio service is unavailable, {\"error\": \"...\"}"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns:
    get:
      tags:
      - Strategies Rest API
      summary: List the team's PAPER-farm campaigns
      description: "Newest first. `status` uses the public values this API reports,\
        \ not the internal ones."
      operationId: campaigns
      parameters:
      - name: type
        in: query
        description: Only this campaign type; today only paper_farm
        schema:
          type: string
          nullable: true
      - name: status
        in: query
        description: Only this status
        schema:
          type: string
          nullable: true
          enum:
          - running
          - paused
          - stopped
          - done
          - error
      - name: limit
        in: query
        description: "Campaigns per page, 1-200 (default 20)"
        schema:
          maximum: 200
          minimum: 1
          type: integer
          nullable: true
          default: 20
      - name: offset
        in: query
        description: Campaigns to skip (default 0)
        schema:
          minimum: 0
          type: integer
          nullable: true
          default: 0
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "200":
          description: A page of campaigns
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaignList'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/byId:
    get:
      tags:
      - Strategies Rest API
      summary: Get one campaign
      operationId: byId
      parameters:
      - name: campaignId
        in: query
        description: The campaign's id (UUID)
        required: true
        schema:
          type: string
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "200":
          description: The campaign
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "campaignId is not a valid id, `{\"code\", \"error\", \"errors\"\
            ?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "404":
          description: "No such campaign on this account, `{\"code\", \"error\", \"\
            errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/create:
    post:
      tags:
      - Strategies Rest API
      summary: Start a PAPER-farm campaign
      description: "A delta-neutral long+short pair on Papertrade, repeated until\
        \ stopped. 409 while the team already runs a campaign (one at a time per account),\
        \ or while one in error still holds legs."
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStrategyCampaignRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "201":
          description: "The campaign, started"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "Invalid parameter, or the leverage guard rejected the combination,\
            \ `{\"code\", \"error\", \"errors\"?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only, or the paper_farm_bot\
            \ feature is not enabled for this team, `{\"code\", \"error\", \"errors\"\
            ?}`"
        "409":
          description: "The team already has an active campaign, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/kill:
    post:
      tags:
      - Strategies Rest API
      summary: Hard-kill a campaign
      description: "Close every open leg at market now, then the campaign reaches\
        \ stopped. Valid from any status, including error."
      operationId: kill
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StrategyCampaignActionRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "202":
          description: The kill was accepted; the campaign closes asynchronously
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "campaign_id is missing or not a valid id, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "404":
          description: "No such campaign on this account, `{\"code\", \"error\", \"\
            errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/pause:
    post:
      tags:
      - Strategies Rest API
      summary: Pause a campaign
      description: No new cycle starts; the open one still closes at its target.
      operationId: pause
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StrategyCampaignActionRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "200":
          description: "The campaign, paused"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "campaign_id is missing or not a valid id, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "404":
          description: "No such campaign on this account, `{\"code\", \"error\", \"\
            errors\"?}`"
        "409":
          description: "Not a valid transition from the campaign's current status,\
            \ `{\"code\", \"error\", \"errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/resume:
    post:
      tags:
      - Strategies Rest API
      summary: Resume a paused or errored campaign
      description: "paused -> running. A campaign in error also retries from here:\
        \ its open legs are watched again."
      operationId: resume
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StrategyCampaignActionRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "200":
          description: "The campaign, running"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "campaign_id is missing or not a valid id, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only, or the paper_farm_bot\
            \ feature is not enabled for this team, `{\"code\", \"error\", \"errors\"\
            ?}`"
        "404":
          description: "No such campaign on this account, `{\"code\", \"error\", \"\
            errors\"?}`"
        "409":
          description: "Not a valid transition from the campaign's current status,\
            \ `{\"code\", \"error\", \"errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/strategies/campaigns/stop:
    post:
      tags:
      - Strategies Rest API
      summary: Stop a campaign gracefully
      description: "The open cycle closes at its target first, then the campaign reaches\
        \ stopped. Not valid from error (which still holds legs): resume or kill it\
        \ instead."
      operationId: stop
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StrategyCampaignActionRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later, `{\"code\", \"error\", \"\
            errors\"?}`"
        "200":
          description: "The campaign, stopping or stopped"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyCampaign'
        "400":
          description: "campaign_id is missing or not a valid id, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only, `{\"code\", \"error\"\
            , \"errors\"?}`"
        "404":
          description: "No such campaign on this account, `{\"code\", \"error\", \"\
            errors\"?}`"
        "409":
          description: "Not a valid transition from the campaign's current status,\
            \ `{\"code\", \"error\", \"errors\"?}`"
        "503":
          description: "The strategies service is unavailable, `{\"code\", \"error\"\
            , \"errors\"?}`"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/balance:
    get:
      tags:
      - Rest API
      summary: Returns the balance of assets in an exchange on default account
      description: shows the asset balance > 0
      operationId: getBalance
      parameters:
      - name: exchange
        in: query
        description: The exchange
        required: true
        schema:
          $ref: '#/components/schemas/TradingExchange'
      - name: subaccount
        in: query
        description: Sub-account
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The list of asset balance > 0
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AssetBalanceResponse'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/listenKey:
    get:
      tags:
      - Rest API
      summary: Create a listenKey for the user data WebSocket stream
      description: "Returns a listenKey (JWT, valid 1 hour) to authenticate on wss://<host>/api/v2/ws?listenKey=<listenKey>.\
        \ See the WebSocket API documentation (asynapi.yml)."
      operationId: listenKey
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The listenKey token
          content:
            application/json:
              schema:
                type: string
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/margin:
    get:
      tags:
      - Rest API
      summary: Returns the margin and equity summary of a futures account on an exchange
      description: "Account value is `equity`, which already includes unrealised PnL.\
        \ `position_value` is exposure, not money. `remaining_cushion`, `liq_distance`,\
        \ and `vol_cover` measure margin the same way on every exchange; they are\
        \ absent for Binance portfolio-margin and Kraken accounts, and when price\
        \ history is missing. `raw_margin_ratio` is the exchange's own account ratio,\
        \ as the exchange reports it. Fields the exchange does not report are omitted.\
        \ An exchange without support, or a venue-side failure, returns 400 with {\"\
        error\": \"...\"}."
      operationId: getAccountMargin
      parameters:
      - name: exchange
        in: query
        description: The exchange
        required: true
        schema:
          $ref: '#/components/schemas/TradingExchange'
      - name: subaccount
        in: query
        description: Sub-account
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The account margin summary
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountMarginResponse'
        "400":
          description: "The exchange does not support a margin summary, or the venue\
            \ call failed"
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/byId:
    get:
      tags:
      - Rest API
      summary: Returns the order details for all matching orders
      description: Either orderIds or clientOrderIds has to be provided for matching
      operationId: getOrders
      parameters:
      - name: orderIds
        in: query
        description: The list of anboto generated order ids
        schema:
          type: array
          nullable: true
          items:
            type: integer
            format: int64
      - name: clientOrderIds
        in: query
        description: The list of client generated order ids
        schema:
          type: array
          nullable: true
          items:
            type: string
      - name: include_trades
        in: query
        description: Whether to include trades for the matching orders
        schema:
          type: boolean
          nullable: true
      - name: include_fees
        in: query
        description: Whether to include aggregated fees per currency for the matching
          orders
        schema:
          type: boolean
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: return a list of matching orders
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetailsList'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/cancel:
    post:
      tags:
      - Rest API
      summary: Cancels the parent order
      description: This will initiate a cancellation request and set the order state
        to pending cancel. For the finalized state call /order/id?orderId=xxx
      operationId: cancelOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelUpstreamOrderRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: Cancellation request processed and in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummary'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/cancelAll:
    get:
      tags:
      - Rest API
      summary: Cancels all open orders
      description: All orders that are not in a terminal state will be cancelled
      operationId: cancelAllOpenOrders
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The list of open orders that will be cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetailsList'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/cancelMany:
    post:
      tags:
      - Rest API
      summary: Cancels all of the parent orders specified in the batch request
      description: This will initiate the order cancellations and set the status of
        all orders to pending cancel. For the finalized state call /order?orderId=xxx
      operationId: cancelMany
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelManyUpstreamOrdersRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: Cancellation request processed and in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummary'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/create:
    post:
      tags:
      - Rest API
      summary: Create a new order
      description: Process a new order request and return order response
      operationId: createOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateParentOrderRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "201":
          description: Order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummary'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/createMany:
    post:
      tags:
      - Rest API
      summary: Creates many new orders in a single request.
      description: "Process a set of new order request and returns a summary for each\
        \ order, the orders are not linked during execution and this endpoint is for\
        \ convenience only"
      operationId: createManyOrders
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateManyParentOrdersRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "201":
          description: Order processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummaryList'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/createMany/multilegs:
    post:
      tags:
      - Rest API
      summary: Creates many new multilegs orders in a single request.
      description: "Process a set of new order request and returns a summary for each\
        \ order, the orders are not linked during execution and this endpoint is for\
        \ convenience only"
      operationId: createManyMultiLegsOrders
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateManyMultiLegsParentOrdersRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "201":
          description: Order processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummaryList'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/create_multiLegs:
    post:
      tags:
      - Rest API
      summary: Create a new multilegs order
      description: Process a new order request and return order response
      operationId: createMultiLegsOrder
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMultiLegsParentOrderRequest'
        required: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "201":
          description: Order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderSummary'
        "401":
          description: "Unauthorized: missing or unknown API key"
        "403":
          description: "Forbidden: the API key is read-only (its owner has no trade\
            \ permission on the account)"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/find:
    get:
      tags:
      - Rest API
      summary: Returns the order details for all matching orders
      description: Only matched order within 3 days will be return
      operationId: findOrders
      parameters:
      - name: startMs
        in: query
        description: The start time for the query as ms since epoch
        schema:
          type: integer
          format: int64
          nullable: true
      - name: endMs
        in: query
        description: The end time for the query as ms since epoch
        schema:
          type: integer
          format: int64
          nullable: true
      - name: limit
        in: query
        description: The maximum number of orders to return in the results
        schema:
          type: integer
          format: int32
          nullable: true
      - name: include_trades
        in: query
        description: Whether to include the fills (trades) of the matching orders
        schema:
          type: boolean
          nullable: true
      - name: include_fees
        in: query
        description: Whether to include aggregated fees per currency for the matching
          orders
        schema:
          type: boolean
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The list of matching orders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetailsList'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/order/open:
    get:
      tags:
      - Rest API
      summary: Returns all open orders
      description: All orders that are not in a terminal state will be returned
      operationId: getOpenOrders
      parameters:
      - name: include_trades
        in: query
        description: "Whether to include the fills (trades) of the open orders, default\
          \ false"
        schema:
          type: boolean
          nullable: true
      - name: include_fees
        in: query
        description: "Whether to include aggregated fees per currency for the open\
          \ orders, default false"
        schema:
          type: boolean
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The list of open orders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetailsList'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/position:
    get:
      tags:
      - Rest API
      summary: Returns the position of assets in an exchange on default account
      description: shows the asset position != 0
      operationId: getPosition
      parameters:
      - name: exchange
        in: query
        description: The exchange
        required: true
        schema:
          $ref: '#/components/schemas/TradingExchange'
      - name: subaccount
        in: query
        description: Sub-account
        schema:
          type: string
          nullable: true
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: The list of asset positions != 0
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccountPositionResponse'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /api/v2/trading/userTrades:
    get:
      tags:
      - Rest API
      summary: Returns the trades of orders in an exchange on default account by a
        list of order Ids/client order Ids
      description: Either orderIds or clientOrderIds has to be provided for matching
      operationId: getUserTrades
      parameters:
      - name: exchange
        in: query
        description: The exchange
        required: true
        schema:
          $ref: '#/components/schemas/TradingExchange'
      - name: subaccount
        in: query
        description: Sub-account
        schema:
          type: string
          nullable: true
      - name: orderIds
        in: query
        description: The list of anboto generated order ids
        schema:
          type: array
          nullable: true
          items:
            type: integer
            format: int64
      - name: clientOrderIds
        in: query
        description: The list of client generated order ids
        schema:
          type: array
          nullable: true
          items:
            type: string
      responses:
        "429":
          description: "Rate limit exceeded, retry later"
        "200":
          description: A list of matching trades.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeDetailsList'
        "401":
          description: "Unauthorized: missing or unknown API key"
      security:
      - ApiKeyAuth: []
  /status/ping:
    get:
      tags:
      - Status
      summary: Service health check
      description: Returns service status and the current server timestamp in milliseconds.
        No authentication required.
      operationId: status
      responses:
        "200":
          description: Service is up
          content:
            application/json:
              schema:
                type: string
                example: "{status=ok, timestamp=1783329083000}"
components:
  schemas:
    AccountMarginResponse:
      type: object
      properties:
        equity:
          type: number
          description: "Account equity: wallet balance plus unrealised PnL"
          format: double
          nullable: true
        balance:
          type: number
          description: "Wallet balance, excluding unrealised PnL"
          format: double
          nullable: true
        unrealized_pnl:
          type: number
          description: Unrealised PnL across open positions
          format: double
          nullable: true
        position_value:
          type: number
          description: "Total notional of open positions (exposure, not account value)"
          format: double
          nullable: true
        total_initial_margin:
          type: number
          description: Initial margin locked by open positions
          format: double
          nullable: true
        total_maint_margin:
          type: number
          description: Maintenance margin requirement
          format: double
          nullable: true
        total_order_margin:
          type: number
          description: "Margin locked by open orders, where the exchange reports it\
            \ separately"
          format: double
          nullable: true
        margin_ratio:
          type: number
          description: "Maintenance margin over equity, normalised to 0..1 (liquidation\
            \ approached at 1)"
          format: double
          nullable: true
        raw_margin_ratio:
          type: number
          description: Venue-native account margin ratio as sent (conventions differ).
            Omitted when the venue has no native account ratio.
          format: double
          nullable: true
        raw_margin_field:
          type: string
          description: "Venue JSON key for raw_margin_ratio, e.g. uniMMR, mgnRatio,\
            \ accountMMRate."
          nullable: true
        remaining_cushion:
          type: number
          description: 1 minus margin_ratio. Negative once equity is already below
            maintenance margin.
          format: double
          nullable: true
        liq_distance:
          type: number
          description: (equity − maintenance margin) / notional. Absent for Binance
            portfolio-margin and Kraken accounts.
          format: double
          nullable: true
        vol_cover:
          type: number
          description: "Pessimistic volatility cover: (equity − maintenance margin)\
            \ / Σ(|notional| × σ). Absent for Binance portfolio-margin and Kraken\
            \ accounts, with no open positions, or when price history is missing."
          format: double
          nullable: true
        vol_sigma_window:
          type: string
          description: "Label for the σ window used in vol_cover, e.g. 24h"
          nullable: true
        margin_estimated:
          type: boolean
          description: True when maintenance margin was estimated (Lighter) rather
            than reported by the venue
          nullable: true
        effective_leverage:
          type: number
          description: Position value over equity
          format: double
          nullable: true
        available_balance:
          type: number
          description: Balance available to open new positions
          format: double
          nullable: true
        account_mode:
          type: string
          description: "Exchange account mode, where reported (for example cross or\
            \ isolated)"
          nullable: true
      description: "Margin and equity summary of a futures account on one exchange.\
        \ Account value is `equity`: it already includes unrealised PnL, so a portfolio\
        \ total adds spot holdings to `equity` and must not add `unrealized_pnl` again.\
        \ `position_value` is exposure, not money. Fields the exchange does not report\
        \ are absent rather than zero. `remaining_cushion`, `liq_distance` and `vol_cover`\
        \ measure margin the same way on every exchange; they are absent for Binance\
        \ portfolio-margin and Kraken accounts, and when price history is missing.\
        \ `raw_margin_ratio` is the exchange's own account ratio; its convention differs\
        \ between exchanges."
    AccountPositionResponse:
      type: object
      properties:
        collateral:
          type: number
          description: The collateral amount for the position
          format: double
          nullable: true
        contracts:
          type: number
          description: The number of contracts
          format: double
          nullable: true
        entryPrice:
          type: number
          description: The average entry price
          format: double
          nullable: true
        leverage:
          type: number
          description: The position leverage
          format: double
          nullable: true
        liquidationPrice:
          type: number
          description: The liquidation price
          format: double
          nullable: true
        marginMode:
          type: string
          description: The margin mode of the position
          nullable: true
          enum:
          - CROSS
          - ISOLATED
        markPrice:
          type: number
          description: The current mark price
          format: double
          nullable: true
        notional:
          type: number
          description: The notional value of the position
          format: double
          nullable: true
        side:
          type: string
          description: The position side
          nullable: true
          enum:
          - LONG
          - SHORT
          - BOTH
        symbol:
          type: string
          description: The trading symbol
          nullable: true
        timestamp:
          type: integer
          description: Unix timestamp in milliseconds
          format: int64
          nullable: true
        unrealizedPnl:
          type: number
          description: The unrealized profit and loss
          format: double
          nullable: true
      description: One open position of an account on an exchange
    ApiErrorCode:
      type: string
      description: The error code used to describe why an order was rejected.
      enum:
      - OTHER
      - QUANTITY_EXCEED
      - AUTHENTICATION_ERROR
      - INSUFFICIENT_FUNDS
      - RATE_LIMIT_EXCEEDED
      - DDOS_PROTECTION
      - EXCHANGE_NOT_AVAILABLE
      - NETWORK_ERROR
      - INVALID_ORDER
      - EXCHANGE_ERROR
      - EMS_INSTANCES_DOWN
      - SLIPPAGE_EXCEEDED
      - EXPIRY_REACHED
      - MAX_FEE_PER_GAS_IS_TOO_LOW
      - PARENT_ORDER_WAS_TERMINATED
      - MAX_PRIORITY_FEE_PER_GAS_IS_TOO_LOW
      - INVALID_QUANTITY
      - INVALID_END_TIME
      - INVALID_TRADE_TIME
      - INVALID_FEE
      - INVALID_SYMBOL
      - INVALID_TRADE_STRATEGY
      - INVALID_LIMIT_PRICE
      - INVALID_WOULD_PRICE
      - INVALID_TRIGGER_PRICE
      - INVALID_PARAM
      - INVALID_EXCHANGE
      - INVALID_SIGNATURE
      - INVALID_API_KEY
      - INVALID_TIMESTAMP
      - BATCH_OVERSIZE
      - SYSTEM_ERROR
      - INVALID_REQUEST
      - SYSTEM_BUSY
    AssetBalanceResponse:
      type: object
      properties:
        balance:
          type: number
          description: The total balance of the asset
          format: double
          nullable: true
        free:
          type: number
          description: The balance available for trading
          format: double
          nullable: true
        symbol:
          type: string
          description: The asset symbol
          nullable: true
          example: BTC
      description: Balance of one asset in an account on an exchange
    AssetCategory:
      type: string
      description: The Asset category of the order.
      enum:
      - SPOT
      - FUTURE
    AssetClass:
      type: string
      enum:
      - UNDEFINED
      - SPOT
      - FUTURE
      - OPTION
      - CFD
    CancelManyUpstreamOrdersRequest:
      required:
      - orders
      type: object
      properties:
        orders:
          type: array
          description: The list of parent cancellation requests
          items:
            $ref: '#/components/schemas/CancelUpstreamOrderRequest'
      description: Used for cancelling many parent orders at the same time
    CancelUpstreamOrderRequest:
      type: object
      properties:
        order_id:
          type: integer
          description: The Anboto generated order id
          format: int64
          nullable: true
          example: 123456
        client_order_id:
          type: string
          description: The client provided order id
          nullable: true
          example: xxx-yyy-zzzz
      description: Used for cancelling a parent order
    ClipSizeType:
      type: string
      description: The clip size for the child orders. The default is AUTOMATIC
      enum:
      - ABSOLUTE
      - PERCENTAGE
      - AUTOMATIC
      - ORDER_COUNT
    CreateManyMultiLegsParentOrdersRequest:
      required:
      - orders
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/CreateMultiLegsParentOrderRequest'
      description: A request to create many multilegs orders in a single request.
    CreateManyParentOrdersRequest:
      required:
      - orders
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/CreateParentOrderRequest'
      description: A request to create many parent orders in a single request.
    CreateMultiLegsParentOrderRequest:
      required:
      - algo
      - legs
      type: object
      properties:
        client_order_id:
          type: string
          description: A custom string to identify the order
          nullable: true
          example: ABC-12345^12-10-23
        subaccount:
          type: string
          description: The sub-account under which to trade the order
          nullable: true
        algo:
          description: The algo to execute the order
          allOf:
          - $ref: '#/components/schemas/MultiLegsAlgo'
        legs:
          type: array
          description: The order legs
          items:
            $ref: '#/components/schemas/CreateOrderLegRequest'
        start_time:
          type: string
          description: The start time in UTC
          nullable: true
          example: 2024-01-22T22:05:00Z
        end_time:
          type: string
          description: The end time in UTC
          nullable: true
          example: 2024-04-22T22:05:00Z
        params:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/MultiLegsOrderParams'
      description: Used for creating a parent order.
    CreateOrderLegRequest:
      required:
      - asset_category
      - ccy
      - exchange
      - side
      - strategy
      - symbol
      - target_value
      type: object
      properties:
        exchange:
          description: "The execution exchange, e.g. BINANCE"
          allOf:
          - $ref: '#/components/schemas/TradingExchange'
        symbol:
          type: string
          description: "The symbol using Anboto symbology, e.g. BTC/USDT"
        asset_category:
          allOf:
          - $ref: '#/components/schemas/AssetCategory'
          - type: string
            description: The asset category
            example: SPOT
        side:
          $ref: '#/components/schemas/Side'
        target_value:
          type: string
          description: The target value to be filled
          example: "12.0"
        ccy:
          type: string
          description: The currency of target value
          example: USD
        limit_price:
          type: string
          description: The exchange valid limit price for the order leg
          nullable: true
          example: "2205.10"
        strategy:
          $ref: '#/components/schemas/ExecutionStrategy'
        clip_size_type:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ClipSizeType'
          - type: string
            description: The clip size type
            example: AUTOMATIC
            default: AUTOMATIC
          default: AUTOMATIC
        clip_size_val:
          type: string
          description: "The clip size value, required if the type is ABSOLUTE or PERCENTAGE"
          nullable: true
          example: "0.01"
        params:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/OrderLegParams'
      description: Used for creating a parent order.
    CreateParentOrderRequest:
      required:
      - asset_category
      - exchange
      - quantity
      - side
      - strategy
      - symbol
      type: object
      properties:
        client_order_id:
          type: string
          description: A custom string to identify the order
          nullable: true
          example: ABC-12345^12-10-23
        exchange:
          description: "The execution exchange, e.g. BINANCE"
          allOf:
          - $ref: '#/components/schemas/TradingExchange'
        subaccount:
          type: string
          description: The sub-account under which to trade the order
          nullable: true
        symbol:
          type: string
          description: "The symbol using Anboto symbology, e.g. BTC/USDT"
        asset_category:
          allOf:
          - $ref: '#/components/schemas/AssetCategory'
          - type: string
            description: The asset category
            example: SPOT
        side:
          $ref: '#/components/schemas/Side'
        quantity:
          type: string
          description: "The quantity to trade as a exchange trade-able decimal value,\
            \ e.g. 0.015"
        strategy:
          $ref: '#/components/schemas/ExecutionStrategy'
        limit_price:
          type: string
          description: The exchange valid limit price for the order
          nullable: true
          example: "2205.10"
        limit_is_arrival:
          type: boolean
          description: Use the arrival price (the midpoint when Anboto accepts the
            order) as the limit price; params.limit_bps shifts it. Mutually exclusive
            with limit_price.
        start_time:
          type: string
          description: The start time in UTC
          nullable: true
          example: 2024-01-22T22:05:00Z
        end_time:
          type: string
          description: The end time in UTC
          nullable: true
          example: 2024-04-22T22:05:00Z
        clip_size_type:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ClipSizeType'
          - type: string
            description: The clip size type
            example: AUTOMATIC
            default: AUTOMATIC
          default: AUTOMATIC
        clip_size_val:
          type: string
          description: "The clip size value, required if the type is ABSOLUTE or PERCENTAGE"
          nullable: true
          example: "0.01"
        params:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/OrderParams'
      description: Used for creating a parent order.
    CreateStrategyCampaignRequest:
      required:
      - exchange_id
      - leverage
      - margin_per_leg
      - symbol
      - target_move_bps
      - type
      type: object
      properties:
        type:
          type: string
          description: Campaign type; today only paper_farm
          default: paper_farm
        exchange_id:
          type: string
          description: The venue to farm on; today only papertrade
          default: papertrade
        symbol:
          type: string
          description: "Anboto symbol, BTC/USDC:USDC or ETH/USDC:USDC"
          nullable: true
          example: BTC/USDC:USDC
        leverage:
          type: integer
          description: "Leverage of each leg, 1-1000 (the leverage guard caps it well\
            \ below 1000 in practice)"
          format: int32
          nullable: true
        margin_per_leg:
          type: number
          description: "Margin to post per leg at the start of a cycle, in USDC (>=\
            \ 10)"
          format: double
          nullable: true
        target_move_bps:
          type: integer
          description: "Winning-leg move, in basis points, that closes a cycle (50-100)"
          format: int32
          nullable: true
        max_cycles:
          type: integer
          description: Stop after this many cycles; omit or null for unlimited
          format: int32
          nullable: true
        budget_usdc:
          type: number
          description: Stop once this much USDC has been spent; omit or null for no
            cap
          format: double
          nullable: true
        stop:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/StrategyStopRules'
          - type: object
            description: Optional stop rules; every field defaults as in StrategyStopRules
      description: Start a PAPER-farm campaign
    DepthMode:
      type: string
      description: How placement and cancel are measured. LEVEL walks the book. BPS_SPREAD
        is basis points from the midpoint. Omitted means LEVEL.
      enum:
      - LEVEL
      - BPS_SPREAD
    ExchangeCode:
      type: string
      description: "Platform exchange identifier (all venues, including ones not tradable\
        \ via the API)"
      enum:
      - BINANCE
      - HUOBI
      - COINBASE_ADV
      - GATEIO
      - KRAKEN
      - KUCOIN
      - OKX
      - BYBIT
      - WOO
      - MEXC
      - BITGET
      - BULLISH
      - B2C2
      - HYPERLIQUID
      - COINBASE_PRIME
      - COINBASE_INTL
      - EXTENDED
      - LIGHTER
      - PAPERTRADE
    ExecutionStrategy:
      type: string
      description: The execution strategy for the order.
      enum:
      - TWAP
      - VWAP
      - ICEBERG
      - POV
      - MARKET
      - LIMIT
      - IS
      - SCALE
    FlowRecord:
      required:
      - asset
      - counted_in_pnl
      - direction
      - exchange
      - external
      - id
      - net_flow_usd
      - qty
      - source
      - subaccount
      - time
      - type
      - usd_value
      type: object
      properties:
        id:
          type: string
          description: Stable identifier of the flow
          nullable: true
        time:
          type: integer
          description: "Event time, ms since epoch"
          format: int64
          nullable: true
        exchange:
          type: string
          nullable: true
        subaccount:
          type: string
          description: '"" is the main account'
          nullable: true
        type:
          type: string
          nullable: true
          enum:
          - deposit
          - withdrawal
          - internal_transfer
        direction:
          type: string
          description: Direction for this account
          nullable: true
          enum:
          - in
          - out
          - internal
          - unknown
        external:
          type: boolean
          description: True for flows that cross the team's boundary (deposits and
            withdrawals)
          nullable: true
        asset:
          type: string
          nullable: true
        qty:
          type: number
          description: "Absolute amount of the asset, with every stored decimal digit"
          nullable: true
        usd_value:
          type: number
          description: USD value at the event time; null when the asset could not
            be priced
          format: double
          nullable: true
        net_flow_usd:
          type: number
          description: "Signed contribution to the total-scope net_flows of the daily\
            \ PnL (positive in, negative out). 0 for transfers within one account\
            \ (whatever the price) and for unknown directions. null when the asset\
            \ could not be priced: the flow is then not in the USD totals and is counted\
            \ in totals.unpriced_count. counted_in_pnl is false whenever net_flow_usd\
            \ is 0 for those reasons or null"
          format: double
          nullable: true
        counted_in_pnl:
          type: boolean
          description: "Whether the flow moves net_flows of the daily PnL: true when\
            \ net_flow_usd is not null and direction is in or out"
          nullable: true
        source:
          type: string
          description: "Exchange history the flow was read from, e.g. binance_deposit,\
            \ binance_sub_transfer"
          nullable: true
      description: "One deposit, withdrawal or internal transfer leg"
    FlowTotals:
      required:
      - deposits_usd
      - net_external_usd
      - net_internal_usd
      - unpriced_count
      - withdrawals_usd
      type: object
      properties:
        deposits_usd:
          type: number
          description: Sum of deposits (≥ 0)
          format: double
          nullable: true
        withdrawals_usd:
          type: number
          description: "Sum of withdrawals, signed (≤ 0)"
          format: double
          nullable: true
        net_external_usd:
          type: number
          description: deposits_usd + withdrawals_usd
          format: double
          nullable: true
        net_internal_usd:
          type: number
          description: Net of internal transfers counted in PnL (non-zero when the
            selection is part of the team)
          format: double
          nullable: true
        unpriced_count:
          type: integer
          description: Flows whose net_flow_usd is null (unpriced); they are not in
            the USD sums
          format: int32
          nullable: true
      description: Sums of net_flow_usd over the whole window and selection
    FundingRate:
      required:
      - exchange
      - nextTime
      - rate
      - symbol
      - time
      type: object
      properties:
        exchange:
          type: string
        symbol:
          type: string
        time:
          type: string
          format: date-time
        nextTime:
          type: string
          format: date-time
        rate:
          type: number
          format: double
        nextRate:
          type: number
          format: double
          nullable: true
        markPrice:
          type: number
          format: double
          nullable: true
    Instrument:
      required:
      - assetClass
      - baseAsset
      - enabled
      - exchange
      - exchangeAssetClass
      - exchangeSymbol
      - quoteAsset
      - symbol
      - timestamp
      type: object
      properties:
        exchange:
          $ref: '#/components/schemas/ExchangeCode'
        symbol:
          type: string
        baseAsset:
          type: string
        quoteAsset:
          type: string
        exchangeSymbol:
          type: string
        exchangeAssetClass:
          type: string
        assetClass:
          $ref: '#/components/schemas/AssetClass'
        quantityPrecision:
          type: integer
          format: int32
          nullable: true
        pricePrecision:
          type: integer
          format: int32
          nullable: true
        maxQuantityLimit:
          type: number
          format: double
          nullable: true
        minQuantityLimit:
          type: number
          format: double
          nullable: true
        minCostLimit:
          type: number
          format: double
          nullable: true
        maxCostLimit:
          type: number
          format: double
          nullable: true
        contractSize:
          type: number
          format: double
          nullable: true
        minMarketLimit:
          type: number
          format: double
          nullable: true
        maxMarketLimit:
          type: number
          format: double
          nullable: true
        minPriceLimit:
          type: number
          format: double
          nullable: true
        maxPriceLimit:
          type: number
          format: double
          nullable: true
        enabled:
          type: boolean
        timestamp:
          type: string
          format: date-time
        priceSignificantFigure:
          type: integer
          format: int32
          nullable: true
        quantitySignificantFigure:
          type: integer
          format: int32
          nullable: true
        assetId:
          type: string
          nullable: true
    LedgerCoverage:
      required:
      - exchange
      - ingested_through
      - market
      - reason
      - status
      - subaccount
      type: object
      properties:
        exchange:
          type: string
          nullable: true
        subaccount:
          type: string
          description: '"" is the main account; null means every account on the exchange'
          nullable: true
        market:
          type: string
          nullable: true
          enum:
          - spot
          - future
        status:
          type: string
          nullable: true
          enum:
          - complete
          - partial
          - unsupported
        ingested_through:
          type: string
          description: UTC time up to which income is ingested
          format: date-time
          nullable: true
        reason:
          type: string
          description: "Why the account is partial or unsupported, e.g. exchange_not_supported,\
            \ key_invalid"
          nullable: true
      description: Income ingestion status of one account and market
    LedgerRow:
      required:
      - commission
      - date
      - exchange
      - fee_rebate
      - funding
      - interest
      - market
      - net
      - other
      - realized_pnl
      - subaccount
      - symbol
      type: object
      properties:
        date:
          type: string
          description: UTC day (YYYY-MM-DD); null when group_by is symbol
          format: date
          nullable: true
        exchange:
          type: string
          nullable: true
        subaccount:
          type: string
          description: '"" is the main account'
          nullable: true
        symbol:
          type: string
          description: "Anboto symbol, e.g. BTC/USDT:USDT (futures) or BTC/USDT (spot);\
            \ null when group_by is day or for income without a symbol"
          nullable: true
        market:
          type: string
          nullable: true
          enum:
          - spot
          - future
        realized_pnl:
          type: number
          description: "Realized trading PnL; null for market spot (trading fees only),\
            \ never 0"
          format: double
          nullable: true
        funding:
          type: number
          description: "Funding; null for market spot (trading fees only), never 0"
          format: double
          nullable: true
        commission:
          type: number
          description: "Trading fees (≤ 0), spot and futures"
          format: double
          nullable: true
        fee_rebate:
          type: number
          description: "Fee rebates (≥ 0), spot and futures"
          format: double
          nullable: true
        interest:
          type: number
          description: "Margin interest: not ingested, 0"
          format: double
          nullable: true
        other:
          type: number
          description: "Other PnL-relevant income; null for market spot (trading fees\
            \ only), never 0"
          format: double
          nullable: true
        net:
          type: number
          description: "Net realized (futures): sum of the row's components. Null\
            \ for market spot: spot trading fees are in commission and fee_rebate\
            \ only, never in net"
          format: double
          nullable: true
      description: "Income of one day and/or symbol of one account, in USD"
    LedgerTotals:
      required:
      - commission
      - fee_rebate
      - funding
      - interest
      - net
      - other
      - realized_pnl
      type: object
      properties:
        realized_pnl:
          type: number
          description: Realized trading PnL; null when the selection has no futures
            scope
          format: double
          nullable: true
        funding:
          type: number
          description: "Funding: positive when received; null when the selection has\
            \ no futures scope"
          format: double
          nullable: true
        commission:
          type: number
          description: Trading fees (≤ 0)
          format: double
          nullable: true
        fee_rebate:
          type: number
          description: Fee rebates (≥ 0)
          format: double
          nullable: true
        interest:
          type: number
          description: "Margin interest: not ingested, 0"
          format: double
          nullable: true
        other:
          type: number
          description: Other PnL-relevant income; null when the selection has no futures
            scope
          format: double
          nullable: true
        net:
          type: number
          description: "Net realized (futures): the sum of the futures components.\
            \ Spot trading fees are in commission and fee_rebate but not in net, so\
            \ with a spot scope in the selection net is not the sum of the values\
            \ above. Null when the selection has no futures scope"
          format: double
          nullable: true
      description: "Income components in USD. net is the net realized PnL of the futures\
        \ scopes only: spot trading fees are in commission and fee_rebate but not\
        \ in net. Every value is null when no day of the window is covered"
    MultiLegsAlgo:
      type: string
      description: The execution strategy for the order.
      enum:
      - PAIR
    MultiLegsOrderParams:
      type: object
      properties: {}
      description: The advanced order parameters to modify the execution behavior.
    OrderDetails:
      required:
      - average_price
      - filled_quantity
      - last_price
      - last_quantity
      - leaves_quantity
      type: object
      properties:
        order_id:
          type: integer
          description: The Anboto generated order id
          format: int64
          nullable: true
          example: 123456
        client_order_id:
          type: string
          description: The client provided order id
          nullable: true
          example: xxx-yyy-zzz
        symbol:
          type: string
          description: The order symbol in Anboto's symbology
          nullable: true
        status:
          description: The order status
          allOf:
          - $ref: '#/components/schemas/OrderStatus'
          - type: string
            description: The order status
        asset_class:
          description: The asset class
          nullable: true
          allOf:
          - $ref: '#/components/schemas/AssetCategory'
          - type: string
            description: The asset classification
            example: SPOT
        exchange:
          description: The exchange
          nullable: true
          allOf:
          - $ref: '#/components/schemas/TradingExchange'
          - type: string
            description: The exchange where the order executing
        strategy:
          description: Order Strategy
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ExecutionStrategy'
          - type: string
            description: The trading strategy of the order
            example: VWAP
        start_time:
          type: number
          description: The time when the order start trading from epoch time in ms
          nullable: true
        end_time:
          type: number
          description: The scheduled end of the execution from epoch time in ms while
            the order is working (e.g. start_time + duration for a TWAP); the time
            the order reached its terminal state once finished
          nullable: true
        quantity:
          type: number
          description: "The total quantity of the parent order in base asset, as placed.\
            \ Absent for value-target (notional) orders, see target_value"
          nullable: true
          example: 6
        filled_quantity:
          type: number
          description: The absolute amount of the order quantity filled
          example: 0
        leaves_quantity:
          type: number
          description: "The absolute amount of the parent order quantity remaining\
            \ to be filled (quantity - filled_quantity, 0 once the order is terminal).\
            \ This is the parent order's remainder, never the leaves of the child\
            \ order currently working it"
          example: 0
        progress:
          type: number
          description: "Execution progress of the parent order between 0 and 1: filled_quantity\
            \ / quantity, or filled notional / target_value for value-target orders.\
            \ Same computation as the WebSocket order topic orderProgress; 1 once\
            \ FILLED. Absent when the parent order is not known"
          nullable: true
          example: 0.1783
        side:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/Side'
        last_quantity:
          type: number
          description: The last qty received in a fill from the exchange
          example: 0
        last_price:
          type: number
          description: The last price executed on the exchange
          example: 0
        average_price:
          type: number
          description: The average execution price of the order
          example: 0
        limit_price:
          type: number
          description: "The limit price of the parent order, if one was set"
          nullable: true
        clip_size_type:
          description: "The clip size type of the parent order, if any."
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ClipSizeType'
          - type: string
            description: "The clip size type of the parent order, as placed"
        clip_size_val:
          type: number
          description: "The clip size value of the parent order, as placed"
          nullable: true
        target_value:
          type: number
          description: The target notional of a value-target order (e.g. a multi-leg
            order leg); quantity is absent for such orders
          nullable: true
        params:
          description: The advanced parameters the parent order was placed with.
          nullable: true
          allOf:
          - $ref: '#/components/schemas/OrderParams'
          - type: object
            description: "The advanced order parameters the parent order was placed\
              \ with (duration_seconds, trading_style, ...). Absent when the order\
              \ has none"
        trades:
          type: array
          description: The list of trades associated with this order when include_trades=true
          nullable: true
          items:
            $ref: '#/components/schemas/TradeDetails'
        fees_infos:
          type: object
          additionalProperties:
            type: number
          description: Aggregated fees per currency when include_fees=true
          nullable: true
    OrderDetailsList:
      required:
      - orders
      type: object
      properties:
        orders:
          type: array
          description: The list of order details for separate orders.
          items:
            $ref: '#/components/schemas/OrderDetails'
    OrderLegParams:
      type: object
      properties:
        duration_seconds:
          type: string
          description: "The duration of the order in seconds, this is a required field\
            \ for TWAP and VWAP."
          nullable: true
          example: "120"
        trading_style:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/TradingStyle'
          - type: string
            description: The trading style to use for the order
        urgency:
          description: IS strategy
          nullable: true
          allOf:
          - $ref: '#/components/schemas/Urgency'
          - type: string
            description: "The urgency level to use for the IS strategy. Default: MEDIUM"
        randomize_amount:
          type: boolean
          description: Whether to randomize the slice amount
          nullable: true
        would:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/WouldInfo'
        trigger:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/TriggerInfo'
        placement_infos:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PlacementInfo'
          - type: object
            description: The placement information for the order
        is_leading:
          type: boolean
          description: true if this is a leading leg
        timer_iceberg_delay:
          type: number
          description: "Seconds between Iceberg and Scale clips, between 0.25 and\
            \ 3600. Omitted: the engine uses 0.25"
          nullable: true
          example: 0.5
        timer_iceberg_delay_min:
          type: number
          description: "Lower bound, in seconds, of the Iceberg/Scale clip delay.\
            \ May be 0. Set together with timer_iceberg_delay_max"
          nullable: true
          example: 0
        timer_iceberg_delay_max:
          type: number
          description: "Upper bound, in seconds, of the Iceberg/Scale clip delay,\
            \ up to 3600. Set together with timer_iceberg_delay_min"
          nullable: true
          example: 10
        randomize_iceberg_timer:
          type: boolean
          description: "Randomize the Iceberg/Scale clip delay between 80% and 120%\
            \ of timer_iceberg_delay. A min/max band replaces that draw when both\
            \ bounds are set. Omitted: the engine uses true. Explicit false cannot\
            \ be combined with the band"
          nullable: true
        extend_duration:
          type: boolean
          description: "TWAP, VWAP, and IS: extend the scheduled end past duration_seconds\
            \ by a buffer, still capped by end_time. Omitted: the engine uses true"
          nullable: true
      description: The advanced order parameters to modify the execution behavior.
    OrderParams:
      type: object
      properties:
        duration_seconds:
          type: string
          description: "The duration of the order in seconds, this is a required field\
            \ for TWAP and VWAP."
          nullable: true
          example: "120"
        trading_style:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/TradingStyle'
          - type: string
            description: The trading style to use for the order
        urgency:
          description: IS strategy
          nullable: true
          allOf:
          - $ref: '#/components/schemas/Urgency'
          - type: string
            description: "The urgency level to use for the IS strategy. Default: MEDIUM"
        pov_ratio:
          type: number
          description: "Target participation in market volume, in percent (e.g. 5\
            \ = 5 %). Required for POV, between 0.01 and 33"
          nullable: true
          example: 5
        pov_risk:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PovRisk'
          - type: string
            description: "POV only: how far the order may fall behind its target before\
              \ the next child order is sent (LOW 2 %, DEFAULT 7.5 %, HIGH 15 %).\
              \ Default: DEFAULT"
        randomize_amount:
          type: boolean
          description: Whether to randomize the slice amount
          nullable: true
        would:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/WouldInfo'
        trigger:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/TriggerInfo'
        placement_infos:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PlacementInfo'
          - type: object
            description: The placement information for the order
        reduce_only:
          type: boolean
          description: Reduce Only for future positions
        start_ladder_price:
          type: string
          description: Start price for Scale (ICEBERG) ladder
          nullable: true
        end_ladder_price:
          type: string
          description: End price for Scale (ICEBERG) ladder
          nullable: true
        ladder_direction:
          type: string
          description: "Scale ladder direction: upwards or downwards"
          nullable: true
        ladder_profile:
          type: string
          description: "Scale ladder profile. Default: linear"
          nullable: true
        size_skew:
          type: number
          description: "Scale size skew (1 = linear). Default: 1"
          nullable: true
        ob_imbalance_cancel:
          type: boolean
          description: Cancel resting child orders and pause re-posting while the
            orderbook L1 imbalance leans against the order
          nullable: true
        ob_imbalance_threshold:
          type: string
          description: "Opposing-side share of L1 quantity that triggers the imbalance\
            \ cancel, between 0.5 and 0.99. Default: 0.75. Only used with ob_imbalance_cancel"
          nullable: true
          example: "0.75"
        price_lock_bps:
          type: string
          description: "Opportunistic completion: take the full remainder aggressively\
            \ when the market is this many bps better than the arrival price, between\
            \ 1 and 100"
          nullable: true
          example: "5"
        limit_is_arrival:
          type: boolean
          description: Use the arrival price (the midpoint when Anboto accepts the
            order) as the limit price; limit_bps shifts it. Mutually exclusive with
            top-level limit_price.
          nullable: true
        limit_bps:
          type: string
          description: Signed bps vs the parent cap (arrival or numeric limit_price).
            Positive = must be better; negative = may be worse. Range -100 to 100.
            Omitted or 0 leaves the cap unchanged.
          nullable: true
          example: "-10"
        timer_iceberg_delay:
          type: number
          description: "Seconds between Iceberg and Scale clips, between 0.25 and\
            \ 3600. Omitted: the engine uses 0.25"
          nullable: true
          example: 0.5
        timer_iceberg_delay_min:
          type: number
          description: "Lower bound, in seconds, of the Iceberg/Scale clip delay.\
            \ May be 0. Set together with timer_iceberg_delay_max. When both are set,\
            \ the engine draws once from this band instead of 80–120% of timer_iceberg_delay"
          nullable: true
          example: 0
        timer_iceberg_delay_max:
          type: number
          description: "Upper bound, in seconds, of the Iceberg/Scale clip delay,\
            \ up to 3600. Set together with timer_iceberg_delay_min"
          nullable: true
          example: 10
        randomize_iceberg_timer:
          type: boolean
          description: "Randomize the Iceberg/Scale clip delay between 80% and 120%\
            \ of timer_iceberg_delay. A min/max band replaces that draw when both\
            \ bounds are set. Omitted: the engine uses true. Explicit false cannot\
            \ be combined with the band"
          nullable: true
        extend_duration:
          type: boolean
          description: "TWAP, VWAP, and IS: extend the scheduled end past duration_seconds\
            \ by a buffer, still capped by end_time. Omitted: the engine uses true"
          nullable: true
      description: The advanced order parameters to modify the execution behavior.
    OrderStatus:
      type: string
      description: The order status
      enum:
      - PENDING_NEW
      - ACCEPTED
      - REJECTED
      - PARTIALLY_FILLED
      - FILLED
      - PENDING_CANCEL
      - CANCELLED
      - PENDING_PAUSE
      - PAUSED
      - PENDING_UNPAUSE
      - EXPIRED
      - CANCEL_REJECTED
    OrderSummary:
      required:
      - created_at
      type: object
      properties:
        order_id:
          type: integer
          description: The Anboto assigned order identifier
          format: int64
          nullable: true
        client_order_id:
          type: string
          description: A custom string to identify the order
          nullable: true
          example: ABC-12345^12-10-23
        status:
          description: "The status of the order, e.g. PENDING_NEW"
          nullable: true
          allOf:
          - $ref: '#/components/schemas/OrderStatus'
        created_at:
          type: string
          description: The time in UTC when the order was created
          format: date-time
          nullable: true
          example: 2024-01-22T22:05:00Z
        message:
          type: string
          description: "Any additional information, usually if the order was rejected"
          nullable: true
        error_code:
          description: The error code if the order was rejected
          nullable: true
          allOf:
          - $ref: '#/components/schemas/ApiErrorCode'
          - type: string
            description: The error code if the order was rejected
            example: INVALID_ORDER
      description: Summarizes the state of the parent order
    OrderSummaryList:
      required:
      - orders
      type: object
      properties:
        orders:
          type: array
          description: The list of order summaries for separate orders.
          items:
            $ref: '#/components/schemas/OrderSummary'
    PlacementInfo:
      required:
      - placement_mode
      type: object
      properties:
        placement_mode:
          allOf:
          - $ref: '#/components/schemas/PlacementMode'
          - type: string
            description: How to place an order into the book
        placement:
          type: string
          description: "Where to place new orders in the book. With depth_mode level\
            \ (default) it is a book level, e.g. 2 places at the second best price.\
            \ With depth_mode bps_spread it is basis points from the midpoint, a whole\
            \ number from 1 to 500."
          nullable: true
        cancel:
          type: string
          description: "When to cancel a resting order. With depth_mode level (default)\
            \ it is a book level, e.g. 6 cancels the order once it is at level 6 of\
            \ the book. With depth_mode bps_spread it is basis points from the midpoint,\
            \ a whole number greater than placement and at most 1000."
          nullable: true
        depth_mode:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/DepthMode'
          - type: string
            description: "level walks the book. bps_spread measures placement and\
              \ cancel as basis points from the midpoint and requires both numbers.\
              \ Iceberg, Scale, POV, and DCA accept bps_spread only when trading_style\
              \ is passive. Omitted: level"
      description: How to place an order into the book
    PlacementMode:
      type: string
      description: The style used to place an order in the book. DEFAULT is the default
        and will be at the discretion of the trading strategy
      enum:
      - DEFAULT
      - TIGHT
      - CUSTOM
    PnlDateRange:
      required:
      - first_date
      - last_date
      type: object
      properties:
        first_date:
          type: string
          description: "First day (YYYY-MM-DD, UTC)"
          format: date
          nullable: true
        last_date:
          type: string
          description: "Last day (YYYY-MM-DD, UTC)"
          format: date
          nullable: true
      description: First and last UTC day of a run of PnL points
    PnlGroup:
      required:
      - as_of
      - cumulative_pnl
      - key
      - max_drawdown_pct
      - period_return_pct
      - point_count
      - reconstructed_range
      - series
      - sharpe
      - since_inception_date
      - since_inception_pnl
      - since_inception_return_pct
      - today_pnl
      type: object
      properties:
        key:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PnlGroupKey'
          - type: object
            description: The group; key fields not used by the grouping are null
        as_of:
          type: string
          description: UTC time of the newest live snapshot used for this group's
            today_pnl
          format: date-time
          nullable: true
        today_pnl:
          type: number
          description: Group PnL since 00:00 UTC; null when not available for this
            group
          format: double
          nullable: true
        cumulative_pnl:
          type: number
          description: Sum of the group's daily_pnl over the window
          format: double
          nullable: true
        period_return_pct:
          type: number
          description: "Simple return of the group over the window, in percent"
          format: double
          nullable: true
        since_inception_pnl:
          type: number
          format: double
          nullable: true
        since_inception_return_pct:
          type: number
          format: double
          nullable: true
        since_inception_date:
          type: string
          format: date
          nullable: true
        sharpe:
          type: number
          format: double
          nullable: true
        max_drawdown_pct:
          type: number
          description: In percent (≤ 0)
          format: double
          nullable: true
        estimated:
          type: boolean
          description: True when at least one of the group's days is estimated
          nullable: true
        reconstructed_range:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PnlDateRange'
          - type: object
            description: First and last day of the series points with reconstructed
              = true; null when there is none
        point_count:
          type: integer
          description: Number of points in series
          format: int32
          nullable: true
        series:
          type: array
          description: Only the days of total.series on which the group had data;
            a missing day contributed 0
          nullable: true
          items:
            $ref: '#/components/schemas/PnlPoint'
      description: PnL of one group of accounts. Ratio fields are null when not computed
        per group
    PnlGroupKey:
      required:
      - exchange
      - market
      - subaccount
      type: object
      properties:
        exchange:
          type: string
          nullable: true
        subaccount:
          type: string
          description: '"" is the main account; null when grouping by exchange'
          nullable: true
        market:
          type: string
          description: Reserved for a later market grouping; null today
          nullable: true
      description: Identity of a PnL group
    PnlPoint:
      required:
      - daily_pnl
      - daily_return_pct
      - daily_unrealized_pnl
      - date
      - drawdown_pct
      - equity_close
      - net_flows
      - quality
      - reconstructed
      - unrealized_pnl_close
      type: object
      properties:
        date:
          type: string
          description: UTC day (YYYY-MM-DD)
          format: date
          nullable: true
        daily_pnl:
          type: number
          description: "PnL of the day, net of deposits and withdrawals"
          format: double
          nullable: true
        net_flows:
          type: number
          description: "Net external flows of the day: positive for deposits, negative\
            \ for withdrawals"
          format: double
          nullable: true
        equity_close:
          type: number
          description: Equity at the day's close (00:00 UTC of the next day)
          format: double
          nullable: true
        equity_prev:
          type: number
          description: Equity at the previous close; the denominator of a time-weighted
            return
          format: double
          nullable: true
        daily_return_pct:
          type: number
          description: "daily_pnl over the flow-adjusted previous equity, in percent"
          format: double
          nullable: true
        drawdown_pct:
          type: number
          description: "Drawdown from the running peak, in percent (≤ 0)"
          format: double
          nullable: true
        daily_unrealized_pnl:
          type: number
          description: "Change of unrealised PnL over the day, where the exchange\
            \ reports it"
          format: double
          nullable: true
        unrealized_pnl_close:
          type: number
          description: "Unrealised PnL at the close, where the exchange reports it"
          format: double
          nullable: true
        quality:
          type: string
          description: "ok, or estimated when the close was not taken from a snapshot"
          nullable: true
          enum:
          - ok
          - estimated
        reconstructed:
          type: boolean
          description: "True when the day's close or the previous close was rebuilt\
            \ from the account's fills, income history and daily mark prices, for\
            \ days before its first stored daily close. quality is estimated on those\
            \ days"
          nullable: true
      description: One UTC day. daily_pnl = equity_close - equity_prev - net_flows
    PnlSummary:
      required:
      - cumulative_pnl
      - max_drawdown_pct
      - period_return_pct
      - point_count
      - reconstructed_range
      - series
      - sharpe
      - since_inception_date
      - since_inception_pnl
      - since_inception_return_pct
      - today_pnl
      type: object
      properties:
        today_pnl:
          type: number
          description: PnL since 00:00 UTC from live equity; null when no live snapshot
            exists or a flow today could not be priced
          format: double
          nullable: true
        cumulative_pnl:
          type: number
          description: Sum of daily_pnl over the window
          format: double
          nullable: true
        period_return_pct:
          type: number
          description: "Simple return over the window in percent: cumulative_pnl over\
            \ the first flow-adjusted equity (not time-weighted)"
          format: double
          nullable: true
        since_inception_pnl:
          type: number
          description: PnL since the selection's first closed day
          format: double
          nullable: true
        since_inception_return_pct:
          type: number
          description: "Simple return since inception, in percent"
          format: double
          nullable: true
        since_inception_date:
          type: string
          description: First closed day of the selection (YYYY-MM-DD)
          format: date
          nullable: true
        sharpe:
          type: number
          description: "Sharpe ratio of the daily returns, annualised with √365; null\
            \ with fewer than 2 points"
          format: double
          nullable: true
        max_drawdown_pct:
          type: number
          description: "Largest peak-to-trough drawdown in the window, in percent\
            \ (≤ 0)"
          format: double
          nullable: true
        estimated:
          type: boolean
          description: True when at least one day in the window is estimated rather
            than closed from snapshots
          nullable: true
        reconstructed_range:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PnlDateRange'
          - type: object
            description: First and last day of the series points with reconstructed
              = true; null when there is none
        point_count:
          type: integer
          description: Number of points in series
          format: int32
          nullable: true
        series:
          type: array
          description: "One point per UTC day, oldest first. Days without comparable\
            \ data are skipped"
          nullable: true
          items:
            $ref: '#/components/schemas/PnlPoint'
      description: PnL figures and daily series of a selection
    PortfolioAccountRef:
      required:
      - exchange
      - subaccount
      type: object
      properties:
        exchange:
          type: string
          description: "Exchange code, e.g. binance"
          nullable: true
        subaccount:
          type: string
          description: Subaccount name; "" is the main account and null means every
            account on the exchange
          nullable: true
      description: "An exchange account: main account, one subaccount, or every account\
        \ on the exchange"
    PortfolioFlowsResponse:
      required:
      - flows
      - from_ms
      - next_cursor
      - to_ms
      - totals
      type: object
      properties:
        from_ms:
          type: integer
          description: "Start of the window, ms since epoch (inclusive)"
          format: int64
          nullable: true
        to_ms:
          type: integer
          description: "End of the window, ms since epoch (exclusive): a flow at exactly\
            \ to_ms is not in this window. Pass it as startMs to read the next window"
          format: int64
          nullable: true
        flows:
          type: array
          description: "Flows of this page, oldest first"
          nullable: true
          items:
            $ref: '#/components/schemas/FlowRecord'
        totals:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/FlowTotals'
          - type: object
            description: Sums over the whole window and selection (every page)
        next_cursor:
          type: string
          description: Pass as `cursor` to read the next page; null on the last page
          nullable: true
      description: "Deposits, withdrawals and internal transfers of the team"
    PortfolioLedgerResponse:
      required:
      - as_of
      - coverage
      - currency
      - from_date
      - group_by
      - next_cursor
      - rows
      - to_date
      - totals
      type: object
      properties:
        as_of:
          type: string
          description: UTC time of the newest ingested income data
          format: date-time
          nullable: true
        from_date:
          type: string
          description: "First day of the window (YYYY-MM-DD, UTC)"
          format: date
          nullable: true
        to_date:
          type: string
          description: "Last day of the window (YYYY-MM-DD, UTC); today's figures\
            \ are provisional"
          format: date
          nullable: true
        group_by:
          type: string
          description: Grouping of `rows`
          nullable: true
          enum:
          - day
          - symbol
          - day_symbol
        currency:
          type: string
          description: Currency of every money value
          nullable: true
          example: USD
        coverage:
          type: array
          description: "Ingestion status per account and market. Unsupported venues\
            \ are listed here, not reported as zero"
          nullable: true
          items:
            $ref: '#/components/schemas/LedgerCoverage'
        totals:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/LedgerTotals'
          - type: object
            description: "Sums over the whole window and selection (every page). Every\
              \ value is null when no day of the window is covered (see coverage),\
              \ e.g. an account without ingested income. A component that no scope\
              \ of the selection ingests is null too: spot income is trading fees\
              \ only, so a spot-only selection has null realized_pnl, funding, other\
              \ and net. Never reported as 0"
        unpriced_assets:
          type: array
          description: Assets with income rows that could not be valued in USD; those
            amounts are missing from the USD figures
          nullable: true
          items:
            type: string
        rows:
          type: array
          description: "One row per day, symbol or day and symbol, depending on group_by"
          nullable: true
          items:
            $ref: '#/components/schemas/LedgerRow'
        next_cursor:
          type: string
          description: Pass as `cursor` to read the next page; null on the last page
          nullable: true
      description: "Realized PnL, funding and fees from the exchange income history"
    PortfolioPnlResponse:
      required:
      - accounts
      - as_of
      - currency
      - from_date
      - group_by
      - nav_usd
      - scope
      - to_date
      - total
      type: object
      properties:
        as_of:
          type: string
          description: UTC time of the newest live equity snapshot used for today_pnl;
            null when none was available
          format: date-time
          nullable: true
        nav_usd:
          type: number
          description: "Net asset value of the selection now: the sum of each account's\
            \ newest live equity snapshot (at most 3 days old; for scope spot or future,\
            \ that wallet's equity), in USD. Null when no snapshot was available"
          format: double
          nullable: true
        from_date:
          type: string
          description: "First day of the window (YYYY-MM-DD, UTC), as applied"
          format: date
          nullable: true
        to_date:
          type: string
          description: "Last day of the window (YYYY-MM-DD, UTC), as applied. Days\
            \ are closed at 00:00 UTC, so this is at most yesterday"
          format: date
          nullable: true
        scope:
          type: string
          description: Wallet scope
          nullable: true
          enum:
          - total
          - spot
          - future
        group_by:
          type: string
          description: Grouping of `groups`
          nullable: true
          enum:
          - none
          - exchange
          - account
        currency:
          type: string
          description: Currency of every money value
          nullable: true
          example: USD
        accounts:
          type: array
          description: The resolved account selection; null when the request covered
            every account of the team
          nullable: true
          items:
            $ref: '#/components/schemas/PortfolioAccountRef'
        uncovered_exchanges:
          type: array
          description: "Requested or connected exchanges without daily PnL coverage.\
            \ They are left out of every figure, never counted as zero"
          nullable: true
          items:
            type: string
        total:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PnlSummary'
          - type: object
            description: The whole selection
        groups:
          type: array
          description: "One entry per exchange or account; present only when group_by\
            \ is not none. Money values add up to `total`; ratios (returns, sharpe,\
            \ drawdown) do not"
          nullable: true
          items:
            $ref: '#/components/schemas/PnlGroup'
      description: "NAV daily PnL of the team, overall and per group"
    PovRisk:
      type: string
      description: "How far the POV strategy may fall behind its target before it\
        \ sends the next child order: LOW 2 %, DEFAULT 7.5 %, HIGH 15 % of the executed\
        \ quantity. The parameter is not case-sensitive."
      enum:
      - LOW
      - DEFAULT
      - HIGH
    PreTradeAdvice:
      type: object
      properties:
        safe_duration_seconds:
          type: integer
          description: Shortest duration rated LOW
          format: int64
          nullable: true
        moderate_duration_seconds:
          type: integer
          description: Shortest duration rated MEDIUM or better
          format: int64
          nullable: true
      description: "Advised durations, on Anboto's duration ladder"
    PreTradeAnalysis:
      required:
      - missing
      - supported
      type: object
      properties:
        supported:
          type: boolean
          description: False when the venue or symbol cannot be analysed; see missing
        missing:
          type: array
          description: "Inputs that could not be sourced (e.g. deep_book, ohlcv_1m)\
            \ or why the analysis is unavailable (disabled, exchange_not_supported,\
            \ timeout, rejected, error, stale)"
          items:
            type: string
        snapshot_timestamp:
          type: integer
          description: "Epoch ms of the market snapshot used; null when no snapshot\
            \ could be read (disabled, exchange_not_supported, timeout, rejected,\
            \ error)"
          format: int64
          nullable: true
        market:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/PreTradeMarket'
        impact:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PreTradeImpact'
          - type: object
            description: "Null for strategies without a duration model (market, limit,\
              \ order…)"
        execution:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/PreTradeExecution'
        advice:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PreTradeAdvice'
          - type: object
            description: Null for strategies without a duration model
        pov:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PreTradePov'
          - type: object
            description: "POV only: participation model, time to fill and participation\
              \ presets"
        cost_estimate:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/PreTradeCostEstimate'
          - type: object
            description: "Expected execution cost (TWAP / VWAP / IS with a duration,\
              \ POV); null without volatility or volume data"
      description: "Pre-trade analysis of an order, from Anboto's live market snapshot"
    PreTradeCostEstimate:
      required:
      - calibrated
      - horizon_seconds
      - market_risk_bps
      - model
      - pace_pct
      - permanent_bps
      - price_move_bps
      - slippage_bps
      type: object
      properties:
        slippage_bps:
          type: number
          description: Expected average execution price against arrival
          format: double
        price_move_bps:
          type: number
          description: Expected price move by the end of the execution
          format: double
        permanent_bps:
          type: number
          description: Part of the move expected to remain after the order
          format: double
        market_risk_bps:
          type: number
          description: One standard deviation of the market's own move over the execution
            time
          format: double
        horizon_seconds:
          type: integer
          description: "Execution time assumed: the duration, or the POV time to fill"
          format: int64
        pace_pct:
          type: number
          description: Order flow as a share of the rest of the market
          format: double
        model:
          type: string
        calibrated:
          type: boolean
      description: "Expected execution cost from a market-impact model (Almgren, Thum,\
        \ Hauptmann and Li, 2005) with its published coefficients, in basis points\
        \ of the arrival price. Assumes normal liquidity: market makers refill the\
        \ book and nobody trades heavily against the order. calibrated is false until\
        \ the coefficients are fitted on Anboto fills."
    PreTradeExecution:
      type: object
      properties:
        sweep_price:
          type: number
          description: "Price reached sweeping the book, half of each level assumed\
            \ available"
          format: double
          nullable: true
        slippage_pct:
          type: number
          format: double
          nullable: true
        percent_of_24h_volume:
          type: number
          format: double
          nullable: true
      description: Immediate execution figures
    PreTradeImpact:
      required:
      - model
      type: object
      properties:
        tier:
          type: string
          description: Null when no duration was given
          nullable: true
          enum:
          - LOW
          - MEDIUM
          - HIGH
        duration_seconds:
          type: integer
          format: int64
          nullable: true
        volume_participation_pct:
          type: number
          description: Percent of the median 5-minute volume
          format: double
          nullable: true
        order_book_participation_pct:
          type: number
          description: "Percent of the book depth within 20 bps, per minute"
          format: double
          nullable: true
        book_safe:
          type: boolean
          description: The book depth can absorb the flow
          nullable: true
        model:
          $ref: '#/components/schemas/PreTradeImpactModel'
      description: Participation and impact tier at the requested duration
    PreTradeImpactModel:
      required:
      - low_order_book_participation_pct
      - reference_duration_seconds
      - thresholds_high_order_book
      - thresholds_low_order_book
      type: object
      properties:
        reference_duration_seconds:
          type: integer
          format: int64
        volume_participation_pct:
          type: number
          format: double
          nullable: true
        order_book_participation_pct:
          type: number
          format: double
          nullable: true
        low_order_book_participation_pct:
          type: number
          format: double
        thresholds_low_order_book:
          $ref: '#/components/schemas/PreTradeThresholds'
        thresholds_high_order_book:
          $ref: '#/components/schemas/PreTradeThresholds'
      description: "Participation at a reference duration; pct(D) = pct × reference_duration_seconds\
        \ / D. Volume participation above medium_pct is MEDIUM and above high_pct\
        \ is HIGH, with the low order book thresholds while the order book participation\
        \ is below low_order_book_participation_pct"
    PreTradeMarket:
      type: object
      properties:
        last:
          type: number
          format: double
          nullable: true
        best_bid:
          type: number
          format: double
          nullable: true
        best_ask:
          type: number
          format: double
          nullable: true
        mark_price:
          type: number
          format: double
          nullable: true
        funding_rate:
          type: number
          description: "Current funding rate (fraction), perpetuals only"
          format: double
          nullable: true
        open_interest:
          type: number
          format: double
          nullable: true
        high_24h:
          type: number
          format: double
          nullable: true
        low_24h:
          type: number
          format: double
          nullable: true
        base_volume_24h:
          type: number
          format: double
          nullable: true
        quote_volume_24h:
          type: number
          format: double
          nullable: true
        volatility_short:
          type: number
          description: "Per-minute std of log returns, 1m candles over 5 h"
          format: double
          nullable: true
        volatility_long:
          type: number
          description: "Per-minute std of log returns, 1h candles over 3 d"
          format: double
          nullable: true
        volatility_daily:
          type: number
          description: 1h log-return stdev scaled to 1 day (×√24)
          format: double
          nullable: true
        median_volume_5m:
          type: number
          description: Median volume of the last 100 5-minute candles
          format: double
          nullable: true
        volume_timeframe_min:
          type: number
          format: double
        contract_size:
          type: number
          description: Base units per contract when volumes and depths are in contracts
            (e.g. OKX); null when they are in base units
          format: double
          nullable: true
        min_quantity:
          type: number
          format: double
          nullable: true
        quantity_precision:
          type: integer
          format: int32
          nullable: true
        book_levels:
          type: integer
          description: Order book levels used
          format: int32
        book_source:
          type: string
          description: "Order book the analysis used: memory (full exchange depth)\
            \ or redis (top 10 levels only)"
          nullable: true
      description: Market figures of the symbol
    PreTradePov:
      required:
      - pace_vs_market_pct
      - pov_ratio_pct
      - share_of_total_pct
      - thresholds
      type: object
      properties:
        pov_ratio_pct:
          type: number
          description: "Requested participation, percent of market volume"
          format: double
        pace_vs_market_pct:
          type: number
          description: Order flow as a share of the rest of the market (k)
          format: double
        share_of_total_pct:
          type: number
          description: "Order flow as a share of all market volume, own fills included"
          format: double
        estimated_fill_seconds:
          type: integer
          description: "Time to fill the quantity if market volume stays at its recent\
            \ median 5-minute volume. An estimate only: POV speeds up when volume\
            \ rises and slows down when it falls; passive and hybrid styles, or a\
            \ limit price, can be slower"
          format: int64
          nullable: true
        estimated_fill_seconds_24h:
          type: integer
          description: Same at the 24h average volume
          format: int64
          nullable: true
        thresholds:
          $ref: '#/components/schemas/PreTradeThresholds'
        safe_pov_pct:
          type: number
          description: Largest ladder participation rated LOW
          format: double
          nullable: true
        moderate_pov_pct:
          type: number
          description: Largest ladder participation rated MEDIUM or better
          format: double
          nullable: true
        high_pov_pct:
          type: number
          description: Smallest ladder participation rated HIGH
          format: double
          nullable: true
      description: "POV model. At a participation p the order trades k = p / (1 -\
        \ 2p) of everyone else's volume, because the engine counts its own fills.\
        \ The impact tier depends on p alone: pace_vs_market_pct above medium_pct\
        \ is MEDIUM, above high_pct is HIGH, whatever the book depth. The quantity\
        \ only sets the time to fill."
    PreTradeThresholds:
      required:
      - high_pct
      - medium_pct
      type: object
      properties:
        medium_pct:
          type: number
          format: double
        high_pct:
          type: number
          format: double
    Side:
      type: string
      description: The side of the book to trade.
      enum:
      - BUY
      - SELL
    StrategyCampaign:
      type: object
      properties:
        id:
          type: string
          description: Campaign id (UUID)
          nullable: true
        type:
          type: string
          description: Campaign type; today always paper_farm
          nullable: true
        status:
          type: string
          description: running | paused | stopped | done | error
          nullable: true
          enum:
          - running
          - paused
          - stopped
          - done
          - error
        stopping:
          type: boolean
          description: "A graceful stop or a hard kill is under way. Independent of\
            \ status: can be true while status stays error (the open legs are being\
            \ closed before the campaign reaches stopped)"
          nullable: true
        phase:
          type: string
          description: "Cycle phase the runner is in: idle, opening, open, closing\
            \ or settling"
          nullable: true
        stop_reason:
          type: string
          description: "Why a stopped/done campaign ended: cycles_done, budget_spent,\
            \ session_key_expiring, queued_share, user_stop or user_kill. Empty while\
            \ still running"
          nullable: true
        cycles_done:
          type: integer
          description: Cycles completed so far
          format: int32
          nullable: true
        cycles_planned:
          type: integer
          description: "max_cycles from create, or null for unlimited"
          format: int32
          nullable: true
        paper_minted:
          type: number
          description: Total PAPER minted by this campaign's losing legs
          nullable: true
        usdc_converted:
          type: number
          description: Total USDC spent converting minted PAPER (haircut + fee)
          nullable: true
        queued_usdc:
          type: number
          description: Profit queued to fund a future cycle's margin instead of being
            paid out
          nullable: true
        haircut_paid:
          type: number
          description: Total haircut paid converting PAPER to USDC
          nullable: true
        fees_paid:
          type: number
          description: Total trading fees paid by this campaign
          nullable: true
        current_legs:
          type: array
          description: "Open legs of the current cycle (0 while idle, up to 2 while\
            \ open)"
          nullable: true
          items:
            $ref: '#/components/schemas/StrategyCampaignLeg'
        last_cycle:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/StrategyCampaignCycle'
          - type: object
            description: "The most recently closed cycle, or null before the first\
              \ one closes"
        last_error:
          type: string
          description: Why the campaign is in error; empty otherwise
          nullable: true
        symbol:
          type: string
          description: "Anboto symbol being farmed, e.g. BTC/USDC:USDC"
          nullable: true
        leverage:
          type: integer
          description: Leverage of each leg
          format: int32
          nullable: true
        margin_per_leg:
          type: number
          description: "Margin posted per leg at the start of a cycle, in USDC"
          format: double
          nullable: true
        target_move_bps:
          type: integer
          description: "Winning-leg move, in basis points, that closes the cycle"
          format: int32
          nullable: true
        budget_usdc:
          type: number
          description: "budget_usdc from create, or null for no spend cap"
          format: double
          nullable: true
        stop:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/StrategyStopRules'
          - type: object
            description: This campaign's stop rules
        created_at:
          type: string
          description: "UTC time the campaign was created, ISO 8601"
          format: date-time
          nullable: true
        started_at:
          type: string
          description: "UTC time the campaign started, ISO 8601"
          format: date-time
          nullable: true
        stopped_at:
          type: string
          description: "UTC time the campaign stopped, ISO 8601, or null while still\
            \ running"
          format: date-time
          nullable: true
      description: A PAPER-farm bot campaign
    StrategyCampaignActionRequest:
      required:
      - campaign_id
      type: object
      properties:
        campaign_id:
          type: string
          description: The campaign's id (UUID)
          nullable: true
      description: Names the campaign a pause/resume/stop/kill call acts on
    StrategyCampaignCycle:
      type: object
      properties:
        pnl_usdc:
          type: number
          description: "Net result of the cycle, in USDC (can be negative)"
          format: double
          nullable: true
        paper:
          type: number
          description: PAPER minted by the losing leg of this cycle
          format: double
          nullable: true
        closed_at:
          type: string
          description: "UTC time both legs were closed, ISO 8601"
          format: date-time
          nullable: true
        multileg_order_id:
          type: string
          description: "The multileg (or paired single) order id the close went through,\
            \ when known"
          nullable: true
      description: The campaign's most recently closed cycle
    StrategyCampaignLeg:
      type: object
      properties:
        position_id:
          type: string
          description: "The venue's position id, or null while the open is still unconfirmed"
          nullable: true
        side:
          type: string
          description: long or short
          nullable: true
        entry:
          type: number
          description: Entry (mark) price the leg opened at
          format: double
          nullable: true
        move_pct:
          type: number
          description: "Signed move since entry, in percent, from this leg's point\
            \ of view"
          format: double
          nullable: true
        bust:
          type: number
          description: This leg's liquidation (bust) price
          format: double
          nullable: true
        size:
          type: number
          description: Position size
          format: double
          nullable: true
        margin:
          type: number
          description: "Margin posted for this leg, in USDC"
          format: double
          nullable: true
        leverage:
          type: integer
          description: Leverage of this leg
          format: int32
          nullable: true
        mark_price:
          type: number
          description: Latest mark price used to watch this leg
          format: double
          nullable: true
        parent_order_id:
          type: string
          description: The order id that opened this leg
          nullable: true
        opened_at:
          type: string
          description: "UTC time the leg opened, ISO 8601"
          format: date-time
          nullable: true
      description: One leg (long or short) of the campaign's open or just-closed cycle
    StrategyCampaignList:
      required:
      - campaigns
      type: object
      properties:
        count:
          type: integer
          description: "Total campaigns matching the filter, across every page"
          format: int32
        campaigns:
          type: array
          description: "This page's campaigns, newest first"
          items:
            $ref: '#/components/schemas/StrategyCampaign'
      description: A page of the team's campaigns
    StrategyStopRules:
      type: object
      properties:
        queued_share_pct:
          type: number
          description: "Stop once this percent (0-100) of a new cycle's margin would\
            \ come from queued profit rather than fresh budget. Null or omitted: off"
          format: double
          nullable: true
        stop_before_key_expiry:
          type: boolean
          description: "Stop gracefully once the Papertrade session key has under\
            \ an hour left, rather than risk a cycle stuck open past expiry"
          nullable: true
          default: true
        hard_kill_on_stop:
          type: boolean
          description: "If a stop rule fires mid-cycle, close both legs at market\
            \ now instead of waiting for the target"
          nullable: true
          default: false
      description: "Stop conditions the campaign watches on its own, besides an explicit\
        \ stop/kill"
    TradeDetails:
      required:
      - price
      - quantity
      - symbol
      type: object
      properties:
        trade_id:
          type: string
          description: "The trade id assigned by the exchange, or the Anboto platform\
            \ trade id when no exchange trade id was captured"
          nullable: true
          example: "1204004183"
        symbol:
          type: string
          description: The symbol of the fill in Anboto's symbology
          example: BTC/USDT:USDT
        exchange_order_id:
          type: string
          description: The exchange order id of the child order the fill belongs to
          nullable: true
          example: "151990408"
        client_order_id:
          type: string
          description: The client order id of the child order the fill belongs to
          nullable: true
        quantity:
          type: number
          description: "The absolute amount filled by this trade, in base asset"
          example: 0.5
        price:
          type: number
          description: The traded price
          example: 92.91
        direction:
          type: string
          description: The direction of the trade
          nullable: true
          example: BUY
          enum:
          - BUY
          - SELL
        maker_or_taker:
          type: string
          description: Whether the fill was made as maker or taker
          nullable: true
          example: MAKER
          enum:
          - MAKER
          - TAKER
        exec_time:
          type: integer
          description: The execution time of the trade as ms since epoch
          format: int64
          nullable: true
          example: 1758276000000
        fee:
          type: number
          description: "The fee charged on the trade, in fee_currency"
          nullable: true
          example: 0.0021
        fee_currency:
          type: string
          description: The asset the fee was charged in
          nullable: true
          example: USDT
        parent_order_id:
          type: integer
          description: The Anboto id of the parent order the fill belongs to (the
            order_id of the enclosing order)
          format: int64
          nullable: true
          example: 596990285759373312
        child_order_id:
          type: integer
          description: The Anboto id of the child (slice) order that executed on the
            exchange; the WebSocket trade topic carries it as order_id
          format: int64
          nullable: true
          example: 596990290020118528
      description: "A fill of a child order, attached to its parent order"
    TradeDetailsList:
      required:
      - trades
      type: object
      properties:
        trades:
          type: array
          description: The list of trade details
          items:
            $ref: '#/components/schemas/TradeDetails'
    TradingExchange:
      type: string
      description: The exchanges available for order placement via the API
      enum:
      - BINANCE
      - HUOBI
      - GATEIO
      - KRAKEN
      - KUCOIN
      - OKX
      - BYBIT
      - BITGET
      - WOO
      - MEXC
      - BULLISH
      - B2C2
      - COINBASE_PRIME
      - COINBASE_INTL
      - HYPERLIQUID
      - LIGHTER
      - PAPERTRADE
    TradingStyle:
      type: string
      description: "The trading style of the order, the default is HYBRID"
      enum:
      - PASSIVE
      - AGGRESSIVE
      - HYBRID
    TriggerCondition:
      type: string
      description: The trigger condition to start the order
      enum:
      - ABOVE
      - BELOW
    TriggerInfo:
      required:
      - trigger_condition
      - trigger_price
      type: object
      properties:
        trigger_price:
          type: string
          description: The price to monitor for the trigger
        trigger_condition:
          allOf:
          - $ref: '#/components/schemas/TriggerCondition'
          - type: string
            description: The condition to trigger the order
      description: Information related to how the order should be triggered.
    Urgency:
      type: string
      description: "The Urgency or Risk Aversion of the IS strategy, the default is\
        \ MEDIUM. The parameter is not case-sensitive. Each risk aversion levels correspond\
        \ to a lambda value, \"that is, how much we penalize variance relative to\
        \ expected cost\" Low : 0.2e-6 Medium: 1e-6 High: 5e-6 Based on the paper\
        \ from Almgren Chriss https://www.smallake.kr/wp-content/uploads/2016/03/optliq.pdf"
      enum:
      - LOW
      - MEDIUM
      - HIGH
    WouldInfo:
      required:
      - would_pct
      - would_style
      type: object
      properties:
        would_price:
          type: string
          description: The price to trigger Would mode
          nullable: true
        would_pct:
          type: string
          description: The percent of the order to trade when the Would price triggers
        would_style:
          allOf:
          - $ref: '#/components/schemas/TradingStyle'
          - type: string
            description: The trading style to use when the Would price triggers
        would_is_arrival:
          type: boolean
          description: Would price as arrival price
        would_bps:
          type: string
          description: "Bps better than the would reference (arrival or would_price)\
            \ before would children trigger. Default: 1 with would_is_arrival, 0 with\
            \ would_price"
          nullable: true
          example: "5"
      description: Information to instruct how to execute a Would price trigger.
