• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Calendar Spread Generator I wrote in R (open source!)

Joined
6/6/08
Messages
1,194
Points
58
Hey guys...WIP here that I put together on my downtime. (It's actually better than the one I wrote at my last gig).

Anyhow, what happens is this: it's currently written to work using the futures months notation (F, G, H, J, K, M, N, Q, U, V, X, Z) but it takes in a csv with the product name, traded months, how many front months you want (though it's written generally enough to roll any type of futures contract, though that functionality isn't implemented yet), and how many months ahead for each front month you want.

So it takes the input file, and generates the output file.

futuresRolling.csv is the input
futuresRolling.R is the code
futuresRollingResults.csv is the output

Hopefully someone gets some use out of it =)

Other than that, constructive criticism is always good.
 

Attachments

Back
Top