Get OHLCV (Crypto + MetaTrader)

Fetch OHLCV (Open, High, Low, Close, Volume) data from cryptocurrency exchanges or MetaTrader (commodities/forex)

Overview

This node fetches OHLCV (Open, High, Low, Close, Volume) data from either cryptocurrency exchanges or MetaTrader platforms for commodities and forex. It supports multiple crypto exchanges like Binance, Bybit, Kraken, and others, as well as MetaTrader 4 and 5 platforms via MetaAPI cloud service or a custom REST API. The node is useful for traders and analysts who want to retrieve historical market data for various trading pairs or commodities to perform technical analysis or build trading strategies.

Use Case Examples

  1. Fetch OHLCV data for BTC/USDT from Binance spot market with a 1-hour timeframe.
  2. Retrieve gold (XAU/USD) OHLCV data from MetaTrader 5 using MetaAPI cloud service.
  3. Get OHLCV data for EUR/USD forex pair from a custom MetaTrader REST API endpoint.

Properties

Name Meaning
Data Source Choose the data source type, either cryptocurrency exchanges or MetaTrader platforms.
Exchange Select the cryptocurrency exchange to fetch data from (shown only if Data Source is Crypto Exchange).
Mode Select trading mode for crypto exchanges: Spot or Future (shown only if Data Source is Crypto Exchange).
MetaTrader Platform Select MetaTrader platform version (shown only if Data Source is MetaTrader).
Connection Type Choose how to connect to MetaTrader: via MetaAPI cloud service or a custom REST API (shown only if Data Source is MetaTrader).
MetaAPI Token Authentication token for MetaAPI cloud service (required if using MetaAPI connection).
MetaAPI Account ID Account ID for MetaAPI cloud service (required if using MetaAPI connection).
REST API Endpoint URL of custom MetaTrader REST API endpoint (required if using REST connection).
API Key API key for authenticating with custom REST API (optional).
Symbol Trading pair symbol for crypto exchanges (e.g., BTC/USDT).
Symbol (MetaTrader) Select commodity or forex pair symbol for MetaTrader.
Custom Symbol Custom symbol name for MetaTrader (if 'Custom Symbol' is selected).
Timeframe Time interval for OHLCV data (e.g., 1m, 1h, 1d).
Limit Maximum number of OHLCV data points to return (between 1 and 1000).
Since Timestamp in milliseconds to fetch OHLCV data starting from this time.
Options Additional options such as API key, secret, password, sandbox mode, and whether to include timestamp in output.

Output

JSON

  • dataSource - Source of the data, either 'crypto' or 'metatrader'.
  • exchange - Name of the crypto exchange (if dataSource is 'crypto').
  • mode - Trading mode for crypto exchanges, e.g., spot or future.
  • symbol - Trading pair or symbol used for fetching data.
  • timeframe - Time interval for the OHLCV data.
  • limit - Maximum number of data points requested.
  • count - Number of OHLCV data points returned.
  • data - Array of OHLCV data points. Each data point is an array containing open, high, low, close, volume, and optionally timestamp.
  • metadata
    • exchangeId - Internal ID of the crypto exchange (if applicable).
    • exchangeName - Name of the crypto exchange (if applicable).
    • fetchTimestamp - Timestamp when data was fetched.
    • since - Timestamp from which data was requested (if provided).
  • platform - MetaTrader platform used (if dataSource is 'metatrader').
  • connectionType - Connection type for MetaTrader, either 'metaapi' or 'rest'.

Dependencies

  • ccxt library for cryptocurrency exchange API integration
  • https module for HTTPS requests
  • http module for HTTP requests (used with custom REST API)

Troubleshooting

  • Ensure the 'Limit' parameter is between 1 and 1000 to avoid errors.
  • Verify that the selected symbol exists on the chosen exchange or MetaTrader platform.
  • For MetaTrader with MetaAPI connection, ensure the MetaAPI Token and Account ID are correctly provided.
  • For custom REST API connection, ensure the REST API Endpoint URL is valid and accessible.
  • Check API keys, secrets, and passwords if authentication errors occur.
  • If the node throws parsing errors, verify the API responses are in the expected JSON format.

Links

Discussion