(see other branches for development versions)
A little command-line app to download historical data from investing.com in CSV format.
git clone [email protected]:derlin/investing-historical-data.git
cd investing-historical-data
npm install
To run the script, use one of the following:
npm start -- <args>
node investing.js <args>
Commands:
get [name|id] get historical data
list list all available commodities
help [cmd] display help for [cmd]
Options:
-h, --help output usage information
-V, --version output the version number
Get the list of available commodities.
Options:
-h, --help output usage information
-V, --version output the version number
-c --country [UK|US] list only commodities from the given country
-r --regex [search] find commodities with names matching regex. Example: ca, d, "[cad]a"
Download historical data from investing.com. By default, the result is printed to the console. Use -f
if you want the csv te be saved directly into a file.
Options:
-h, --help output usage information
-V, --version output the version number
-i --id [id] id of the commodity to fetch
-s --startdate [date] start date in MM/dd/yyyy format.
-e --enddate [date] end date in MM/dd/yyyy format.
-f --file [file] result file. If none, the result will be printed to the console.
-v --verbose enable verbose mode.
The program supports commodities from US and UK. If you need a commodity which is not listed by list
, you can try to find its id in the investing.com page.
For example, to find the id corresponding to gold:
- go to http://www.investing.com/commodities/gold;
- open the developer console of your navigator;
- in the html source file, search the string
pair_id
, for example:<div pair_id="8830">...</div>
.
Here you go ! 8830 is the gold commodity id. You can not run investing.js get -i 8830
.
Usually, commodities ids are between 8800-8999 or 950000-961999.