Skip to content
R Postgres client and settlement files parser
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.Rproj.user
DBqueries
data
log
.gitignore
CME_data.Rproj
Parser.R
README.md
createTables.R
parserScript.R
populating.R
qGen.R
tables_triggers.R
twodigityears.R

README.md

CME_Parser

R Postgres client and settlement files parser

Synopsis

This project deals with CME settlement files parse and uploads parsed data to Postgres database.

Installation

Installation and database initialization is covered in my blog post http://mmquant.net/open-source-database-solution-for-daily-data-in-r/.

Notice

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.

Project structure overview

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.

Contract months calendar maps (CMC)

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.

Parser R6 Class overview and examples

  • 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)

Possible upgrades

  • Add different historical data sources

Contributors

Petr Javorik http://mmquant.net maple@mmquant.net

You can’t perform that action at this time.