[R-SIG-Finance] Generating a front month only Time Series

Edouard Tallent tallent_e at lycos.com
Fri May 4 13:14:16 CEST 2012


i wish there was a finite answer to this question. :-)

as regards automating the wheat-corn spread, you've to fully realize that these are agricultural commodities.
crop calendars are different, both cultivations respond differently to weather conditions, US wheat prices move with international commercial activity, ethanol market is a main driver of US corn prices, and so on ... and forces in actions are likely to vary from one year to the next.
i'm not saying i know much more than you do. no way. just a kind warning if you come from equities or forex.

good luck in your endeavors.

best
édouard

http://quantcorner.wordpress.com

===================

Message: 10
Date: Thu, 3 May 2012 13:07:11 -0700 (PDT)
From: gussinsky <sduve at hotmail.com>
To: r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] Generating a front month only Time Series
for	Futures Prices
Message-ID: <1336075631561-4606979.post at n4.nabble.com>
Content-Type: text/plain; charset=us-ascii

Hey Garrett, 

thank you for this, I had a read through this page in the book you
referenced. And looking at Agricultural Commodities this makes a lot of
sense. And if you look at Wheat and Corn on the CBOT, I think you only have
5 deliveries per year, hence the massive gaps when each contract rolls off.
So here the interpolation makes sense, and I think one could approach this
trade as a box.

But lets consider for example heating oil again, here you have monthly
deliveries, and the seasonality is far less nowadays, in Europe even less
due to the increased Diesel consumption on the roads. 

But lets consider this:

"Trading in a current month shall cease on the last business day of the
month preceding the delivery month."

This is the expiry rule for Heating Oil on the Nymex. I think this is
codeable without minefields isn't it. It would be terrific if anyone could
point me in the right direction on how to approach this.

I think it wont be possible to download this with one simple function. I
suspect one would have to store individual files for the respective expiry
contracts, and perhaps index the file names. And then perhaps through a loop
function could read out the corresponding 1:n values for each month, store
them in an array, and then run the next month with the same rule, and store
them again, etc....In the end one needs to connect all those arrays into one
big time series.

And here is my problem, I dont know how to code this, I know what I want....

Many thanks for the advice so far....


Best


Gussinsky


PS: Garrett, it is your Pair Trading code that brought this up my mind again
:-)



More information about the R-SIG-Finance mailing list