### MetaAPI Cloud Configuration API Methods Source: https://metaapi.cloud/docs/copyfactory Endpoints for managing strategies, portfolios, subscribers, and webhooks within the MetaAPI Cloud Copy Factory. These methods allow for creation, retrieval, update, and deletion of various configuration entities. ```APIDOC Configuration API: Group: Strategy Management - POST /copyfactory/restApi/api/configuration/generateStrategyId Description: Generates a unique identifier for a new strategy. Returns: JSON object containing the new strategy ID. - GET /copyfactory/restApi/api/configuration/strategies Description: Retrieves a list of all available strategies. Returns: JSON array of strategy objects. - GET /copyfactory/restApi/api/configuration/strategies/{strategyId} Description: Retrieves details for a specific strategy by its ID. Parameters: - strategyId (string): The unique identifier of the strategy. Returns: JSON object representing the strategy. - PUT /copyfactory/restApi/api/configuration/strategies/{strategyId} Description: Updates an existing strategy. Parameters: - strategyId (string): The unique identifier of the strategy to update. Request Body: JSON object with updated strategy details. Returns: JSON object representing the updated strategy. - DELETE /copyfactory/restApi/api/configuration/strategies/{strategyId} Description: Removes a strategy. Parameters: - strategyId (string): The unique identifier of the strategy to remove. Returns: Success message or status. Group: Portfolio Strategy Management - GET /copyfactory/restApi/api/configuration/portfolioStrategies Description: Retrieves a list of all portfolio strategies. Returns: JSON array of portfolio strategy objects. - GET /copyfactory/restApi/api/configuration/portfolioStrategies/{portfolioStrategyId} Description: Retrieves details for a specific portfolio strategy by its ID. Parameters: - portfolioStrategyId (string): The unique identifier of the portfolio strategy. Returns: JSON object representing the portfolio strategy. - PUT /copyfactory/restApi/api/configuration/portfolioStrategies/{portfolioStrategyId} Description: Updates an existing portfolio strategy. Parameters: - portfolioStrategyId (string): The unique identifier of the portfolio strategy to update. Request Body: JSON object with updated portfolio strategy details. Returns: JSON object representing the updated portfolio strategy. - DELETE /copyfactory/restApi/api/configuration/portfolioStrategies/{portfolioStrategyId} Description: Removes a portfolio strategy. Parameters: - portfolioStrategyId (string): The unique identifier of the portfolio strategy to remove. Returns: Success message or status. - DELETE /copyfactory/restApi/api/configuration/portfolioStrategies/{portfolioStrategyId}/members/{memberId} Description: Removes a specific member from a portfolio strategy. Parameters: - portfolioStrategyId (string): The ID of the portfolio strategy. - memberId (string): The ID of the member to remove. Returns: Success message or status. Group: Subscriber Management - GET /copyfactory/restApi/api/configuration/subscribers Description: Retrieves a list of all subscribers. Returns: JSON array of subscriber objects. - GET /copyfactory/restApi/api/configuration/subscribers/{subscriberId} Description: Retrieves details for a specific subscriber by their ID. Parameters: - subscriberId (string): The unique identifier of the subscriber. Returns: JSON object representing the subscriber. - PUT /copyfactory/restApi/api/configuration/subscribers/{subscriberId} Description: Updates an existing subscriber. Parameters: - subscriberId (string): The unique identifier of the subscriber to update. Request Body: JSON object with updated subscriber details. Returns: JSON object representing the updated subscriber. - DELETE /copyfactory/restApi/api/configuration/subscribers/{subscriberId} Description: Removes a subscriber. Parameters: - subscriberId (string): The unique identifier of the subscriber to remove. Returns: Success message or status. - DELETE /copyfactory/restApi/api/configuration/subscriptions/{subscriptionId} Description: Removes a specific subscription. Parameters: - subscriptionId (string): The unique identifier of the subscription to remove. Returns: Success message or status. Group: Webhook Management - GET /copyfactory/restApi/api/configuration/webhooks Description: Retrieves a list of all configured webhooks. Returns: JSON array of webhook objects. - POST /copyfactory/restApi/api/configuration/webhooks Description: Creates a new webhook. Request Body: JSON object with webhook configuration details. Returns: JSON object representing the created webhook. - PUT /copyfactory/restApi/api/configuration/webhooks/{webhookId} Description: Updates an existing webhook. Parameters: - webhookId (string): The unique identifier of the webhook to update. Request Body: JSON object with updated webhook details. Returns: JSON object representing the updated webhook. - DELETE /copyfactory/restApi/api/configuration/webhooks/{webhookId} Description: Removes a webhook. Parameters: - webhookId (string): The unique identifier of the webhook to remove. Returns: Success message or status. ``` -------------------------------- ### MetaApi REST API - Trading and Utility Functions Source: https://metaapi.cloud/docs/client Includes essential functions for trading operations like calculating margin requirements and executing trades, as well as retrieving system-level information like CPU credit usage. ```APIDOC REST API Methods - Trading and Utility Functions: calculateMargin(symbol: string, volume: number, type: 'buy' | 'sell') - Calculates the margin required for a specific trade. - Parameters: - symbol: The trading symbol. - volume: The trade volume (e.g., in lots). - type: The trade type ('buy' or 'sell'). - Returns: Margin calculation result object. trade(accountId: string, order: object) - Executes a trading order on a MetaTrader account. - Parameters: - accountId: The ID of the trading account. - order: An object containing order details (e.g., symbol, volume, type, price, stopLoss, takeProfit). - Returns: Trade execution result object. retrieveCPUCreditUsage() - Retrieves information about the CPU credit usage for the account. - Returns: CPU credit usage object. ``` -------------------------------- ### MetaAPI Cloud Trading API Methods Source: https://metaapi.cloud/docs/copyfactory Endpoints for managing trading signals, stop-outs, logs, and performing synchronization operations within the MetaAPI Cloud Copy Factory. ```APIDOC Trading API: Group: Trading Signals - GET /copyfactory/restApi/api/trading/getTradingSignals Description: Retrieves trading signals. Returns: JSON array of trading signal objects. - GET /copyfactory/restApi/api/trading/getStrategyExternalSignals Description: Retrieves external trading signals for a strategy. Parameters: - strategyId (string): The identifier of the strategy. Returns: JSON array of external signal objects. - PUT /copyfactory/restApi/api/trading/updateExternalSignal Description: Updates an external trading signal. Request Body: JSON object with updated signal details. Returns: JSON object representing the updated signal. - DELETE /copyfactory/restApi/api/trading/removeExternalSignal Description: Removes an external trading signal. Parameters: - signalId (string): The identifier of the signal to remove. Returns: Success message or status. Group: Stop-Out Management - GET /copyfactory/restApi/api/trading/getStopOuts Description: Retrieves stop-out information. Returns: JSON array of stop-out objects. - POST /copyfactory/restApi/api/trading/resetSubscriptionStopOuts Description: Resets stop-outs for a subscription. Parameters: - subscriptionId (string): The identifier of the subscription. Returns: Success message or status. - POST /copyfactory/restApi/api/trading/resetSubscriberStopOuts Description: Resets stop-outs for a subscriber. Parameters: - subscriberId (string): The identifier of the subscriber. Returns: Success message or status. - GET /copyfactory/restApi/api/trading/getStopOutsStream Description: Retrieves a real-time stream of stop-out events. Returns: WebSocket or SSE stream of stop-out data. Group: Synchronization and Logging - POST /copyfactory/restApi/api/trading/resynchronize Description: Initiates a resynchronization process. Returns: Success message or status. - GET /copyfactory/restApi/api/trading/getUserLog Description: Retrieves the user's trading log. Returns: JSON array of log entries. - GET /copyfactory/restApi/api/trading/getUserLogStream Description: Retrieves a real-time stream of the user's trading log. Returns: WebSocket or SSE stream of log data. - GET /copyfactory/restApi/api/trading/getStrategyLog Description: Retrieves the trading log for a specific strategy. Parameters: - strategyId (string): The identifier of the strategy. Returns: JSON array of log entries. - GET /copyfactory/restApi/api/trading/getStrategyLogStream Description: Retrieves a real-time stream of the trading log for a strategy. Parameters: - strategyId (string): The identifier of the strategy. Returns: WebSocket or SSE stream of log data. ``` -------------------------------- ### MetaApi REST API Methods Source: https://metaapi.cloud/docs/risk-management Provides documentation for various REST API endpoints used to manage and query trading risk trackers. This includes methods for creating, retrieving, updating, and removing trackers, as well as fetching related data like events and statistics. ```APIDOC Create tracker: POST /v1/trackers Creates a new trading risk tracker. Request Body: NewTracker object (e.g., {"name": "MyTracker", "account": "acc_123"}) Returns: Tracker object or Error object. Get tracker events: GET /v1/trackers/{trackerId}/events Retrieves a list of events for a specific tracker. Parameters: trackerId: The unique identifier of the tracker. fromEventId: (Optional) Filter events from this ID. limit: (Optional) Maximum number of events to return. Returns: Array of TrackerEvent objects or Error object. Get tracker events stream: GET /v1/trackers/{trackerId}/events/stream Establishes a stream to receive real-time events for a tracker. Parameters: trackerId: The unique identifier of the tracker. Returns: Stream of TrackerEvent objects. Get tracking stats: GET /v1/trackers/{trackerId}/stats Retrieves statistical data for a specific tracker. Parameters: trackerId: The unique identifier of the tracker. period: (Optional) The time period for statistics (e.g., '1d', '1w'). Returns: Array of PeriodStatistics objects or Error object. Get tracker by id: GET /v1/trackers/{trackerId} Retrieves a specific tracker by its unique identifier. Parameters: trackerId: The unique identifier of the tracker. Returns: Tracker object or Error object. Get tracker by name: GET /v1/trackers/name/{trackerName} Retrieves a specific tracker by its name. Parameters: trackerName: The name of the tracker. Returns: Tracker object or Error object. Get trackers: GET /v1/trackers Retrieves a list of all available trackers. Parameters: accountId: (Optional) Filter trackers by account ID. Returns: Array of Tracker objects or Error object. Get equity chart: GET /v1/trackers/{trackerId}/equityChart Retrieves equity chart data for a specific tracker. Parameters: trackerId: The unique identifier of the tracker. period: (Optional) The time period for the chart data. Returns: Array of EquityChartItem objects or Error object. Remove tracker: DELETE /v1/trackers/{trackerId} Removes a specific tracker. Parameters: trackerId: The unique identifier of the tracker. Returns: Success message or Error object. Update tracker: PUT /v1/trackers/{trackerId} Updates an existing tracker. Parameters: trackerId: The unique identifier of the tracker. Request Body: Tracker object with updated fields. Returns: Tracker object or Error object. ``` -------------------------------- ### MetaApi Cloud API Data Models Source: https://metaapi.cloud/docs/client This section lists the various data models available through the MetaApi cloud forex trading API. These models represent different aspects of trading accounts, positions, orders, and market data, providing a structured way to interact with MetaTrader platforms via REST and Websocket APIs. ```APIDOC Margin: Represents margin details for a trading account. MarginOrder: Details of a margin order. MetatraderAccountInformation: Information about a MetaTrader account. MetatraderPosition: Represents an open position in MetaTrader. MetatraderOrder: Represents an order in MetaTrader. MetatraderDeal: Represents a deal executed in MetaTrader. MetatraderTrade: General trade information. MetatraderTradeResponse: Response structure for trade operations. MetatraderSymbolSpecification: Specifications for a trading symbol. MetatraderSymbolPrice: Current price information for a symbol. MetatraderCandle: Represents a trading candle (OHLCV data). MetatraderTick: Represents a market tick data point. MetatraderBook: Represents market depth or order book data. ServerTime: Information about the server's current time. TooManyRequestsError: Error model for rate limiting. TrailingStopLoss: Configuration for trailing stop loss orders. ``` -------------------------------- ### MetaStats REST API Methods Source: https://metaapi.cloud/docs/metastats This section details the core REST API methods available for calculating and retrieving forex trading statistics. It covers endpoints for calculating metrics, fetching historical and open trades, and resetting statistics. Each method is designed to provide specific insights into trading performance. ```APIDOC API Methods: 1. **Calculate metrics** * Description: Endpoint for calculating various forex trading metrics. * Details: Refer to the specific documentation for parameters, request body, and response structure. * Related: Get Historical Trades, Get Open Trades, Reset metrics 2. **Get Historical Trades** * Description: Retrieves a list of historical trading records. * Details: Requires parameters to specify the date range and other filtering criteria. Returns trade data. * Related: Calculate metrics, Get Open Trades, Reset metrics 3. **Get Open Trades** * Description: Retrieves a list of currently open trading positions. * Details: Allows fetching real-time open trade data. Specific parameters may be required for filtering. * Related: Calculate metrics, Get Historical Trades, Reset metrics 4. **Reset metrics** * Description: Resets calculated trading statistics. * Details: This action typically requires authentication and confirmation. Use with caution as it may delete accumulated data. * Related: Calculate metrics, Get Historical Trades, Get Open Trades ``` -------------------------------- ### MetaAPI Cloud CopyFactory API Models Source: https://metaapi.cloud/docs/copyfactory This section lists the various data models used within the MetaAPI Cloud CopyFactory API. These models define the structure for entities such as strategies, signals, subscribers, webhooks, and transactions, providing details on their properties and relationships. ```APIDOC Error: - Represents an API error response. - Properties: code, message, details ExternalSignal: - Represents an external trading signal. - Properties: id, timestamp, type, symbol, price, volume, comment, orderType, magic, accountId, strategyId NewWebhook: - Defines a new webhook configuration. - Properties: url, events, secret PortfolioStrategy: - Represents a portfolio strategy. - Properties: id, name, description, creatorId, createdAt, updatedAt, status, riskSettings, symbolMappings, tradeSizeScaling, timeSettings, newsFilter, magicFilter, drawdownFilter, equityCurveFilter, telegramSettings, symbolFilter, maxStopLoss, riskLimit, signalDelay PortfolioStrategyList: - A list of portfolio strategies. - Properties: items, total PortfolioStrategyMember: - Represents a member of a portfolio strategy. - Properties: userId, role, addedAt SignalDelay: - Configuration for signal delay. - Properties: enabled, delaySeconds Strategy: - Represents a trading strategy. - Properties: id, name, description, creatorId, createdAt, updatedAt, status, riskSettings, symbolMappings, tradeSizeScaling, timeSettings, newsFilter, magicFilter, drawdownFilter, equityCurveFilter, telegramSettings, symbolFilter, maxStopLoss, riskLimit, signalDelay StrategyList: - A list of trading strategies. - Properties: items, total StrategyDrawdownFilter: - Filter based on strategy drawdown. - Properties: maxDrawdownPercent StrategyEquityCurveFilter: - Filter based on strategy equity curve. - Properties: maxEquityDrawdown StrategyIdAndName: - Identifies a strategy by its ID and name. - Properties: id, name StrategyMagicFilter: - Filter based on magic numbers. - Properties: magicNumbers StrategyMaxStopLoss: - Configuration for maximum stop loss. - Properties: maxStopLossPips StrategyNewsFilter: - Filter based on news events. - Properties: enabled, allowedCountries StrategyRiskLimit: - Configuration for risk limits. - Properties: maxRiskPerTradePercent, maxTotalRiskPercent StrategySubscription: - Represents a subscription to a strategy. - Properties: strategyId, subscriberId, subscribedAt, status StrategySymbolFilter: - Filter trades based on symbols. - Properties: allowedSymbols, deniedSymbols StrategyTelegramSettings: - Telegram notification settings for a strategy. - Properties: botToken, chatId StrategyTimeSettings: - Time-based settings for a strategy. - Properties: tradingHours, tradingDays StrategyTradeSizeScaling: - Configuration for scaling trade size. - Properties: scalingType, fixedVolume, volumePerBalance, volumePerEquity Subscriber: - Represents a subscriber to a strategy. - Properties: id, userId, subscribedAt, status, strategyId SubscriberList: - A list of subscribers. - Properties: items, total SubscriberOrProviderUser: - Represents either a subscriber or a provider user. - Properties: userId, role SymbolMapping: - Maps symbols between different systems. - Properties: sourceSymbol, targetSymbol TradingSignal: - Represents a trading signal. - Properties: id, timestamp, type, symbol, price, volume, comment, orderType, magic, accountId, strategyId, subscriberId Transaction: - Represents a financial transaction. - Properties: id, timestamp, type, amount, currency, accountId, strategyId, subscriberId TransactionMetrics: - Metrics related to transactions. - Properties: totalVolume, totalProfit, numberOfTrades UpdatedExternalSignal: - Represents an updated external trading signal. - Properties: id, timestamp, type, symbol, price, volume, comment, orderType, magic, accountId, strategyId UpdatedPortfolioStrategy: - Represents an updated portfolio strategy. - Properties: id, name, description, status, riskSettings, symbolMappings, tradeSizeScaling, timeSettings, newsFilter, magicFilter, drawdownFilter, equityCurveFilter, telegramSettings, symbolFilter, maxStopLoss, riskLimit, signalDelay UpdatedStrategy: - Represents an updated trading strategy. - Properties: id, name, description, status, riskSettings, symbolMappings, tradeSizeScaling, timeSettings, newsFilter, magicFilter, drawdownFilter, equityCurveFilter, telegramSettings, symbolFilter, maxStopLoss, riskLimit, signalDelay UpdatedSubscriber: - Represents an updated subscriber. - Properties: id, status, subscribedAt UserLogMessage: - Represents a log message from a user. - Properties: timestamp, level, message, userId Webhook: - Represents a webhook configuration. - Properties: id, url, events, secret, createdAt, updatedAt WebhookIdAndUrl: - Identifies a webhook by its ID and URL. - Properties: id, url WebhookList: - A list of webhooks. - Properties: items, total WebhookSignal: - Represents a signal sent via webhook. - Properties: webhookId, signalId, timestamp, status WebhookSignalId: - Identifies a webhook signal by its ID. - Properties: id WebhookUpdate: - Represents an update to a webhook configuration. - Properties: url, events, secret ``` -------------------------------- ### MetaAPI Cloud History API Methods Source: https://metaapi.cloud/docs/copyfactory Endpoints for retrieving historical trading data, including provided transactions, subscription transactions, and transaction streams for strategies and subscribers. ```APIDOC History API: Group: Transaction History - GET /copyfactory/restApi/api/history/getProvidedTransactions Description: Retrieves transactions provided by the system. Returns: JSON array of transaction objects. - GET /copyfactory/restApi/api/history/getSubscriptionTransactions Description: Retrieves transactions related to subscriptions. Returns: JSON array of transaction objects. Group: Transaction Streams - GET /copyfactory/restApi/api/history/getStrategyTransactionStream Description: Retrieves a real-time stream of transactions for a strategy. Parameters: - strategyId (string): The identifier of the strategy. Returns: WebSocket or SSE stream of transaction data. - GET /copyfactory/restApi/api/history/getSubscriberTransactionStream Description: Retrieves a real-time stream of transactions for a subscriber. Parameters: - subscriberId (string): The identifier of the subscriber. Returns: WebSocket or SSE stream of transaction data. ``` -------------------------------- ### MetaTrader 5 Manager API Methods Source: https://metaapi.cloud/docs/manager This section details the available REST API methods for managing MetaTrader 5 accounts, including creation, deletion, configuration, and retrieval of account and group information. It also covers symbol management, trading permissions, and authentication logs. ```APIDOC MetaTrader 5 Manager API: - createAccount: Creates a new MT5 trading account. - removeAccount: Removes an existing MT5 trading account. - setAccountEnabled: Updates the enabled status of an MT5 account. - getGroups: Retrieves a list of all MT5 account groups. - getUsersByGroup: Retrieves MT5 accounts belonging to a specific group. - getUserByLogin: Retrieves a specific MT5 account by its login ID. - getGroupByName: Retrieves an MT5 account group by its name. - balance: Conducts balance operations (e.g., deposit, withdrawal) on an MT5 account. - getAccountInformation: Retrieves detailed information about an MT5 account. - changePasswordPermission: Updates the password change permission for an MT5 account. - changeUserGroup: Changes the group assignment for an MT5 account. - getAuthLog: Retrieves authentication logs for a specific MT5 account. - getAllAuthLog: Retrieves server-wide authentication logs. - setAccountReadonly: Updates the read-only permission for an MT5 account. - setAccountTrading: Updates the trading permission for an MT5 account. - checkPassword: Verifies the password for an MT5 account. - getSymbols: Retrieves a list of all available MT5 trading symbols. - getSymbolsByGroup: Retrieves MT5 trading symbols specific to a group. ```