@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Tradematic API
@base https://api.tradematic.com
@version 1.0.6
@auth ApiKey X-API-Key in header
@endpoints 90
@hint download_for_search
@toc ping(1), time(1), client(10), autofollow(17), taskmanager(17), builder(2), marketdata(10), cloud(27), marketplace(5)

@group ping
@endpoint GET /ping
@desc Ping
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group time
@endpoint GET /time
@desc Get current server time
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group client
@endpoint GET /client/users
@desc Get users list
@optional {username: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /client/users/{userid}
@desc Get user by ID
@required {userid: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint POST /client/users/login
@desc Logs user into the system
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /client/users/register
@desc Register a new user
@required {body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /client/users/roles
@desc Get user roles list
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /client/users/{userid}/role
@desc Get user roles list
@required {userid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /client/users/check
@desc Checks for a user
@required {body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /client/apikeys
@desc Get API keys
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /client/apikeys
@desc Create new API key
@returns(200) Successful operation
@errors {500: Error}

@endpoint DELETE /client/apikeys/{keyid}
@desc Delete API key
@required {keyid: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endgroup

@group autofollow
@endpoint GET /autofollow/strategies
@desc Get autofollow strategies list
@optional {filter: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /autofollow/strategies
@desc Create new autofollow strategy
@required {body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/{strategyid}
@desc Get autofollow strategy by ID
@required {strategyid: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint PUT /autofollow/strategies/{strategyid}
@desc Update autofollow strategy
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /autofollow/strategies/{strategyid}/content
@desc Update rules for strategy that was created with strategy builder, or just content field
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /autofollow/strategies/{strategyid}/state
@desc Update autofollow strategy state
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /autofollow/strategies/{strategyid}/status
@desc Update autofollow strategy status
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/{strategyid}/positions
@desc Get positions for strategy
@required {strategyid: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint POST /autofollow/strategies/{strategyid}/positions
@desc Send a new position for autofollow strategy
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /autofollow/strategies/{strategyid}/positions
@desc Update an existing position for autofollow strategy
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint DELETE /autofollow/strategies/{strategyid}/positions
@desc Delete an existing position for autofollow strategy
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/{strategyid}/signals
@desc Get trading signals for strategy
@required {strategyid: any}
@optional {count: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint POST /autofollow/strategies/{strategyid}/signals
@desc Send a new signal for autofollow strategy
@required {strategyid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/risklevels
@desc Get risk levels
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/rates
@desc Get strategies rates
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/strategies/statuses
@desc Get strategies statuses
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /autofollow/authors
@desc Get authors
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group taskmanager
@endpoint GET /taskmanager/tasks
@desc Get tasks list
@optional {count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /taskmanager/tasks
@desc Create a new task
@required {body: map}
@returns(202) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}
@desc Get task by ID
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/status
@desc Get task status
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/folder
@desc Get task result folder name
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/result
@desc Get task result
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/result2
@desc Get task result (version 2)
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/equity
@desc Get data for equity chart
@required {taskid: any}
@optional {count: any, from: any, to: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/equitypct
@desc Get data for equity chart (%)
@required {taskid: any}
@optional {count: any, from: any, to: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/equitypctsm
@desc Get spared data for equity chart (%)
@required {taskid: any}
@optional {count: any, from: any, to: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/drawdown
@desc Get data for drawdown chart
@required {taskid: any}
@optional {count: any, from: any, to: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/performance
@desc Get backtest statistics
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/trades
@desc Get backtest trades list
@required {taskid: any}
@optional {count: any, from: any, to: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/contribution
@desc Get backtest symbol contribution data
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/bymonths
@desc Get backtest data for equity chart, grouped by months
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/byquarters
@desc Get backtest data for equity chart, grouped by quarters
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /taskmanager/tasks/{taskid}/byyears
@desc Get backtest data for equity chart, grouped by years
@required {taskid: any}
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group builder
@endpoint GET /builder/rules
@desc Get strategy builder rules list
@optional {filter: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /builder/rules/{ruleid}
@desc Get strategy builder rules by ID
@required {ruleid: any}
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group marketdata
@endpoint GET /marketdata/markets
@desc Get markets list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketdata/markets/{name}
@desc Get market by name
@required {name: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint GET /marketdata/indicators
@desc Get technical indicators list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketdata/indicators/{name}
@desc Get technical indicator by name
@required {name: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint GET /marketdata/indicators/{name}/histdata
@desc Get technical indicator historical data by name
@required {name: any, symbol: any, tf: any}
@optional {from: any, to: any, count: any, params: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint GET /marketdata/symbols
@desc Get symbols list
@optional {market: any, name: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketdata/symbols/{name}
@desc Get symbol by name
@required {name: any}
@returns(200) Successful operation
@errors {404: Not found, 500: Error}

@endpoint GET /marketdata/symbols/{name}/histdata
@desc Get historical data for instrument
@required {name: any, tf: any}
@optional {from: any, to: any, count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketdata/symbols/{name}/snapshot
@desc Get snapshot for a symbol by name
@required {name: any}
@optional {dt: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketdata/symbols/snapshots
@desc Get snapshots for symbols
@required {body: [str]}
@optional {dt: any}
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group cloud
@endpoint GET /cloud/accounts
@desc Get trading accounts list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}
@desc Get trading account by ID
@required {accountid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}/orders
@desc Get orders list by account
@required {accountid: any}
@optional {from: any, to: any, count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /cloud/accounts/{accountid}/orders
@desc Place a new order
@required {accountid: any, body: map}
@returns(202) Successful operation
@errors {500: Error}

@endpoint DELETE /cloud/accounts/{accountid}/orders/{orderid}
@desc Cancel an order by ID
@required {accountid: any, orderid: any}
@returns(202) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}/trades
@desc Get trades list by account
@required {accountid: any}
@optional {from: any, to: any, count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}/snapshots
@desc Get account equity and cash snapshots
@required {accountid: any}
@optional {from: any, to: any, count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /cloud/accounts/{accountid}/closeall
@desc Close all positions by account
@required {accountid: any}
@returns(202) Successful operation
@errors {500: Error}

@endpoint POST /cloud/accounts/{accountid}/close
@desc Close symbol position by account
@required {accountid: any, body: map}
@returns(202) Successful operation
@errors {500: Error}

@endpoint POST /cloud/accounts/{accountid}/sync
@desc Syhchronize an account with account active strategies
@required {accountid: any}
@returns(202) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}/sync
@desc Get synchronization status of account with account active strategies
@required {accountid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/accounts/{accountid}/commands
@desc Get commands list by account
@required {accountid: any}
@optional {from: any, to: any, count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/commands
@desc Get commands list
@optional {count: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/commands/{commandid}
@desc Get command by ID
@required {commandid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/sessions
@desc Get sessions list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/sessions/{sessionid}
@desc Get session by ID
@required {sessionid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/strategies
@desc Get list of active (executing) strategies
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/strategies/{strategyid}
@desc Get active (executing) strategy by ID
@required {strategyid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /cloud/strategies/start
@desc Start a strategy execution for account
@required {body: map}
@returns(202) Successful operation
@errors {500: Error}

@endpoint POST /cloud/strategies/{strategyid}/stop
@desc Stop a strategy execution by ID
@required {strategyid: any}
@returns(202) Successful operation
@errors {500: Error}

@endpoint GET /cloud/connectors
@desc Get available connectors list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/connectors/{connectorid}
@desc Get connector by ID
@required {connectorid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/connections
@desc Get connections list
@returns(200) Successful operation
@errors {500: Error}

@endpoint POST /cloud/connections
@desc Create a new connection
@required {body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /cloud/connections/{connectionid}
@desc Get connection by ID
@required {connectionid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint PUT /cloud/connections/{connectionid}
@desc Update existing connection
@required {connectionid: any, body: map}
@returns(200) Successful operation
@errors {500: Error}

@endpoint DELETE /cloud/connections/{connectionid}
@desc Delete connection by ID
@required {connectionid: any}
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@group marketplace
@endpoint GET /marketplace/balance
@desc Get user balance
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketplace/products
@desc Get products list
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketplace/products/{productid}
@desc Get product by ID
@required {productid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketplace/products/{productid}/rates
@desc Get product rates by product ID
@required {productid: any}
@returns(200) Successful operation
@errors {500: Error}

@endpoint GET /marketplace/groups
@desc Get product groups list
@returns(200) Successful operation
@errors {500: Error}

@endgroup

@end
