Starting from:

$30

Programming Futures Spread Dynamics Solved

1 Introduction
Here we will practice obtaining data for spreads in futures markets, and characterizing their dynamics.

2   Data
Obtain second month quarterly [1] futures prices from the Quandl OWF database for two pair W, X; Y, Z (where W, X and Y and Z depend on your student ID number) for 3 Dec 2019 though 31 Aug 2021. Our definition of second month is the contact where the number of days to futures expiration is the smallest available value greater than 30[2].

Form the spreads  between these numbers as the difference 

Xt − Wt and .

3   Analysis
Characterize the relative dynamics of  in reasonable ways, using charts and statistics.

For example, compute the median and standard deviation of the difference   between   and an N-day rolling average of st for some values of N.

Examine more quantiles than just the median. Look at tails. Do the spreads correlate? How about their difference (d) values? Do spreads exhibit patterns over time?

3.1  Data
Futures pairs W, X; Y, Z (in order) are as given by the last two distinct digits[3] of your student number as follows:

0.    ICE B B ICE G G 0.1342281879194631 (1/7.45)

1.     ICE B B ICE G G 0.1342281879194631 (1/7.45)

2.    ICE B B ICE T T

3.     ICE T T ICE G G 0.1342281879194631 (1/7.45)

4.    CBT FV FV CBT TU TU

5.    CBT FV FV CBT TY TY

6.    CBT FV FV CBT US US

7.    CBT TU TU CBTTY TY

8.    CBT TU TU CBT US US

9.    NYM RB  RB ICE G G 0.003198489678291494 (100 /118.35 / 264.172)

The final number, where present, is a multiplier you should apply to X or Z before computing the spreads s.

When downloading from Quandl, you have to use the years and the quarterly codes (H, M, U, Z) individually, there is no facility for Quandl to combine them itself.

Examples of st on various dates that you should be matching in your own data are as follows:

0.     ICE B B ICE G G

•    2021-02-08 6.606510

•    2021-02-09 6.719866

1.     ICE B B ICE T  T

•    2021-01-19 -2.54

•    2021-01-20 -2.86

2.     ICE  T T ICE G G

•    2021-01-19 8.966309

•    2021-01-20 9.279866

3.    CBT FV FV CBT TU TU

•    2021-02-18 -15.000000

•    2021-02-19 -14.496875

4.    CBT FV FV CBT TY TY

•    2021-02-18 10.382812 • 2021-02-19 9.375000

5.    CBT FV FV CBT US US

•    2021-02-18 39.023438

•    2021-02-19 36.593750

6.    CBT TU TU CBT  TY TY

•    2021-02-18 25.382812 • 2021-02-19 23.871875

7.    CBT TU TU CBT  US US

•    2021-02-18 54.023438 • 2021-02-19 51.090625

8.    NYM RB  RB ICE G G 0.003198489678291494 (100 /118.35 / 264.172)

•    2021-01-26 -0.124285

•    2021-01-27 -0.200692

More products