====== Fetch Historical Data ====== This page explains how to download historical data with ''fetch.js''. ===== Basic commands ===== * Fetch a single data set node ./bin/fetch.js --server Premium --symbol EURUSD --period M30 * Fetch multiple symbols and periods node ./bin/fetch.js --server Premium --symbols EURUSD GBPUSD --periods M15 M30 H1 ===== Server and supported periods ===== Allowed server values: * Premium * Dukascopy * MetaQuotes * Darwinex * Eightcap * BlackBull Allowed period values: * M1 * M5 * M15 * M30 * H1 * H4 * D1 ===== Time zone and data length ===== ==== Set time zone ==== Use ''time_zone'' (or ''--time-zone'') to set hour offset relative to UTC. Fetcher applies this value as a timestamp shift before saving the downloaded dataset. node ./bin/fetch.js --symbol EURUSD --period H1 --time-zone -4 ==== Limit bars ==== Use ''max_data_bars'' (or ''--max-data-bars'') to cut downloaded history. node ./bin/fetch.js --symbol EURUSD --period M15 --max-data-bars 100000 Set to 0 to keep all available bars. ===== Smart refresh for automation ===== Use ''if_missing_or_older_than'' to avoid frequent downloads. This rule applies to historical data files only. node ./bin/fetch.js --symbols EURUSD GBPUSD --period M15 --if-missing-or-older-than 60 Meaning: * Downloads if file is missing. * Downloads if file was not updated in the last N minutes. * Value 0 disables this behavior. ===== Silent mode ===== Use silent mode for background scripts: node ./bin/fetch.js --symbol EURUSD --period M30 --silent true Errors are still printed. ===== Example INI profile ===== server = Premium symbol = EURUSD GBPUSD period = M15 M30 time_zone = 0 max_data_bars = 0 if_missing_or_older_than = 60 silent = false ===== Checklist ===== * Symbol info exists for the selected server (''./res/.json''). * Symbols are valid for that server. * Periods are one or more of: M1 M5 M15 M30 H1 H4 D1. * Time zone and bar limits are set as intended. * Console shows "Data fetch ready!" when completed. ===== Related page ===== * [[fetch-js|Fetcher (fetch.js)]]