swagger: "2.0"
schemes:
  - https
host: api.tradematic.com
info:
  contact:
    email: support@tradematic.com
  description: |
    ### Overview
    Tradematic Cloud is a trading infrastructure for building investment services.

    It’s a trading engine + API + ready-made adapters to stock and forex brokers, crypto exchanges, and market data providers.

    You can use it as a cloud API, or you can deploy it on your servers. 



    ### How to use Tradematic Cloud API

    Sign up at [tradematic.cloud](https://tradematic.cloud). After signing up, you will receive your API key.

    ### Authorization

    Add the 'X-API-KEY' header with your API key to each request.

    ### Examples of writing code with Tradematic Cloud API

    Examples are available at [tradematic.cloud](https://tradematic.cloud). 

    ### Swagger (.yaml) File
    Swagger (.yaml) file can be found [here](http://tradematic.cloud/sdk/swagger.yaml).
  title: Tradematic Cloud API
  version: 1.0.2
  x-apisguru-categories:
    - financial
  x-logo:
    backgroundColor: "#FFFFFF"
    url: https://tradematic.cloud/img/logo-dark.png
  x-origin:
    - format: swagger
      url: https://tradematic.cloud/sdk/swagger.yaml
      version: "2.0"
  x-providerName: tradematic.com
securityDefinitions:
  Secured:
    in: header
    name: X-API-Key
    type: apiKey
tags:
  - description: Server status
    name: Status API
  - description: Clients management
    name: Client API
  - description: Trading signals and copy trading
    name: Autofollow API
  - description: Backtest and optimization tasks management
    name: TaskManager API
  - description: Strategy builder
    name: Builder API
  - description: News
    name: News API
  - description: Market data
    name: MarketData API
  - description: Trading
    name: Cloud API
paths:
  /autofollow/strategies:
    get:
      description: Get autofollow strategies list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Strategy"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get autofollow strategies list
      tags:
        - Autofollow API
    post:
      description: Create new autofollow strategy
      parameters:
        - in: body
          name: body
          required: true
          schema:
            properties:
              strategy:
                $ref: "#/definitions/NewStrategy"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              strategyid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Create new autofollow strategy
      tags:
        - Autofollow API
  "/autofollow/strategies/{strategyid}":
    get:
      description: Get autofollow strategy by ID
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Strategy"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get autofollow strategy by ID
      tags:
        - Autofollow API
    put:
      description: Update autofollow strategy
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
        - in: body
          name: body
          required: true
          schema:
            properties:
              strategy:
                $ref: "#/definitions/UpdatedStrategy"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              result:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Update autofollow strategy
      tags:
        - Autofollow API
  "/autofollow/strategies/{strategyid}/content":
    put:
      description: Update rules for strategy that was created with strategy builder
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
        - in: body
          name: body
          required: true
          schema:
            properties:
              strategy:
                $ref: "#/definitions/UpdatedStrategyContent"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              strategyid:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Update rules for strategy that was created with strategy builder
      tags:
        - Autofollow API
  "/autofollow/strategies/{strategyid}/positions":
    get:
      description: Get positions for strategy
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/StrategyPosition"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get positions for strategy
      tags:
        - Autofollow API
  "/autofollow/strategies/{strategyid}/signals":
    get:
      description: Get trading signals for strategy
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
        - format: int64
          in: query
          name: count
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Signal"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get trading signals for strategy
      tags:
        - Autofollow API
    post:
      description: Send a new signal for autofollow strategy
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
        - in: body
          name: body
          required: true
          schema:
            properties:
              signal:
                $ref: "#/definitions/NewSignal"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              signalid:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Send a new signal for autofollow strategy
      tags:
        - Autofollow API
  /builder/rules:
    get:
      description: Get strategy builder rules list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Rule"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get strategy builder rules list
      tags:
        - Builder API
  "/builder/rules/{ruleid}":
    get:
      description: Get strategy builder rules by ID
      parameters:
        - format: int64
          in: path
          name: ruleid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Rule"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get strategy builder rules by ID
      tags:
        - Builder API
  /client/apikeys:
    get:
      description: Get API keys
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/APIKey"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get API keys
      tags:
        - Client API
    post:
      description: Create new API key
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              key:
                type: string
              keyid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Create new API key
      tags:
        - Client API
  "/client/apikeys/{keyid}":
    delete:
      description: Delete API key
      parameters:
        - format: int64
          in: path
          name: keyid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              keyid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Delete API key
      tags:
        - Client API
  /client/users:
    get:
      description: Get users list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/User"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get users list
      tags:
        - Client API
  /client/users/login:
    post:
      description: Logs user into the system
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              name:
                type: string
              userid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Logs user into the system
      tags:
        - Client API
  /client/users/register:
    post:
      description: Register a new user
      parameters:
        - in: body
          name: body
          required: true
          schema:
            properties:
              user:
                $ref: "#/definitions/NewUser"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              userid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Register a new user
      tags:
        - Client API
  "/client/users/{userid}":
    get:
      description: Get user by ID
      parameters:
        - format: int64
          in: path
          name: userid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/User"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get user by ID
      tags:
        - Client API
  /cloud/accounts:
    get:
      description: Get trading accounts list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Account"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get trading accounts list
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}":
    get:
      description: Get trading account by ID
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Account"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get trading account by ID
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/closeall":
    post:
      description: Close all positions by account
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Close all positions by account
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/orders":
    get:
      description: Get orders list by account
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Order"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get orders list by account
      tags:
        - Cloud API
    post:
      description: Place a new order
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
        - in: body
          name: body
          required: true
          schema:
            properties:
              order:
                $ref: "#/definitions/NewOrder"
            type: object
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Place a new order
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/orders/{orderid}":
    delete:
      description: Cancel an order by ID
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
        - format: int64
          in: path
          name: orderid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Cancel an order by ID
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/snapshots":
    get:
      description: Get account equity and cash snapshots
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Snapshot"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get account equity and cash snapshots
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/sync":
    post:
      description: Syhchronize an account with account active strategies
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Syhchronize an account with account active strategies
      tags:
        - Cloud API
  "/cloud/accounts/{accountid}/trades":
    get:
      description: Get trades list by account
      parameters:
        - format: int64
          in: path
          name: accountid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Trade"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get trades list by account
      tags:
        - Cloud API
  /cloud/commands:
    get:
      description: Get commands list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Command"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get commands list
      tags:
        - Cloud API
  "/cloud/commands/{commandid}":
    get:
      description: Get command by ID
      parameters:
        - format: int64
          in: path
          name: commandid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Command"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get command by ID
      tags:
        - Cloud API
  /cloud/connections:
    get:
      description: Get connections list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Connection"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get connections list
      tags:
        - Cloud API
    post:
      description: Create a new connection
      parameters:
        - in: body
          name: body
          required: true
          schema:
            properties:
              connection:
                $ref: "#/definitions/UpdatedConnection"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              connectionid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Create a new connection
      tags:
        - Cloud API
  "/cloud/connections/{connectionid}":
    delete:
      description: Delete connection by ID
      parameters:
        - format: int64
          in: path
          name: connectionid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              connectionid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Delete connection by ID
      tags:
        - Cloud API
    get:
      description: Get connection by ID
      parameters:
        - format: int64
          in: path
          name: connectionid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Connection"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get connection by ID
      tags:
        - Cloud API
    put:
      description: Update existing connection
      parameters:
        - format: int64
          in: path
          name: connectionid
          required: true
          type: integer
        - in: body
          name: body
          required: true
          schema:
            properties:
              connection:
                $ref: "#/definitions/UpdatedConnection"
            type: object
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              connectionid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Update existing connection
      tags:
        - Cloud API
  /cloud/connectors:
    get:
      description: Get available connectors list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Connector"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get available connectors list
      tags:
        - Cloud API
  "/cloud/connectors/{connectorid}":
    get:
      description: Get connector by ID
      parameters:
        - format: int64
          in: path
          name: connectorid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Connector"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get connector by ID
      tags:
        - Cloud API
  /cloud/sessions:
    get:
      description: Get sessions list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Session"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get sessions list
      tags:
        - Cloud API
  "/cloud/sessions/{sessionid}":
    get:
      description: Get session by ID
      parameters:
        - format: int64
          in: path
          name: sessionid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Session"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get session by ID
      tags:
        - Cloud API
  /cloud/strategies:
    get:
      description: Get list of active (executing) strategies
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/CloudStrategy"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get list of active (executing) strategies
      tags:
        - Cloud API
  /cloud/strategies/start:
    post:
      description: Start a strategy execution for account
      parameters:
        - in: body
          name: body
          required: true
          schema:
            properties:
              data:
                $ref: "#/definitions/StartStrategyData"
            type: object
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Start a strategy execution for account
      tags:
        - Cloud API
  "/cloud/strategies/{strategyid}":
    get:
      description: Get active (executing) strategy by ID
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/CloudStrategy"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get active (executing) strategy by ID
      tags:
        - Cloud API
  "/cloud/strategies/{strategyid}/stop":
    post:
      description: Stop a strategy execution by ID
      parameters:
        - format: int64
          in: path
          name: strategyid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              commandid:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Stop a strategy execution by ID
      tags:
        - Cloud API
  /marketdata/markets:
    get:
      description: Get markets list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Market"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get markets list
      tags:
        - MarketData API
  "/marketdata/markets/{marketid}":
    get:
      description: Get market by ID
      parameters:
        - format: int64
          in: path
          name: marketid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Market"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get market by ID
      tags:
        - MarketData API
  /marketdata/symbols:
    get:
      description: Get symbols list
      parameters:
        - format: int64
          in: query
          name: marketid
          required: true
          type: integer
        - format: int64
          in: query
          name: filter
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Symbol"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get symbols list
      tags:
        - MarketData API
  "/marketdata/symbols/{symbolid}":
    get:
      description: Get symbol by ID
      parameters:
        - format: int64
          in: path
          name: symbolid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Symbol"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get symbol by ID
      tags:
        - MarketData API
  "/marketdata/symbols/{symbolid}/histdata":
    get:
      description: Get historical data for instrument
      parameters:
        - format: int64
          in: path
          name: symbolid
          required: true
          type: integer
        - format: int64
          in: query
          name: tf
          required: true
          type: integer
        - format: int64
          in: query
          name: from
          required: true
          type: integer
        - format: int64
          in: query
          name: to
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              adjusted:
                type: boolean
              queryCount:
                type: integer
              results:
                items:
                  $ref: "#/definitions/Result"
                type: array
              resultsCount:
                type: integer
              status:
                type: string
              ticker:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get historical data for instrument
      tags:
        - MarketData API
  /news/news:
    get:
      description: Get news list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/News"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get news list
      tags:
        - News API
  "/news/news/{newsid}":
    get:
      description: Get news by ID
      parameters:
        - format: int64
          in: path
          name: newsid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/News"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get news by ID
      tags:
        - News API
  /ping:
    get:
      description: Ping
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Ping
      tags:
        - Status API
  /taskmanager/tasks:
    get:
      description: Get tasks list
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Task"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get tasks list
      tags:
        - TaskManager API
    post:
      description: Create a new task
      parameters:
        - in: body
          name: body
          required: true
          schema:
            properties:
              task:
                $ref: "#/definitions/NewTask"
            type: object
      produces:
        - application/json
      responses:
        "202":
          description: Successful operation
          schema:
            properties:
              taskid:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Create a new task
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}":
    get:
      description: Get task by ID
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            $ref: "#/definitions/Task"
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get task by ID
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/bymonths":
    get:
      description: Get backtest data for equity chart, grouped by months
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/ByMonths"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest data for equity chart, grouped by months
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/byquarters":
    get:
      description: Get backtest data for equity chart, grouped by quarters
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/ByQuarters"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest data for equity chart, grouped by quarters
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/byyears":
    get:
      description: Get backtest data for equity chart, grouped by years
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/ByYears"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest data for equity chart, grouped by years
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/contribution":
    get:
      description: Get backtest symbol contribution data
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/Contribution"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest symbol contribution data
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/drawdown":
    get:
      description: Get data for drawdown chart
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/DrawdownItem"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get data for drawdown chart
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/equity":
    get:
      description: Get data for equity chart
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/EquityItem"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get data for equity chart
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/equitypct":
    get:
      description: Get data for equity chart (%)
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/EquityPctItem"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get data for equity chart (%)
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/equitypctsm":
    get:
      description: Get spared data for equity chart (%)
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/EquityPctSmItem"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get spared data for equity chart (%)
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/folder":
    get:
      description: Get task result folder name
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              folder:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get task result folder name
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/performance":
    get:
      description: Get backtest statistics
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              buyandhold:
                $ref: "#/definitions/Longshort"
              long:
                $ref: "#/definitions/Longshort"
              longshort:
                $ref: "#/definitions/Longshort"
              short:
                $ref: "#/definitions/Longshort"
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest statistics
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/result":
    get:
      description: Get task result
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              bymonths_csv:
                type: string
              bymonths_png:
                type: string
              byquarters_csv:
                type: string
              byquarters_png:
                type: string
              byyears_csv:
                type: string
              byyears_png:
                type: string
              contribution_csv:
                type: string
              contribution_png:
                type: string
              drawdown_csv:
                type: string
              drawdown_png:
                type: string
              equity_csv:
                type: string
              equity_png:
                type: string
              equitypct_csv:
                type: string
              equitypct_png:
                type: string
              equitypctnofill_csv:
                type: string
              equitypctnofill_png:
                type: string
              equitypctsm:
                type: string
              equitypctsm_csv:
                type: string
              equitypctsm_png:
                type: string
              performance_csv:
                type: string
              performance_png:
                type: string
              trades_csv:
                type: string
              trades_png:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get task result
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/result2":
    get:
      description: Get task result (version 2)
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              apr:
                type: string
              curMonthProfit:
                type: string
              curYearProfit:
                type: string
              drawdown:
                type: string
              halfYearProfit:
                type: string
              monthProfit:
                type: string
              prevMonthProfit:
                type: string
              totalProfit:
                type: string
              weekProfit:
                type: string
              yearProfit:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get task result (version 2)
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/status":
    get:
      description: Get task status
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              status:
                type: string
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get task status
      tags:
        - TaskManager API
  "/taskmanager/tasks/{taskid}/trades":
    get:
      description: Get backtest trades list
      parameters:
        - format: int64
          in: path
          name: taskid
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            items:
              $ref: "#/definitions/BacktestTrade"
            type: array
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get backtest trades list
      tags:
        - TaskManager API
  /time:
    get:
      description: Get current server time
      produces:
        - application/json
      responses:
        "200":
          description: Successful operation
          schema:
            properties:
              servertime:
                type: integer
            type: object
        "500":
          description: Error
          schema:
            $ref: "#/definitions/Error"
      security:
        - Secured: []
      summary: Get current server time
      tags:
        - Status API
definitions:
  APIKey:
    properties:
      key:
        type: string
      keyid:
        type: string
      permissions:
        type: string
    type: object
  Account:
    properties:
      account:
        type: string
      accountid:
        type: string
      accounttypename:
        type: string
      cash:
        type: string
      change:
        type: string
      changepercent:
        type: string
      comments:
        type: string
      computer:
        type: string
      currencyid:
        type: string
      currencytext:
        type: string
      hwid:
        type: string
      positions:
        $ref: "#/definitions/Positions"
      positionspercent:
        $ref: "#/definitions/Positions"
      sessionid:
        type: string
      typeid:
        type: string
      value:
        type: string
    type: object
  BacktestTrade:
    properties:
      barsheld:
        type: string
      changepct:
        type: string
      commission:
        type: string
      entrydatetime:
        type: string
      entryprice:
        type: string
      entrysignal:
        type: string
      exitdatetime:
        type: string
      exitprice:
        type: string
      exitsignal:
        type: string
      mae:
        type: string
      mfe:
        type: string
      pandl:
        type: string
      position:
        type: string
      shares:
        type: string
      size:
        type: string
      symbol:
        type: string
    type: object
  ByMonths:
    properties:
      equitypct:
        type: string
      period:
        type: string
    type: object
  ByQuarters:
    properties:
      equitypct:
        type: string
      period:
        type: string
    type: object
  ByYears:
    properties:
      equitypct:
        type: string
      period:
        type: string
    type: object
  CloudStrategy:
    properties:
      account:
        type: string
      computer:
        type: string
      hwid:
        type: string
      message:
        type: string
      status:
        type: string
      strategy:
        type: string
      strategyid:
        type: string
      strategystatusname:
        type: string
    type: object
  Command:
    properties:
      account:
        type: string
      accountid:
        type: string
      commanddate:
        format: date-time
        type: string
      commandid:
        type: string
      commandstatusname:
        type: string
      commandtypename:
        type: string
      computer:
        type: string
      hwid:
        type: string
      message:
        type: string
      parameters:
        $ref: "#/definitions/Parameters"
      status:
        type: string
      timestamp:
        format: date-time
        type: string
      type:
        type: string
    type: object
  Connection:
    properties:
      active:
        type: string
      connectionid:
        type: string
      connectionstring:
        type: string
      connectorcode:
        type: string
      connectorid:
        type: string
      connectorname:
        type: string
      connectortypename:
        type: string
      creationdate:
        format: date-time
        type: string
      host:
        type: string
      login:
        type: string
      password:
        type: string
      port:
        type: string
      sessionid:
        type: string
      updatedate:
        format: date-time
        type: string
    type: object
  Connector:
    properties:
      code:
        type: string
      connectorid:
        type: string
      connectortypename:
        type: string
      name:
        type: string
      typeid:
        type: string
    type: object
  Contribution:
    properties:
      pandl:
        type: string
      share:
        type: string
      symbol:
        type: string
    type: object
  DrawdownItem:
    properties:
      drawdownpct:
        type: string
      timestamp:
        type: string
    type: object
  EquityItem:
    properties:
      cash:
        type: string
      equity:
        type: string
      timestamp:
        type: string
    type: object
  EquityPctItem:
    properties:
      buyandhold:
        type: string
      equity:
        type: string
      timestamp:
        type: string
    type: object
  EquityPctSmItem:
    properties:
      buyandhold:
        type: string
      equity:
        type: string
      timestamp:
        type: string
    type: object
  Error:
    properties:
      message:
        type: string
      status:
        type: integer
    type: object
  Longentry:
    properties:
      id:
        type: string
      name:
        type: string
      parameters:
        items:
          $ref: "#/definitions/Parameter"
        type: array
      validnot:
        type: string
      validor:
        type: string
    type: object
  Longexit:
    properties:
      id:
        type: string
      name:
        type: string
      parameters:
        items:
          $ref: "#/definitions/Parameter"
        type: array
      validnot:
        type: string
      validor:
        type: string
    type: object
  Longshort:
    properties:
      apr:
        type: string
      avgbarsheld:
        type: string
      avgloss:
        type: string
      avglossbarsheld:
        type: string
      avglosspct:
        type: string
      avgprofit:
        type: string
      avgprofitavgloss:
        type: string
      avgprofitbarsheld:
        type: string
      avgprofitpct:
        type: string
      endcapital:
        type: string
      exposure:
        type: string
      grossloss:
        type: string
      grossprofit:
        type: string
      losingtrades:
        type: string
      losingtradespct:
        type: string
      mar:
        type: string
      margininterest:
        type: string
      maxconsecloss:
        type: string
      maxconsecwin:
        type: string
      maxdrawdown:
        type: string
      maxdrawdowndate:
        type: string
      maxdrawdownlength:
        type: string
      maxdrawdownpct:
        type: string
      maxdrawdownpctdate:
        type: string
      mpr:
        type: string
      netprofit:
        type: string
      netprofitpct:
        type: string
      profitabletrades:
        type: string
      profitabletradespct:
        type: string
      profitfactor:
        type: string
      profitriskratio:
        type: string
      rar:
        type: string
      recoveryfactor:
        type: string
      sharperatio:
        type: string
      sortinoratio:
        type: string
      startcapital:
        type: string
      totalcommission:
        type: string
      totaltrades:
        type: string
      totalvolume:
        type: string
      turnover:
        type: string
    type: object
  Market:
    properties:
      code:
        type: string
      countryid:
        type: string
      marketid:
        type: string
      name:
        type: string
    type: object
  NewOrder:
    properties:
      buy:
        type: string
      price:
        type: string
      shares:
        type: string
      symbol:
        type: string
      type:
        type: string
    type: object
  NewSignal:
    properties:
      position:
        type: string
      price:
        type: string
      shares:
        type: string
      size:
        type: string
      symbol:
        type: string
      timestamp:
        format: date-time
        type: string
      type:
        type: string
    type: object
  NewStrategy:
    properties:
      apr:
        type: string
      author:
        type: string
      content:
        type: string
      description:
        type: string
      drawdown:
        type: string
      guid:
        type: string
      limitorder:
        type: string
      marketname:
        type: string
      multiposition:
        type: string
      name:
        type: string
      positionsize:
        type: string
      strategytypeid:
        type: string
      symbols:
        type: string
      timeframe:
        type: string
    type: object
  NewTask:
    properties:
      isbenchmark:
        type: string
      strategyid:
        type: string
      tasktypeid:
        type: string
      userid2:
        type: string
    type: object
  NewUser:
    properties:
      name:
        type: string
      password:
        type: string
      username:
        type: string
    type: object
  News:
    properties:
      body:
        type: string
      newsid:
        type: string
      source:
        type: string
      timestamp:
        format: date-time
        type: string
      title:
        type: string
    type: object
  Order:
    properties:
      account:
        type: string
      buy:
        type: string
      message:
        type: string
      number:
        type: string
      orderid:
        type: string
      price:
        type: string
      shares:
        type: string
      status:
        type: string
      statusname:
        type: string
      symbol:
        type: string
      timestamp:
        format: date-time
        type: string
    type: object
  Parameter:
    properties:
      default:
        type: string
      name:
        type: string
      start:
        type: string
      step:
        type: string
      stop:
        type: string
      type:
        type: string
    type: object
  Parameters:
    additionalProperties:
      type: string
    type: object
  Positions:
    additionalProperties:
      type: string
    type: object
  Result:
    properties:
      c:
        type: number
      h:
        type: number
      l:
        type: number
      n:
        type: integer
      o:
        type: number
      t:
        type: integer
      v:
        type: integer
    type: object
  Rule:
    properties:
      category:
        type: string
      description:
        type: string
      guid:
        type: string
      name:
        type: string
      parameters:
        items:
          $ref: "#/definitions/Parameter"
        type: array
      ruletype:
        type: string
      validnot:
        type: string
      validor:
        type: string
    type: object
  Rules:
    properties:
      longentry:
        items:
          $ref: "#/definitions/Longentry"
        type: array
      longexit:
        items:
          $ref: "#/definitions/Longexit"
        type: array
    type: object
  Session:
    properties:
      computer:
        type: string
      hwid:
        type: string
      login:
        type: string
      mode:
        type: string
      sessionid:
        type: string
      sessionmodename:
        type: string
      sessionstatusname:
        type: string
      status:
        type: string
      timestamp:
        format: date-time
        type: string
      type:
        type: string
      userid:
        type: string
    type: object
  Signal:
    properties:
      position:
        type: string
      price:
        type: string
      shares:
        type: string
      signalid:
        type: string
      size:
        type: string
      symbol:
        type: string
      timestamp:
        format: date-time
        type: string
      type:
        type: string
    type: object
  Snapshot:
    properties:
      cash:
        type: string
      daynum:
        type: string
      snapshotid:
        type: string
      timestamp:
        format: date-time
        type: string
      value:
        type: string
    type: object
  StartStrategyData:
    properties:
      accountid:
        type: string
      strategyid:
        type: string
    type: object
  Strategy:
    properties:
      apr:
        type: string
      author:
        type: string
      brokername:
        type: string
      code:
        type: string
      datascale:
        type: string
      description:
        type: string
      drawdown:
        type: string
      folder:
        type: string
      guid:
        type: string
      image:
        type: string
      limitorder:
        type: string
      marketname:
        type: string
      multiposition:
        type: string
      name:
        type: string
      owner:
        type: string
      permissions:
        type: string
      positionsize:
        type: string
      risklevelcode:
        type: string
      risklevelid:
        type: string
      risklevelname:
        type: string
      rules:
        $ref: "#/definitions/Rules"
      strategyid:
        type: string
      strategytypeid:
        type: string
      symbols:
        items:
          $ref: "#/definitions/Symbol"
        type: array
      taskfolder:
        type: string
      taskid:
        type: string
      taskresult:
        $ref: "#/definitions/Taskresult"
      timeframe:
        type: string
      updatedate:
        format: date-time
        type: string
      url:
        type: string
    type: object
  StrategyPosition:
    properties:
      date:
        format: date-time
        type: string
      price:
        type: string
      size:
        type: string
      symbol:
        type: string
    type: object
  Symbol:
    type: string
  Task:
    properties:
      isbenchmark:
        type: string
      name:
        type: string
      status:
        type: string
      statusupdatedate:
        format: date-time
        type: string
      strategyid:
        type: string
      taskid:
        type: string
      usestaticdata:
        type: string
    type: object
  Taskresult:
    properties:
      apr:
        type: string
      curMonthProfit:
        type: string
      curYearProfit:
        type: string
      drawdown:
        type: string
      halfYearProfit:
        type: string
      monthProfit:
        type: string
      prevMonthProfit:
        type: string
      totalProfit:
        type: string
      weekProfit:
        type: string
      yearProfit:
        type: string
    type: object
  Trade:
    properties:
      account:
        type: string
      buy:
        type: string
      number:
        type: string
      price:
        type: string
      shares:
        type: string
      symbol:
        type: string
      timestamp:
        format: date-time
        type: string
      tradeid:
        type: string
    type: object
  UpdatedConnection:
    properties:
      active:
        type: string
      connectorid:
        type: string
      host:
        type: string
      login:
        type: string
      password:
        type: string
      port:
        type: string
    type: object
  UpdatedStrategy:
    properties:
      author:
        type: string
      description:
        type: string
      limitorder:
        type: string
      marketname:
        type: string
      multiposition:
        type: string
      name:
        type: string
      symbols:
        type: string
    type: object
  UpdatedStrategyContent:
    properties:
      rules:
        $ref: "#/definitions/Rules"
    type: object
  User:
    properties:
      comments:
        type: string
      createdby:
        type: string
      name:
        type: string
      regdate:
        type: string
      userid:
        type: string
      username:
        type: string
    type: object
