GetHistPricesCSV utility is a modified version of the standard QuotesManager API sample. It loads prices of any timeframe for any time period and saves them to a CSV file which can be opened in MS Excel. It's a Windows command line utility.
How to run GetHistPricesCSV utility:
1) Extract GetHistPricesCSV.zip archive to some folder. It contains GetHistPricesCSV folder inside.
2) Start command prompt. In Windows 7 you can type
cmd is Start menu and run the found program.
3) Change the current drive if required. For example, if the current drive is C:\ and GetHistPricesCSV was extracted to D:\ then type
D:3) Move to a folder where the archive was extracted to: type
cd <folderPath>, where <folderPath> is a full path to GetHistPricesCSV folder.
4) Run GetHistPricesCSV utility with required arguments.
GetHistPricesCSV utility takes the following arguments:
/login | --login | /l | -l
Your user name.
/password | --password | /p | -p
Your password.
/url | --url | /u | -u
The server URL. For example,
http://www.fxcorporate.com/Hosts.jsp.
/connection | --connection | /c | -c
The connection name. For example, "Demo" or "Real".
/sessionid | --sessionid
The database name. This argument is optional.
Required only for users who have accounts in more than one database.
/pin | --pin
Your pin code. This argument is optional. Required only for users who have a pin.
/instrument | --instrument | /i | -i
The instrument that you want to use in the sample. For example, "EUR/USD".
/timeframe | --timeframe
The time period that forms a single candle. For example, m1 - for 1 minute, H1 - for 1 hour.
Custom timeframes (e.g. m2) are also supported.
/datefrom | --datefrom
The date and time starting from which you want to receive historical prices. This argument is optional. If you leave this argument as is, a default value will be used. The format is "m.d.Y H:M:S". The time is in UTC timezone.
/dateto | --dateto
The date and time until which you want to receive historical prices. This argument is optional.
If you leave this argument as is, the data will be received up to now. The format is "m.d.Y H:M:S".
The time is in UTC timezone.
/count | --count
The number of historical prices you want to receive. This argument is optional.
If you leave this argument as is, a default value will be used or the argument will be ignored if 'datefrom' is specified.
/output | --output
The output file name.
Examples:
GetHistPricesCSV /login {LOGIN} /password {PASSWORD} /connection Demo /instrument EUR/USD /timeframe m1 /url
http://www.fxcorporate.com/Hosts.jsp /datefrom "06.27.2014 20:50:00" /dateto "06.29.2014 22:05:00" /output result.csv
Loads and saves to result.csv file m1 EUR/USD bars in a specified dates range.
GetHistPricesCSV /login {LOGIN} /password {PASSWORD} /connection Demo /instrument EUR/USD /timeframe H1 /url
http://www.fxcorporate.com/Hosts.jsp /count 1000 /dateto "06.29.2014 22:05:00" /output result.csv
Loads and saves to result.csv file 1000 H1 EUR/USD bars up to a specified time.
GetHistPricesCSV /login {LOGIN} /password {PASSWORD} /connection Demo /instrument EUR/USD /timeframe m2 /url
http://www.fxcorporate.com/Hosts.jsp /datefrom "06.27.2016 20:50:00" /output result.csv
Loads and saves to result.csv file m2 EUR/USD bars starting from a specified time up to now.
Additional notes:
1) Argument date/times and date/times in a resulting CSV file are in UTC timezone.
2) Prices are received using option Weekend data = Show. So a resulting CSV file contains Weekend bars.
3) Prices are received using option Price Gaps = Hide. So Open = Close of the previous bar.
4) It's not recommended to use it with ticks timeframe - QuotesManager does not support caching of ticks and receiving operation may take a very long time.
To built the utility from the sources you need to install the last versions of ForexConnect and PriceHistory APIs and to extract sources to cpp samples folder of PriceHistory API.