MATH GR5360 MATHEMATICAL METHODS IN FINANCIAL PRICE ANALYSIS
Final Project
Note: All files and information related to the final project are located in the Final Project folder on Courseworks
Before you develop and test the trading strategy, you need to show some basic understanding of the market you will be trading.
Next, at the time series level, you need to run at least both of the statistical Random Walk tests we have studied in the class: Variance Ratio test and the Push-Response test to identify the inefficiencies in those time series. Two tests for both time series and you need to make inferences about the type of inefficiency (trend-following or mean-reversion) and its approximate location at time-scales of each of the time series.
Based on the EasyLanguage pseudo-code describing the basic trend-following system “Channel WithDDControl”, you need to program this system and apply it to two of the futures markets from the following set:
Number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Blp Ticker TD Ticker
BO BO
DX DX
HG HG
HO HO
JO JO
JY JY
S SY
SB SB
SF SF
TU TU
TY TY
W WC
SM SM
CO CO
Soybean oil
US dollar index
Description Data From
Jul-82
Jul-89
Copper Dec-89
Heating oil
FCOJ – Frozen concentrated orange juice
Japanese Yen
Jan-84
Jul-87
Mar-77
15 FC
16 DU
17 PL
18 XB
FC
BZ
PL
XB
Sugar #11
Swiss Franc
US Treasury note – 2-year
US Treasury note – 10-year
Wheat
Soybean meal
Brent crude oil
Feeder cattle
German Schatz – 2-year
Jul-86
Dec-74
Jan-91
Jan-83
Jul-82
Jul-82
Aug-03
Jan-78
Mar-97
Soybeans Jul-82
Platinum Oct-07
Gasoline (RBOB) Oct-06
19
BTC
XBT
Bitcoin Coinbase
Jan-15
One of the markets-primary is for you to choose, another-secondary market must be XBT (Bitcoin). Each student group will first need to pick one primary futures market from this set. It is mandatory that all student groups have different primary markets. The .asc data files containing the OHLC (opening high low close) bars with 5-minute resolution from inception until now are also in the Final Project folder, as denoted by their ticker symbols. Please, note that Bloomberg is using the Bloomberg
MATH GR5360 MATHEMATICAL METHODS IN FINANCIAL PRICE ANALYSIS
ticker convention, whereas the data files use the provider’s ticker convention of TickData (TD). Also for your reference and various contract parameter settings information uploaded are their Bloomberg descriptions (DES screens) and the latest daily OHLC bars chart (GPO screens). All of these markets should present you with trend-following properties to various degrees of strength. There is none and I have no preference as to which market you pick – it is up to your personal preferences and taste. After you polish your code results on the primary market, each group needs to apply everything developed to the secondary market XBT (Bitcoin), and repeat all the tested code on it. Secondary market is the same for different student groups. Please, note that you will not be judged on how much money your strategy makes or on how big is the value of your risk-adjusted return. Instead, you will be judged on how close your results are to the expected ones.
Also for your convenience, I have uploaded the “Medeleyev Table” of the futures markets that I was discussing during class (the file “TF Data.xls” as Excel or “FuturesContractsParameters.pdf” as pdf, although you may use the Bloomberg DES screens that I referred to earlier), which, among other things, contain: TickData Ticker (column B); Bloomberg Ticker (column C), Description (column D), local currency approximate contract value (column G), local currency Point Value (column H), etc. Some or all of these parameters you may need in your experimentation. The important parameter that you will absolutely need to use is slippage, denoted as “Slpg” in column V. This is the suggested full transaction cost to be used by you if you buy and then sell (or sell and then buy) one futures contract of your chosen market. Every time you do one round-turn transaction like that you will need to subtract that value from the current $P&L (USD Profit and Loss or equity).
Each group will select one market, and should email me and TA their choice as soon as possible. In the event should two groups choose the same market, the group who sent us the email first will “secure” that market to themselves. All parameters such as tick size, trading hours, and point value should be taken from the Description screens or TF Data file and double-checked with us, if in doubt. Please pay attention to the fact that the timestamps in the data files are expressed in the local (exchange) time, i.e., the CME in Chicago is one hour behind us here in New York City.
Also, pay attention to the fact that there may be a factor of 100 (or 1/100) difference in the price in the file and the price on Bloomberg: the TF Data futures contracts parameters file will help you with this – see the magenta colored lines.
You will need to first use the in-sample length of 4 years (re-calculate it into the approximate number of
5-min bars to use in each case). I would like you to use the net profit to max drawdown ratio as the
target function for parameter optimization. I would like to propose that you use the following ranges of
parameters (you can adjust those if you have a more or less powerful computer, for example):
ChnLen = 500, 10000, 10 (start at, end at, step with, in 5-mins intervals, 951 in total); and
StpPct = 0.005, 0.10, 0.001 (96 in total).
This corresponds to grid points in each two-parameter optimization. This
optimization can be solved by a direct and full look-through in search for a single maximum (if you can
propose and implement alternative search procedures in addition to full search – it will be rewarded
while grading). As the number of parameters is small (only two) and the sample space is relatively small
(on the order of ), this should be doable on virtually any modern computer. In this experiment, you
MATH GR5360 MATHEMATICAL METHODS IN FINANCIAL PRICE ANALYSIS
always have to choose the formally best parameters point. Repeat the optimization procedure by moving
your in-sample period from the very end (or start) of your full data sample every quarter (3-months)
forward, which you can do approximately, by counting the same number of 5-mins in a quarter, for
example. Once you found the optimal parameters for the previous 4 years, use them for the immediately
adjacent subsequent quarter (3 months) out-of-sample. Record the strategy equity changes and trade-by-
trade table only for the out-of-sample period. Repeat this process iteratively for all remaining quarters,
thus producing a fully out-of-sample equity curve and trade-by-trade table. Measure various statistical
performance properties of both equity curve and trade-by-trade table: Average Rate of Return, Standard
Deviation of Returns, and the Ratio of the two above (known as the Sharpe or Information Ratio), Total
Number of Trades, % of Winners or % of Profitable Trades, Return on the Account (Net Profit to Worst
Drawdown), Average Winner, Average Loser, Profit Factor, etc. along with all other characteristics that
you will deem useful to gaining insight into the behavior of your market. The quantity and choices of the
performance characteristics will make a difference on the grade for your Final Project.
Please, do not forget to keep/save a table with the optimal parameters for each quarter. After you are
done with the above experiment you can also solve the in-sample optimization with the whole period
being the in-sample length. And calculate its performance characteristics similar to the ones you used above. After you are done, you can compare those to the ones for the out-of-sample experiment and
deduce the decay coefficients for various performance measures to estimate the difference or decay of
the out-of-sample vs. the in-sample performance for the performance measures you chose.
Variations of the above for the benefit of better results or more interesting outcomes are welcome as
well. If you have any questions, please ask!
Finally, once the code is polished, you need to repeat the above procedure for various choices of the in-
sample time T (=1,2,3,…,10 years if possible) and out-of-sample time τ (=1,2,3,4 quarters or even
=1,2,3…,12 months).
You will be expected to write all your details in the PowerPoint presentation and present your work (using one or several presenters) during 30 mins allocated for that time for each group.
Do not hesitate to ask any question of me or the TA, as well as much of this will be covered during the class.
Good luck!
You will be given 3 weeks to complete the Final Project and to prepare the presentations. Final presentations will be during the class time on May 3rd, 2019.