13.08.2022 Views

advanced-algorithmic-trading

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

196

Figure 13.2: Time-varying slope and intercept of a linear regression between ETFs TFT and IEI

to changes in the "true" unobserved hedge ratio between the two ETFs.

If this was to be put into production as a live trading strategy it would be necessary to

optimise the delta parameter across baskets of pairs of ETFs utilising cross-validation.

13.4 Next Steps

Now that we have been able to construct a dynamic hedging ratio between the two ETFs we

need a way to actually carry out a trading strategy based off of this information. A later chapter

makes use of QSTrader to perform a backtest on the pair of ETFs mentioned above.

13.5 Bibliographic Note

Utilising the Kalman Filter for "online linear regression" has been carried out by many quant

trading individuals. Ernie Chan utilises the technique in his book[32] to estimate the dynamic

linear regression coefficients between the two ETFs: EWA and EWC.

Aidan O’Mahony used Matplotlib and PyKalman to also estimate the regression coefficients

in his post[74], which inspired the diagrams for this chapter.

Jonathan Kinlay discusses the application of the Kalman Filter to simulated financial data[64]

and suggests that it might be advisable to use the KF to suppress trade signals generated in

periods of high noise, or to increase allocations to pairs where the noise is low.

An introductory discussion about the Kalman Filter, using the R programming language, can

be found in Cowpertwait and Metcalfe[35].

13.6 Full Code

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!