openapi: 3.0.0
servers:
  - url: https://www.interactivebrokers.com/tradingapi/v1
info:
  description: Interactive Brokers Web API for 3rd Party Companies
  title: IBKR 3rd Party Web API
  version: 1.0.0
  x-apisguru-categories:
    - financial
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_interactivebrokers.com_images_web_favicons_apple-touch-icon-57x57.png
  x-origin:
    - format: swagger
      url: https://www.interactivebrokers.co.uk/webtradingapi/swagger.yaml
      version: "2.0"
  x-providerName: interactivebrokers.com
security:
  - cookieAuth: []
paths:
  /accounts:
    get:
      description: Allows the caller to request a list of accounts associated with the session.
      parameters:
        - description: Account Number
          in: query
          name: account
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  accounts:
                    description: Unique account id
                    items:
                      type: string
                    type: array
                type: object
          description: An array of accounts
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Brokerage Accounts
      tags:
        - Account & Portfolio
  "/accounts/{account}/order_impact":
    parameters:
      - description: Account Number
        in: path
        name: account
        required: true
        schema:
          type: string
    post:
      description: |
        This endpoint allows the consumer to check the impact that an order would have on the account, including margin, NLV and estimated commission costs.
        To specify the contract, you provide a value for the ContractId field, OR Ticker/ListingExchange/InstrumentType=STK for stocks OR Ticker/Currency/InstrumentType=CASH for FX.
      requestBody:
        content:
          application/json:
            schema:
              properties:
                Aux Price:
                  description: Required price to support Stop and Stop Limit orders
                  type: number
                ContractId:
                  description: The internal IB identifier for the trading product specified as an integer (can be obtained in response to /secdef request)
                  type: number
                Currency:
                  description: The currency in which the FX pair trades (only for InstrumentType=CASH)
                  type: string
                CustomerOrderId:
                  description: The order ID assigned by the customer.
                  type: string
                InstrumentType:
                  description: The instrument type of the contract
                  type: string
                ListingExchange:
                  description: The exchange on which the trading product is listed (only for InstrumentType=STK)
                  type: string
                Order Type:
                  $ref: "#/components/schemas/orderType"
                Price:
                  description: The order price
                  type: number
                Quantity:
                  description: The number of units in the order; contracts or shares
                  type: number
                Side:
                  description: Buy = '1', Sell = '2'
                  enum:
                    - 1
                    - 2
                  type: number
                Ticker:
                  description: The symbol that identifies the trading product
                  type: string
                Time in Force:
                  $ref: "#/components/schemas/timeInForce"
              type: object
        description: Order Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  Commission:
                    type: number
                  CommissionsCurrency:
                    type: string
                  EquityWithLoan:
                    type: number
                  InitMargin:
                    type: number
                  InitMarginBefore:
                    type: number
                  MaintMargin:
                    type: number
                  MaintMarginBefore:
                    type: number
                  MarginCurrency:
                    type: string
                  MaxCommissions:
                    type: number
                  MinCommissions:
                    type: number
                type: object
          description: Order impact info
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Return margin impact info
      tags:
        - Order Margin Requirements
  "/accounts/{account}/orders":
    get:
      description: Returns a list of orders for the account passed in the URL
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/orderState"
                type: array
          description: Returns a list of orders for the indicated account
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Open Orders
      tags:
        - Orders
    parameters:
      - description: Account Number
        in: path
        name: account
        required: true
        schema:
          type: string
    post:
      description: Places order
      requestBody:
        content:
          application/json:
            schema:
              properties:
                Aux Price:
                  description: Required Price to support Stop and Stop Limit orders
                  type: number
                ContractId:
                  description: The internal IB identifier for the trading product specified as an integer (can be obtained in response to /secdef request)
                  type: number
                Currency:
                  description: The currency in which the FX pair trades (only for InstrumentType=CASH)
                  type: string
                CustomerOrderId:
                  description: The order ID assigned by the customer.
                  type: string
                GermanHftAlgo:
                  description: By setting this bool to false the customer attests that the order is not subject to German HFT Act, was not generated using any automated algorithm, and no algorithm determined or changed financial instrument, side, quantity, order type, limit or other price, trading venue or timing of this order. Currently we cannot accept orders where this flag is set to true. Such orders will be rejected.
                  type: boolean
                InstrumentType:
                  description: The instrument type of the contract
                  type: string
                ListingExchange:
                  description: The exchange on which the trading product is listed (only for InstrumentType=STK)
                  type: string
                Mifid2Algo:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for algos that are responsible for investment decisions
                  type: string
                Mifid2DecisionMaker:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for decision makers.
                  type: string
                Mifid2ExecutionAlgo:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for algos that are responsible for handling/routing of the order.
                  type: string
                Mifid2ExecutionTrader:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II person responsible for handling/routing of the order
                  type: string
                Order Type:
                  $ref: "#/components/schemas/orderType"
                OrderRestrictions:
                  description: |
                    MultiValueString representing the restrictions associated with
                    an order. If more than one restriction is applicable to an
                    order, this field can contain multiple instructions separated
                    by space. 
                    '1' Program Trade
                    '2' Index Arbitrage 
                    '3' Non-Index Arbitrage
                  type: number
                Outside RTH:
                  description: Indicates if order is active outside regular trading hours, where defined. 0 = no (default), 1 = yes
                  type: number
                Price:
                  description: The order price
                  type: number
                Quantity:
                  description: The number of units in the order; contracts or shares
                  type: number
                Side:
                  description: Buy = '1', Sell = '2'
                  enum:
                    - 1
                    - 2
                  type: number
                Ticker:
                  description: The symbol that identifies the trading product
                  type: string
                Time in Force:
                  $ref: "#/components/schemas/timeInForce"
              type: object
        description: Order Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/orderState"
                type: array
          description: Returns order status information
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Place Order
      tags:
        - Orders
  "/accounts/{account}/orders/{CustomerOrderId}":
    delete:
      description: Cancels the order with the referenced Customer Order ID for the account passed in the URL.
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    CustomerOrderId:
                      type: string
                    OrderQty:
                      type: number
                    OrderType:
                      $ref: "#/components/schemas/orderType"
                    Price:
                      type: string
                    Side:
                      enum:
                        - 1
                        - 2
                      type: number
                    Status:
                      $ref: "#/components/schemas/orderStatus"
                    Symbol:
                      type: number
                    Warning:
                      type: string
                  type: object
                type: array
          description: Returns result of cancellation attempt
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Cancel Order
      tags:
        - Orders
    get:
      description: Returns the order with the referenced Customer Order ID for the account passed in the URL.
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/orderState"
                type: array
          description: Returns order status information
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Return specific order info
      tags:
        - Orders
    parameters:
      - description: Account Number
        in: path
        name: account
        required: true
        schema:
          type: string
      - description: Customer Order ID
        in: path
        name: CustomerOrderId
        required: true
        schema:
          type: string
    put:
      description: Allows the caller to modify the order with the referenced Customer Order ID specified in the URL. A separate Customer Order ID must be provided in the request body for the modification.
      requestBody:
        content:
          application/json:
            schema:
              properties:
                Aux Price:
                  description: Required Price to support Stop and Stop Limit orders
                  type: number
                CustomerOrderId:
                  description: The new order ID assigned by the customer for the modification.
                  type: string
                GermanHftAlgo:
                  description: By setting this bool to false the customer attests that the order is not subject to German HFT Act, was not generated using any automated algorithm, and no algorithm determined or changed financial instrument, side, quantity, order type, limit or other price, trading venue or timing of this order. Currently we cannot accept orders where this flag is set to true. Such orders will be rejected.
                  type: boolean
                Mifid2Algo:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for algos that are responsible for investment decisions
                  type: string
                Mifid2DecisionMaker:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for decision makers.
                  type: string
                Mifid2ExecutionAlgo:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II short code for algos that are responsible for handling/routing of the order.
                  type: string
                Mifid2ExecutionTrader:
                  description: This field permits specification of the user's preregistered (via account management) MiFID II person responsible for handling/routing of the order
                  type: string
                Order Type:
                  $ref: "#/components/schemas/orderType"
                OrigCustomerOrderId:
                  description: The order ID assigned by the customer
                  type: string
                Outside RTH:
                  description: Indicates if order is active outside regular trading hours, where defined. 0 = no (default), 1 = yes
                  type: number
                Price:
                  description: The order price
                  type: number
                Quantity:
                  description: The number of units in the order; contracts or shares
                  type: number
                Side:
                  description: Buy = '1', Sell = '2'
                  enum:
                    - 1
                    - 2
                  type: number
                Time in Force:
                  $ref: "#/components/schemas/timeInForce"
              type: object
        description: Order Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    CustomerOrderId:
                      type: string
                    OrderQty:
                      type: number
                    OrderType:
                      $ref: "#/components/schemas/orderType"
                    Price:
                      type: string
                    Side:
                      enum:
                        - 1
                        - 2
                      type: number
                    Status:
                      $ref: "#/components/schemas/orderStatus"
                    Symbol:
                      type: number
                    Warning:
                      type: string
                  type: object
                type: array
          description: Result of order modification attempt
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Modify Order
      tags:
        - Orders
  "/accounts/{account}/positions":
    get:
      description: "Returns a list of positions for the indicated account. "
      parameters:
        - description: Account Number
          in: path
          name: account
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    AverageCost:
                      type: number
                    ContractId:
                      type: number
                    Position:
                      type: number
                  type: object
                type: array
          description: Returns a list of positions for the indicated account
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Account Positions
      tags:
        - Account & Portfolio
  "/accounts/{account}/summary":
    get:
      description: Returns a list of account and margin balances associated with the account passed in the URL
      parameters:
        - description: Account Number
          in: path
          name: account
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  Info:
                    properties:
                      AccountCode:
                        type: string
                      AccountReady:
                        type: string
                      AccountType:
                        type: string
                      Cushion:
                        type: string
                      DayTradesRemaining:
                        type: string
                      DayTradesRemainingT:
                        type: string
                      DayTradesRemainingT+2:
                        type: string
                      DayTradesRemainingT+3:
                        type: string
                      DayTradesRemainingT+4:
                        type: string
                      HighestSeverity:
                        type: string
                      Leverage-S:
                        type: string
                      LookAheadNextChange:
                        type: string
                      SegmentTitle-C:
                        type: string
                      SegmentTitle-S:
                        type: string
                      TradingType-S:
                        type: string
                      WhatIfPMEnabled:
                        type: string
                    type: object
                  Ledger:
                    items:
                      properties:
                        CashBalance:
                          type: number
                        CashBalanceFXSegment:
                          type: number
                        CashCumQty:
                          type: number
                        ExchangeRate:
                          type: number
                        FutureOptionMarketValue:
                          type: number
                        FuturePNL:
                          type: number
                        NetDividend:
                          type: number
                        NetInterest:
                          type: number
                        NetLiquidation:
                          type: number
                        OptionMarketValue:
                          type: number
                        RealizedPNL:
                          type: number
                        StockMarketValue:
                          type: number
                        TotalCashBalance:
                          type: number
                        UnrealizedPNL:
                          type: number
                      type: object
                    type: array
                  Summary:
                    properties:
                      AccruedCash:
                        type: number
                      AccruedCash-C:
                        type: number
                      AccruedCash-S:
                        type: number
                      AccruedDividend:
                        type: number
                      AccruedDividend-C:
                        type: number
                      AccruedDividend-S:
                        type: number
                      AvailableFunds:
                        type: number
                      AvailableFunds-C:
                        type: number
                      AvailableFunds-S:
                        type: number
                      Billable:
                        type: number
                      Billable-C:
                        type: number
                      Billable-S:
                        type: number
                      BuyingPower:
                        type: number
                      EquityWithLoanValue:
                        type: number
                      EquityWithLoanValue-C:
                        type: number
                      EquityWithLoanValue-S:
                        type: number
                      ExcessLiquidity:
                        type: number
                      ExcessLiquidity-C:
                        type: number
                      ExcessLiquidity-S:
                        type: number
                      FullAvailableFunds:
                        type: number
                      FullAvailableFunds-C:
                        type: number
                      FullAvailableFunds-S:
                        type: number
                      FullExcessLiquidity:
                        type: number
                      FullExcessLiquidity-C:
                        type: number
                      FullExcessLiquidity-S:
                        type: number
                      FullInitMarginReq:
                        type: number
                      FullInitMarginReq-C:
                        type: number
                      FullInitMarginReq-S:
                        type: number
                      FullMaintMarginReq:
                        type: number
                      FullMaintMarginReq-C:
                        type: number
                      FullMaintMarginReq-S:
                        type: number
                      GrossPositionValue:
                        type: number
                      GrossPositionValue-C:
                        type: number
                      GrossPositionValue-S:
                        type: number
                      IndianStockHaircut:
                        type: number
                      IndianStockHaircut-C:
                        type: number
                      IndianStockHaircut-S:
                        type: number
                      InitMarginReq:
                        type: number
                      InitMarginReq-C:
                        type: number
                      InitMarginReq-S:
                        type: number
                      InsuredDeposit:
                        type: number
                      InsuredDeposit-C:
                        type: number
                      InsuredDeposit-S:
                        type: number
                      LookAheadAvailableFunds:
                        type: number
                      LookAheadAvailableFunds-C:
                        type: number
                      LookAheadAvailableFunds-S:
                        type: number
                      LookAheadExcessLiquidity:
                        type: number
                      LookAheadExcessLiquidity-C:
                        type: number
                      LookAheadExcessLiquidity-S:
                        type: number
                      LookAheadInitMarginReq:
                        type: number
                      LookAheadInitMarginReq-C:
                        type: number
                      LookAheadInitMarginReq-S:
                        type: number
                      LookAheadMaintMarginReq:
                        type: number
                      LookAheadMaintMarginReq-C:
                        type: number
                      LookAheadMaintMarginReq-S:
                        type: number
                      MaintMarginReq:
                        type: number
                      MaintMarginReq-C:
                        type: number
                      MaintMarginReq-S:
                        type: number
                      NetLiquidation:
                        type: number
                      NetLiquidation-C:
                        type: number
                      NetLiquidation-S:
                        type: number
                      NetLiquidationUncertainty:
                        type: number
                      PASharesValue:
                        type: number
                      PASharesValue-C:
                        type: number
                      PASharesValue-S:
                        type: number
                      PostExpirationExcess:
                        type: number
                      PostExpirationExcess-C:
                        type: number
                      PostExpirationExcess-S:
                        type: number
                      PostExpirationMargin:
                        type: number
                      PostExpirationMargin-C:
                        type: number
                      PostExpirationMargin-S:
                        type: number
                      RegTEquity:
                        type: number
                      RegTEquity-S:
                        type: number
                      RegTMargin:
                        type: number
                      RegTMargin-S:
                        type: number
                      SMA:
                        type: number
                      SMA-S:
                        type: number
                      TotalCashValue:
                        type: number
                      TotalCashValue-C:
                        type: number
                      TotalCashValue-S:
                        type: number
                    type: object
                type: object
          description: |
            Returns object for account summary with multiple properties. 
            A property is sufficed with -c if it provides commodity value, -s if it provides security value, and -c if its UKL segment value. 
            "These values correspond to the TWS Account Window: https://www.interactivebrokers.com/en/software/tws/usersguidebook/realtimeactivitymonitoring/account_window.htm"
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Account Values Summary
      tags:
        - Account & Portfolio
  "/accounts/{account}/trades":
    get:
      description: |
        Returns a list of trades for the account starting at the given 'since' date to the current time (now()). Timezone is UTC. Any request with a future since date or going further than one week will result in an HTTP 400 bad request response. Calling /trades without since will return all trades for the past 24 hours.
      requestBody:
        content:
          application/json:
            schema:
              type: string
        description: |
          Start time specified in UTC. Allowed formats are "yyyy-MM-dd" or "yyyy-MM-dd'T'HH:mm:ss". Time is optional and is set to midnight if omitted, e.g. "00:00:00 hh:mm:ss".
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    AvgPrice:
                      type: number
                    Commission:
                      type: number
                    CommissionCurrency:
                      type: string
                    ContractId:
                      type: number
                    Currency:
                      type: string
                    CustomerOrderId:
                      type: number
                    ExecId:
                      type: string
                    ExecutionTime:
                      type: string
                    FilledQuantity:
                      type: number
                    LastMarket:
                      type: string
                    ListingExchange:
                      type: string
                    OrderId:
                      type: string
                    OrderType:
                      $ref: "#/components/schemas/orderType"
                    Quantity:
                      type: number
                    RemainingQuantity:
                      type: number
                    Side:
                      enum:
                        - 1
                        - 2
                      type: string
                    Ticker:
                      type: string
                    TradePrice:
                      type: number
                    TradeSize:
                      type: number
                  type: object
                type: array
          description: List of Trades
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Returns trades in account
      tags:
        - Trades
    parameters:
      - description: Account Number
        in: path
        name: account
        required: true
        schema:
          type: string
  /marketdata/exchange_components:
    get:
      description: "This endpoint provides a bit mapping for the bid/ask/last 'market' values in the snapshot response. "
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    Complete:
                      type: boolean
                    ConId:
                      type: number
                    mapping:
                      items:
                        properties:
                          bit:
                            type: number
                          code:
                            type: string
                          exchange:
                            type: string
                        type: object
                      type: array
                  type: object
                type: array
          description: Exchange Components
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Exchange Components
      tags:
        - Market Data
  /marketdata/snapshot:
    get:
      description: |
        This endpoint allows the consumer to request a market data snapshot for one or more trading products. 
        Consumers need to provide unique identifiers (conids) for the products in the IB product database (retrievable using the /secdef endpoint). The 'market' values are integers whose bits indicate the exchange(s) making up the quote. 

        The mapping of bit to exchange is obtained from the marketdata/exchange_component endpoint. For example, if a bid has a 'market' value of 5 and the exchange_component result has the map 
        0 => NYSE, 1 => ISLAND, 2 => ARCA then the exchanges contributing to the bid size are NYSE and ARCA. 

        Similarly, if market=2, then only ISLAND is contributing.
      requestBody:
        content:
          application/json:
            schema:
              items:
                properties:
                  conid:
                    description: The internal IB identifier for the trading product specified as an integer.
                    type: number
                  currency:
                    description: The currency in which the given pair trades.
                    type: string
                  exchange:
                    description: The exchange on which the trading product is listed (required for type=STK).
                    type: string
                  symbol:
                    description: The symbol that identifies the trading product.
                    type: string
                  type:
                    description: The instrument type of the contract (CASH).
                    type: string
                type: object
              type: array
        description: Contract. Allowed combinations are [type and symbol and currency], or [type, symbol, exchange, and currency], or [conid].
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    Bid:
                      properties:
                        market:
                          type: number
                        price:
                          type: number
                        size:
                          type: number
                      type: object
                    Closing:
                      properties:
                        price:
                          type: number
                      type: object
                    Complete:
                      type: boolean
                    Conid:
                      type: string
                    Offer:
                      properties:
                        market:
                          type: number
                        price:
                          type: number
                        size:
                          type: number
                      type: object
                    Temporality:
                      description: |
                        0 = Real time data
                        1 = Delayed data
                      enum:
                        - 0
                        - 1
                      type: number
                    Trade:
                      properties:
                        market:
                          type: number
                        price:
                          type: number
                        size:
                          type: number
                        time:
                          type: number
                      type: object
                  type: object
                type: array
          description: Financial Instrument Definition
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Market Data Snapshot
      tags:
        - Market Data
  /oauth/access_token:
    post:
      description: |
        Obtain an access token using the request token and the verification code you received after the user provided authorization. See section 6.3 of the OAuth v1.0a specification for more details. 
      requestBody:
        content:
          application/json:
            schema:
              properties:
                oauth_consumer_key:
                  description: The 25-character hexadecimal string that was obtained from Interactive Brokers during the OAuth consumer registration process.
                  type: string
                oauth_nonce:
                  description: A random string uniquely generated for each request.
                  type: string
                oauth_signature:
                  description: The signature for the request generated using the method specified in the oauth_signature_method parameter. See section 9 of the OAuth v1.0a specification for more details on signing requests.
                  type: string
                oauth_signature_method:
                  description: The signature method used to sign the request. Currently only 'RSA-SHA256' is supported.
                  type: string
                oauth_timestamp:
                  description: Timestamp expressed in seconds since 1/1/1970 00:00:00 GMT. Must be a positive integer and greater than or equal to any timestamp used in previous requests.
                  type: string
                oauth_token:
                  description: The request token obtained from IB via /request_token.
                  type: string
                oauth_verifier:
                  description: The verification code received from IB after the user has granted authorization.
                  type: string
              type: object
        description: OAuth Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  oauth_token:
                    type: string
                  oauth_token_secret:
                    type: string
                type: object
          description: Access token and token secret
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Obtain a access token
      tags:
        - OAuth
  /oauth/live_session_token:
    post:
      description: |
        In order to access protected IB resources, a live session token is required. This endpoint allows consumers to obtain a live session token to access these resources using an OAuth access token and the Diffie-Hellman prime and generator supplied during the registration process.
        Note this is an additional IB-specific step, and not part of the OAuth v1.0a specification. Please refer to the "OAuth at Interactive Brokers" document for more details.  https://www.interactivebrokers.com/webtradingapi/oauth.pdf
      requestBody:
        content:
          application/json:
            schema:
              properties:
                diffie_hellman_challenge:
                  description: |
                    Challenge value calculated using the Diffie-Hellman prime and generated provided during the registration process. See the "OAuth at Interactive Brokers" document for more details. 
                  type: string
                oauth_consumer_key:
                  description: The 25-character hexadecimal string that was obtained from Interactive Brokers during the OAuth consumer registration process.
                  type: string
                oauth_nonce:
                  description: A random string uniquely generated for each request.
                  type: string
                oauth_signature:
                  description: The signature for the request generated using the method specified in the oauth_signature_method parameter. See section 9 of the OAuth v1.0a specification for more details on signing requests.
                  type: string
                oauth_signature_method:
                  description: The signature method used to sign the request. Currently only 'RSA-SHA256' is supported.
                  type: string
                oauth_timestamp:
                  description: Timestamp expressed in seconds since 1/1/1970 00:00:00 GMT. Must be a positive integer and greater than or equal to any timestamp used in previous requests.
                  type: string
                oauth_token:
                  description: The request token obtained from IB via /request_token.
                  type: string
              type: object
        description: OAuth Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  diffie_hellman_response:
                    type: string
                  live_session_token_signature:
                    type: string
                type: object
          description: DH response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Obtain a live session token
      tags:
        - OAuth
  /oauth/request_token:
    post:
      description: |
        Obtain a request token. See section 6.1 of the OAuth v1.0a specification for more information. http://oauth.net/core/1.0a/#auth_step1

        Note we do not return an oauth_token_secret in the response as we are using RSA signatures rather than PLAINTEXT authentication. 
      requestBody:
        content:
          application/json:
            schema:
              properties:
                oauth_callback:
                  description: "An absolute URL to which IB will redirect the user. This URL is provided by the consumer during registration. This parameter must be set to 'oob'.  "
                  type: string
                oauth_consumer_key:
                  description: The 25-character hexadecimal string that was obtained from Interactive Brokers during the OAuth consumer registration process.
                  type: string
                oauth_nonce:
                  description: A random string uniquely generated for each request.
                  type: string
                oauth_signature:
                  description: The signature for the request generated using the method specified in the oauth_signature_method parameter. See section 9 of the OAuth v1.0a specification for more details on signing requests.
                  type: string
                oauth_signature_method:
                  description: The signature method used to sign the request. Currently only 'RSA-SHA256' is supported.
                  type: string
                oauth_timestamp:
                  description: Timestamp expressed in seconds since 1/1/1970 00:00:00 GMT. Must be a positive integer and greater than or equal to any timestamp used in previous requests.
                  type: string
              type: object
        description: OAuth Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  oauth_token:
                    type: string
                type: object
          description: OAuth token
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Obtain a request token
      tags:
        - OAuth
  /secdef:
    get:
      description: |
        Fields that compose security definition. Allowed combinations,
        (1) type and symbol and currency, or
        (2) type, symbol, exchange, and currency, or
        (3) conid
      requestBody:
        content:
          application/json:
            schema:
              properties:
                conid:
                  description: The internal IB identifier for the trading product specified as an integer.
                  type: number
                currency:
                  description: The currency in which the given pair trades.
                  type: string
                exchange:
                  description: The exchange on which the trading product is listed (required for type=STK).
                  type: string
                symbol:
                  description: The symbol that identifies the trading product.
                  type: string
                type:
                  description: The instrument type of the contract (CASH).
                  type: string
              type: object
        description: Order Parameters
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  properties:
                    CompanyName:
                      type: string
                    ContractId:
                      type: number
                    Currency:
                      type: string
                    Exchange:
                      type: string
                    SecurityType:
                      type: string
                    Ticker:
                      type: string
                  type: object
                type: array
          description: Financial Instrument Definition
        "202":
          description: Unsuccessfull response
        "204":
          description: Unsuccessfull response
        "400":
          description: Unsuccessfull response
        "401":
          description: Unsuccessfull response
        "403":
          description: Unsuccessfull response
        "408":
          description: Unsuccessfull response
      summary: Get security definition
      tags:
        - Financial Instrument Definitions
components:
  schemas:
    orderState:
      description: An object containing all the properties defining an order
      properties:
        ContractId:
          type: number
        CustomerOrderId:
          type: number
        FilledQuantity:
          type: number
        ListingExchange:
          type: string
        OrderType:
          $ref: "#/components/schemas/orderType"
        OutsideRTH:
          type: string
        Price:
          type: number
        RemainingQuantity:
          type: number
        Side:
          enum:
            - 1
            - 2
          type: string
        Status:
          $ref: "#/components/schemas/orderStatus"
        Ticker:
          type: string
        TimeInForce:
          $ref: "#/components/schemas/timeInForce"
        TransactionTime:
          type: string
        Warning:
          type: string
      type: object
    orderStatus:
      description: |
        Status of the order
        InvalidOrderStatus = '-1'
        New = '0'
        PartiallyFilled = '1'
        Filled = '2'
        DoneForTheDay = '3'
        Canceled = '4'
        Replaced = '5'
        PendingCancelReplace = '6'
        Stopped = '7'
        Rejected = '8'
        Suspended = '9'
        PendingNew = 'A'
        Calculated = 'B'
        Expired = 'C'
        AcceptedForBidding = 'D'
        PendingReplace = 'E'
      enum:
        - "-1"
        - "0"
        - "1"
        - "2"
        - "3"
        - "4"
        - "5"
        - "6"
        - "7"
        - "8"
        - "9"
        - A
        - B
        - C
        - D
        - E
      type: string
    orderType:
      description: |
        Market = '1'
        Limit = '2'
        Stop = '3'
        StopLimit = '4'
      enum:
        - 1
        - 2
        - 3
        - 4
      type: number
    timeInForce:
      description: |
        Defines order's active lifetime.
        Day = '0'
        GTC (Good till Cancel) = '1'
        IOC (Immediate or Cancel) = '3'
        Open = '2'
        Close = '7'
      enum:
        - 0
        - 1
        - 2
        - 3
        - 7
      type: number
  securitySchemes:
    cookieAuth:
      in: header
      name: portal
      type: apiKey
