R Postgres client and settlement files parser
This project deals with CME settlement files parse and uploads parsed data to Postgres database.
Installation and database initialization is covered in my blog post http://mmquant.net/open-source-database-solution-for-daily-data-in-r/.
This parser is intended to be an educational project. Use of CME settlement files for any other purposes without CME permission is forbidden. If you want to use this project in real world application you have to use other source of daily prices or contact CME about your intentions. Note that in practice analysts have prices coming from multiple data vendors so they can cross-check their accuracy.
DBqueries directory contains sql statements for creating and populating foreign key tables. Data directory contains data files needed for running Parser object methods. Log directory hosts logfiles. CreateTables.R, populating.R, tables_Triggers.R scripts connects to the existing postgres database and execute sql queries from DBqueries directory. qGen.R generates input rows for symbol table.
In data directory there are CMC maps for every exchange which are used as guide for parser which symbols it downloads. Every CMC file consists of GLOBEX_symbol, Start_month, End_month, Start_day and End_day. You are free modify all of the columns except Start_day.
- Public methods:
# Constructor
p <- Parser$new()
# Accesors
p$get("attribute")
p$set("attribute")
# parse() downloads and parses CME settlement reports
p$parse()
# exportQuery() exports parsed data to postgres database
p$exportQuery()
- Gettable attributes:
attribute | description |
---|---|
logFile | Path to log file |
reportDatePath | Path to last report date log file |
contractsCalPath | Path to contract months calendar files |
pricesPath | Path to downloaded settlement reports |
productMapPath | Path to products map file |
completeSymbs | Returns complete symbols to be downloaded (after parse() call) |
reportDate | Returns date of parsed settlement report (after parse() call) |
queryRows | Returns sql query rows to be exported into the database (after parse() call) |
db | Returns database connection settings - dbname, host, port, password |
- Settable attributes:
attribute | description |
---|---|
logFile | Path to log file |
reportDatePath | Path to last report date log file |
db | Sets database connection settings - list(dbname, host, port, password) |
- Add different historical data sources
Petr Javorik http://mmquant.net maple@mmquant.net