openapi: 3.0.0
info:
  version: "2.5.0"
  title: CCXT REST
  contact:
    name: "Adroit"
    email: "hello@adroit.ph"
    url: "https://adroit.ph/ccxt-rest-contact-us/"
  license:
    name: "MIT"
    url: "https://github.com/ccxt-rest/ccxt-rest/blob/master/LICENSE.txt"
servers:
  - url: 'http://localhost:3000/'
tags:
  - name: Authentication API
    description: >-
      APIs that manage [creation](/#createPrivateConnection) / [deletion](/#deletePrivateConnection) / [retrieving](/#getone) of exchange connections. 
      

      Most [Public Data APIs](/#ccxt-rest-public-data-api) by most exchanges can be used without providing the API Key and Secret. 
      
      
      For example, you get retrieve the market of binance by doing `GET:/exchange/binance/market` directly and would be able to get
      the markets of binance. 
      
      
      But some exchanges though would require you to use an API Key and Secret even when accessing their Public Data API. For 
      example, for cointiger, if you want to retrieve its market and you do `GET:/exchange/cointiger/market`, you will a `403` error
      (_i.e. meaning you were unauthorized to access it_). Thus, to use that api of continger, you would first have to provide your
      API Key and Secret to continger via `POST:/exchange/continger -d {"id":"myCoinTiger","apiKey":"My-COINTIGER-KEY","secret":"s3cret"}`.
      From there, you will get a response `{"token":"xxx.yyy.zzz"}`. That `"xxx.yyy.zzz"` would then what you will use to connect to
      coiniger - i.e. `GET:/exchange/cointiger/market -H "Authorization: Bearer xxx.yyy.zzz"` and this time, your request will push 
      through and would be able to get cointiger's market.

      
      Furthemore, all [Private Data APIs](/#ccxt-rest-private-data-api) of all exchanges would require API Key and Secret. Thus,
      although `GET:/exchange/binance/market` would work, doing `GET:/exchange/binance/balances` will not. You'd have to provide first
      binance your API Key and Secret like `POST:/exchange/binance -d {"id":"myBinance","apiKey":"binance-key","secret":"s3cret"}`, to
      get something like `{"token":"aaa.bbb.ccc"}`, which you can then use to execute 
      `GET:/exchange/binance/balances -H "Authorization: Bearer aaa.bbb.ccc"` which would finally get your balances.
  - name: Exchange Management API
    description: APIs for retrieving supported exchanges
  - name: Public Data API
    description: APIs that retrieve public data (like ticker, order books, trades, etc)
  - name: Private Data API
    description: APIs that retrieve private data (like your balances, your open orders, your closed orders, your trades, etc)
  - name: Experimental API
    description: APIs that may be useful but are in experimental stage. Some of these APIs may potentially be removed in the future or be moved into one of the previous categories
paths:
  /exchanges:
    get:
      description: List all support exchanges by this server
      tags:
        - Exchange Management API
      x-swagger-router-controller: exchange
      operationId: list
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref : "#/components/schemas/Exchange"
                example: ["_1btcxe","acx","anxpro","anybits","bcex","bequant","bibox","bigone","binance","binanceje","bit2c","bitbank","bitbay","bitfinex","bitfinex2","bitflyer","bitforex","bithumb","bitibu","bitkk","bitlish","bitmarket","bitmex","bitsane","bitso","bitstamp","bitstamp1","bittrex","bitz","bl3p","bleutrade","braziliex","btcalpha","btcbox","btcchina","btcexchange","btcmarkets","btctradeim","btctradeua","btcturk","buda","bxinth","ccex","cex","chbtc","chilebit","cobinhood","coinbase","coinbaseprime","coinbasepro","coincheck","coinegg","coinex","coinexchange","coinfalcon","coinfloor","coingi","coinmarketcap","coinmate","coinnest","coinone","coinspot","cointiger","coolcoin","coss","crex24","crypton","cryptopia","deribit","dsx","ethfinex","exmo","exx","fcoin","fcoinjp","flowbtc","foxbit","fybse","fybsg","gateio","gdax","gemini","getbtc","hadax","hitbtc","hitbtc2","huobipro","huobiru","ice3x","independentreserve","indodax","itbit","jubi","kkex","kraken","kucoin","kucoin2","kuna","lakebtc","lbank","liqui","liquid","livecoin","luno","lykke","mandala","mercado","mixcoins","negociecoins","nova","okcoincny","okcoinusd","okex","paymium","poloniex","rightbtc","southxchange","stronghold","surbitcoin","theocean","therock","tidebit","tidex","uex","upbit","urdubit","vaultoro","vbtc","virwox","xbtce","yobit","zaif","zb"]
                x-content-type: application/json
        "500":
          description: If an unexpected error occurred
  /exchange/{exchangeName}:
    get:
      description: Retreives the current exchange connection details given the {exchangeName} and access token in the header
      security:
        - bearerAuth: []
      tags:
        - Authentication API
      x-swagger-router-controller: exchange
      operationId: getConnection
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeResponse'
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
    post:
      description: Creates a private connection to the exchange referenced in {exchangeName}
      security:
        - bearerAuth: []
      tags:
        - Authentication API
      operationId: createPrivateConnection
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
      requestBody:
        description: The exchange to create.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/exchangeConfig'
        required: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessToken'
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "503":
          description: Support for exchange is currently broken
      x-swagger-router-controller: exchange
    delete:
      description: Delete the exchange connection referenced by access token in the header
      security:
        - bearerAuth: []
      tags:
        - Authentication API
      x-swagger-router-controller: exchange
      operationId: deletePrivateConnection
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExchangeResponse'
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
  /exchange/{exchangeName}/markets:
    get:
      description: >-
        Get the markets of the exchange referenced by the {exchangeName}.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: markets
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MarketResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/orderBook:
    get:
      description: >-
        Get the order book of the exchange referenced by the {exchangeName} and `?symbol=`. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: orderBook
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/requiredExchangeSymbolParam"
        - name: limit
          in: query
          description: The limit of the exchange's order book to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderBookResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/l2OrderBook:
    get:
      description: >-
        Get the Level 2 Order Book of the exchange referenced by the {exchangeName} and `?symbol=`.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: l2OrderBook
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/requiredExchangeSymbolParam"
        - name: limit
          in: query
          description: The limit of the exchange's order book to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderBookResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/trades:
    get:
      description: >- 
        Get the trades of the exchange referenced by the {exchangeName} and `?symbol=`.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: trades
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/requiredExchangeSymbolParam"
        - name: since
          in: query
          description: Retrieve the trades starting from 'since'
          required: false
          style: form
          explode: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of the exchange's trades to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TradeResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/ticker:
    get:
      description: >-
        Get the ticker of the exchange referenced by the {exchangeName} and `?symbol=`.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: ticker
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/requiredExchangeSymbolParam"
        - name: symbol
          in: query
          description: >-
            The symbol of the exchange's data to be retrieved. Possible values
            are any of symbols in
            GET:/exchange/{exchangeName}/markets
          required: true
          style: form
          explode: true
          schema:
            type: string
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TickerResponse'
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/tickers:
    get:
      description: >-
        Get the tickers of the exchange referenced by the {exchangeName} and `?symbol=`.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Public Data API
      x-swagger-router-controller: exchange
      operationId: tickers
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TickerResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/balances:
    get:
      description: >-
        Get the balances of the exchange referenced by the {exchangeName}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: balances
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalanceResponse'
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/orders:
    get:
      description: >-
        Get the orders of the exchange referenced by the {exchangeName}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: fetchOrders
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: since
          in: query
          description: Retrieve the orders starting from 'since'
          required: false
          style: form
          explode: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of the exchange's orders to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/orders/open:
    get:
      description: >-
        Get the open orders of the exchange referenced by the {exchangeName}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: fetchOpenOrders
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: since
          in: query
          description: Retrieve the orders starting from 'since'
          required: false
          style: form
          explode: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of the exchange's orders to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/orders/closed:
    get:
      description: >-
        Get the closed orders of the exchange referenced by the {exchangeName}.
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: fetchClosedOrders
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: since
          in: query
          description: Retrieve the orders starting from 'since'
          required: false
          style: form
          explode: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of the exchange's orders to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/trades/mine:
    get:
      description: >-
        Get my trades of the exchange referenced by the {exchangeName}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: fetchMyTrades
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: since
          in: query
          description: Retrieve the trades starting from 'since'
          required: false
          style: form
          explode: true
          schema:
            type: string
        - name: limit
          in: query
          description: The limit of the exchange's trades to be retrieved.
          required: false
          style: form
          explode: true
          schema:
            type: number
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TradeResponse'
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/order:
    post:
      description: Create an order on the exchange referenced by the {exchangeName}
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: createOrder
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
      requestBody:
        description: The order to place.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/orderPlacement'
        required: false
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/order/{orderId}:
    get:
      description: >-
        Retrieves the information of an order on the exchange referenced by the {exchangeName} and {orderId}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: fetchOrder
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/orderIdParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
    delete:
      description: >- 
        Cancel an open order on the exchange referenced by the {exchangeName} and {orderId}. 
        
        
        <br/> *Parameters listed here are common to all exchanges. But any other parameter passed would be forwarded as well into the exchange.*
      security:
        - bearerAuth: []
      tags:
        - Private Data API
      x-swagger-router-controller: exchange
      operationId: cancelOrder
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - $ref: "#/components/parameters/orderIdParam"
        - $ref: "#/components/parameters/optionalExchangeSymbolParam"
        - name: exchangeSpecificParams
          in: query
          description: Any exchange specific parameters you want to pass in
          schema:
            type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
  /exchange/{exchangeName}/_/{methodName}:
    post:
      description: Invokes a ccxt javascript object's method call directly
      security:
        - bearerAuth: []
      tags:
        - Experimental API
      x-swagger-router-controller: exchange
      operationId: directCall
      parameters:
        - $ref: "#/components/parameters/exchangeNameParam"
        - name: methodName
          in: path
          description: The method name of the exchange that would be invoked directly
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        description: The array of values that would be passed as parameters to the direct method call
        content:
          application/json:
            schema:
              type: array
        required: false
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                x-content-type: application/json
        "400":
          description: If the exchange itself complained about the parameters passed
        "401":
          description: If the exchange integration requires api key and secret for this function
        "403":
          description: If the exchange integration had an authentication issue (most probably nonce error)
        "404":
          description: Exchange with that name is NOT supported
        "500":
          description: If an unexpected error occurred
        "501":
          description: If the exchange integration does NOT support this function
        "504":
          description: If the exchange itself could not be reached because of some network error
components:
  schemas:
    OrderBookLevel:
      required:
        - price
      type: object
      properties:
        price:
          type: number
          description: >-
            The price being asked for. If this is a bid, then this is the amount
            the bidder is willing to buy. If this is a sell, then this is the
            amount the seller is willing to sell for.
        amount:
          type: number
          description: The amount of units being sold.
    BalanceInfo:
      required:
        - currency
        - free
        - total
        - used
      type: object
      properties:
        currency:
          type: string
          description: The currency at which this balance refers to
        free:
          type: number
          description: The amount of currency that is free to used
        used:
          type: number
          description: The amount of currency that is currently used
        total:
          type: number
          description: The total amount of currency (free + used)
    MarketResponse:
      required:
        - base
        - id
        - info
        - limits
        - lot
        - precision
        - quote
        - symbol
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for this market
        symbol:
          type: string
          description: >-
            A unified way of referencing this Market. When a symbol parameter is
            needed in one of the APIs, this iis where you will get it.
        base:
          type: string
          description: 'The base currency. Given ''BTC/USD'', the base is ''BTC'''
        quote:
          type: string
          description: 'The quote currency. Given ''BTC/USD'', the quote is ''USD'''
        info:
          type: object
          properties: {}
          description: Raw market response gotten from the exchange site's API
        lot:
          type: number
          description: >-
            When placing an order, its amount must be divisible by this lot
            value
        limits:
          $ref: '#/components/schemas/Limits'
        precision:
          $ref: '#/components/schemas/Precision'
    TradeResponse:
      required:
        - amount
        - info
        - price
        - side
        - symbol
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the exchange for this trade
        info:
          type: object
          properties: {}
          description: Raw trade response gotten from the exchange site's API
        timestamp:
          type: number
          description: The timestamp of this trade
          format: date-time
        symbol:
          type: string
          description: The currency pair of this trade
        side:
          $ref : "#/components/schemas/Side"
        price:
          type: number
          description: The price of this trade
        amount:
          type: number
          description: The amount of this trade
    OrderResponse:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the exchange for this order
        timestamp:
          type: number
          description: The timestamp of this order
        datetime:
          type: string
          description: The datetime of this order
          format: date-time
        symbol:
          type: string
          description: The currency pair of this order
        type:
          $ref : "#/components/schemas/OrderType"
        side:
          $ref : "#/components/schemas/Side"
        price:
          type: number
          description: The price of this order
        amount:
          type: number
          description: The amount of this order
        cost:
          type: number
          description: The cost of this order (i.e. price x amount)
        filled:
          type: number
          description: >-
            The amount of this order that is currently filled (i.e. this can be
            less than or equal to 'amount')
        remaining:
          type: number
          description: >-
            The amount of this order that is still yet to be filled (i.e. this
            can be less than or equal to 'amount')
        status:
          $ref : "#/components/schemas/OrderStatus"
        info:
          type: object
          properties: {}
          description: Raw order response gotten from the exchange site's API
    Side:
      type: string
      description: Wether this is a bid or ask (i.e. buy or sell) order
      enum:
        - buy
        - sell
    Exchange:
      type: string
      enum: ["_1btcxe", "acx", "anxpro", "aofex", "bcex", "bequant", "bibox", "bigone", "binance", "binanceje", "binanceus", "bit2c", "bitbank", "bitbay", "bitfinex", "bitfinex2", "bitflyer", "bitforex", "bithumb", "bitkk", "bitmart", "bitmax", "bitmex", "bitso", "bitstamp", "bitstamp1", "bittrex", "bitvavo", "bitz", "bl3p", "bleutrade", "braziliex", "btcalpha", "btcbox", "btcmarkets", "btctradeim", "btctradeua", "btcturk", "buda", "bw", "bybit", "bytetrade", "cex", "chilebit", "coinbase", "coinbaseprime", "coinbasepro", "coincheck", "coinegg", "coinex", "coinfalcon", "coinfloor", "coingi", "coinmarketcap", "coinmate", "coinone", "coinspot", "coolcoin", "coss", "crex24", "currencycom", "deribit", "digifinex", "dsx", "eterbase", "exmo", "exx", "fcoin", "fcoinjp", "flowbtc", "foxbit", "ftx", "fybse", "gateio", "gemini", "hbtc", "hitbtc", "hollaex", "huobipro", "huobiru", "ice3x", "idex", "independentreserve", "indodax", "itbit", "kkex", "kraken", "kucoin", "kuna", "lakebtc", "latoken", "lbank", "liquid", "livecoin", "luno", "lykke", "mercado", "mixcoins", "oceanex", "okcoin", "okex", "paymium", "poloniex", "probit", "qtrade", "rightbtc", "southxchange", "stex", "stronghold", "surbitcoin", "theocean", "therock", "tidebit", "tidex", "timex", "topq", "upbit", "vaultoro", "vbtc", "whitebit", "xbtce", "yobit", "zaif", "zb"]      
    OrderBookResponse:
      required:
        - asks
        - bids
      type: object
      properties:
        bids:
          type: array
          description: The publicly listed buy orders
          items:
            $ref: '#/components/schemas/OrderBookLevel'
        asks:
          type: array
          description: The publicly listed sell orders
          items:
            $ref: '#/components/schemas/OrderBookLevel'
        timestamp:
          type: number
          description: The timestamp associated for this order book
        datetime:
          type: string
          description: The timestamp associated for this order book
          format: date-time
    OrderStatus:
      type: string
      description: The current status of this order
      enum:
        - open
        - closed
        - canceled
        - canceling
    OrderType:
      type: string
      description: Whether this is a 'market' order or a 'limit' order
      enum:
        - market
        - limit
    Limits:
      required:
        - amount
        - cost
        - price
      type: object
      properties:
        amount:
          $ref: '#/components/schemas/Limit'
        price:
          $ref: '#/components/schemas/Limit'
        cost:
          $ref: '#/components/schemas/Limit'
    BalanceResponse:
      required:
        - balances
        - info
      type: object
      properties:
        info:
          type: object
          properties: {}
          description: Raw balance response gotten from the exchange site's API
        balances:
          type: array
          description: List of balances per currency that you own
          items:
            $ref: '#/components/schemas/BalanceInfo'
    Precision:
      required:
        - amount
        - price
      type: object
      properties:
        amount:
          type: number
          description: >-
            The allowable precision of the amount when placing an order. For
            example, given 2, then an amount of 0.123 must be made either 0.12
            (or 0.13)
        price:
          type: number
          description: >-
            The allowable precision of the amount when placing an order. For
            example, given 2, then a price of 0.123 must be made either 0.12 (or
            0.13)
    AccessToken:
      required:
        - token
      properties:
        token:
          type: string
          description: >- 
            The JWT token that needs to be added into the 'Authorization'
            header with the 'Bearer ' prefix. For example, given a token of xyz,
            do a secured request with 'Authorization: Bearer xyz'
    ExchangeResponse:
      required:
        - id
        - countries
        - enableRateLimit
        - name
        - private
      type: object
      properties:
        id:
          type: string
          description: >-
            The id of the exchange. When you created the exchange (via
            POST:/exchanges/{exhangeName}), the 'id' parameter there becomes the
            name here
        name:
          type: string
          description: >-
            The name of the exchange. 
        private:
          type: boolean
          description: Whether this exchange is private (has apiKey) or public (no apiKey)
        enableRateLimit:
          type: boolean
          description: >-
            Whether to enable the built in rate limiter or not. The built in
            rate limiter is an approximation of the actual exchange's limit. To
            have a more accurate rate limiting, set this to false and implement
            the rate limiter on your client
          default: true
        countries:
          type: array
          description: The list of countries where this exchange is a member of
          items:
            type: string
        rateLimit:
          type: integer
          description: >-
            A request rate limit in milliseconds. Specifies the required minimal
            delay between two consequent HTTP requests to the same exchange. If
            enableRateLimit is set to false, this would be ignored.
        twofa:
          type: boolean
          description: Whether to enable two factor authentication or not
          default: false
        has:
          $ref: '#/components/schemas/ExchangeHasCapabilities'
        urls:
          type: object
          properties: {}
          description: Collection of URLs this exchange has
    TickerResponse:
      required:
        - ask
        - baseVolume
        - bid
        - close
        - datetime
        - high
        - info
        - last
        - low
        - quoteVolume
        - symbol
        - timestamp
        - vwap
      type: object
      properties:
        symbol:
          type: string
          description: The currency pair of this tick
        timestamp:
          type: number
          description: The timestamp of this tick
        datetime:
          type: string
          description: The datetime of this tick
          format: date-time
        high:
          type: number
          description: The higest price of this tick
        low:
          type: number
          description: The lowest price of this tick
        bid:
          type: number
          description: The current bid price of this tick
        ask:
          type: number
          description: The current ask price of this tick
        vwap:
          type: number
          description: The volume weighted average price of this tick
        close:
          type: number
          description: The closing price of this tick
        last:
          type: number
          description: The last price of this tick
        baseVolume:
          type: number
          description: The volume of the base currency of this tick
        quoteVolume:
          type: number
          description: The volume of the quote currency of this tick
        info:
          type: object
          properties: {}
          description: Raw ticker response gotten from the exchange site's API
    Limit:
      required:
        - max
        - min
      type: object
      properties:
        min:
          type: number
          description: The minimum allowable value
        max:
          type: number
          description: The maximum allowable value
    ExchangeCapability:
      type: string
      enum:
        - 'true'
        - 'false'
        - emulated
    ExchangeHasCapabilities:
      required:
        - CORS
        - cancelOrder
        - cancelOrders
        - createDepositAddress
        - createLimitOrder
        - createMarketOrder
        - createOrder
        - editOrder
        - fetchBalance
        - fetchBidsAsks
        - fetchClosedOrders
        - fetchCurrencies
        - fetchDepositAddress
        - fetchFundingFees
        - fetchL2OrderBook
        - fetchMarkets
        - fetchMyTrades
        - fetchOHLCV
        - fetchOpenOrders
        - fetchOrder
        - fetchOrderBook
        - fetchOrderBooks
        - fetchOrders
        - fetchTicker
        - fetchTickers
        - fetchTrades
        - fetchTradingFees
        - fetchTradingLimits
        - privateAPI
        - publicAPI
        - withdraw
      type: object
      properties:
        CORS:
          $ref : "#/components/schemas/ExchangeCapability"
        publicAPI:
          $ref : "#/components/schemas/ExchangeCapability"
        privateAPI:
          $ref : "#/components/schemas/ExchangeCapability"
        cancelOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        cancelOrders:
          $ref : "#/components/schemas/ExchangeCapability"
        createDepositAddress:
          $ref : "#/components/schemas/ExchangeCapability"
        createOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        createMarketOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        createLimitOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        editOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchBalance:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchBidsAsks:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchClosedOrders:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchCurrencies:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchDepositAddress:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchFundingFees:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchL2OrderBook:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchMarkets:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchMyTrades:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOHLCV:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOpenOrders:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOrder:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOrderBook:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOrderBooks:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchOrders:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchTicker:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchTickers:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchTrades:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchTradingFees:
          $ref : "#/components/schemas/ExchangeCapability"
        fetchTradingLimits:
          $ref : "#/components/schemas/ExchangeCapability"
        withdraw:
          $ref : "#/components/schemas/ExchangeCapability"
    exchangeConfig:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: >-
            The unique identifier for this exchange. 
        apiKey:
          type: string
          description: >-
            The API key you got from the exchange itself. This with the secret
            is what will allow you to access the exchange
        secret:
          type: string
          description: >-
            The Secret key you got from the exchange itself. This with the
            apiKey is what will allow you to access the exchange
        enableRateLimit:
          type: boolean
          description: >-
            Whether to enable the built in rate limiter or not. The built in
            rate limiter is an approximation of the actual exchange's limit. To
            have a more accurate rate limiting, set this to false and implement
            the rate limiter on your client
          default: true
    orderPlacement:
      required:
        - amount
        - side
        - symbol
        - type
      type: object
      properties:
        symbol:
          type: string
          description: The currency pair (base/quote) of the order to be created
        type:
          $ref : "#/components/schemas/OrderType"
        side:
          $ref : "#/components/schemas/Side"
        amount:
          type: number
          description: The amount of currency pair's base that we want to buy or sell
        price:
          type: number
          description: >-
            The buying price or the selling price in terms of the quote. Price
            is needed for market orders and ignored in limit orders
        exchangeSpecificParams:
          type: object
          properties: {}
          description: Exchange specific parameters
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT  
  parameters:
    orderIdParam:
      name: orderId
      in: path
      description: >-
        The id of the order. Possible values are any of the result of
        GET:/exchange/{exchangeName}/orders.
      required: true
      style: simple
      explode: false
      schema:
        type: string
    requiredExchangeSymbolParam:
      name: symbol
      in: query
      description: >-
        The symbol of the exchange's data to be retrieved. Possible values are
        any of symbols in GET:/exchange/{exchangeName}/markets
      required: true
      style: form
      explode: true
      schema:
        type: string
    optionalExchangeSymbolParam:
      name: symbol
      in: query
      description: >-
        The symbol of the exchange's data to be retrieved. Possible values are
        any of symbols in GET:/exchange/{exchangeName}/markets
      required: false
      style: form
      explode: true
      schema:
        type: string
    exchangeNameParam:
      name: exchangeName
      in: path
      description: >-
        The name of the exchange. Possible values are any of the result of
        GET:/exchanges.
      required: true
      style: simple
      explode: false
      schema:
        $ref : "#/components/schemas/Exchange"
