Quantitative Modeling for Algorithmic Traders – Primer
Quantitative Modeling techniques enable traders to mathematically identify, what makes data “tick” – no pun intended 🙂 .
They rely heavily on the following core attributes of any sample data under study:
- Expectation – The mean or average value of the sample
- Variance – The observed spread of the sample
- Standard Deviation – The observed deviation from the sample’s mean
- Covariance – The linear association of two data samples
- Correlation – Solves the dimensionality problem in Covariance
Why a dedicated primer on Quantitative Modeling?
Understanding how to use the five core attributes listed above in practice, will enable you to:
- Construct diversified DARWIN portfolios using Darwinex’ proprietary Analytical Toolkit.
- Conduct mean-variance analysis for validating your DARWIN portfolio’s composition.
- Build a solid foundation for implementing more sophisticated quantitative modeling techniques.
- Potentially improve the robustness of trading strategies deployed across multiple assets.
Hence, a post dedicated to defining these core attributes, with practical examples in R (statistical computing language) should hopefully serve as good reference material to accompany existing and future posts.
- It facilitates the analysis of large price datasets in short periods of time.
- Calculations that would otherwise require multiple lines of code in other languages, can be done much faster as R has a mature base of libraries for many quantitative finance applications.
- It’s free to download here.
Before progressing any further, we need to download EUR/USD and GBP/USD sample data from Yahoo Finance (time period: January 01 to March 31, 2017)
In R, this can be achieved with the following code:
Note: “EUR=X” and “GBP=X” provided by Yahoo are in terms of US Dollars, i.e. the data represents USD/EUR and USD/GBP respectively. Hence, we will need to convert base currencies first.
To achieve this, we will first extract the Adjusted Close Price from each dataset, convert base currency and merge both into a new data frame for use later:
eurAdj = unclass(`EUR=X`$`EUR=X.Adjusted`)
# Convert to EUR/USD
eurAdj = 1/eurAdj
gbpAdj <- unclass(`GBP=X`$`GBP=X.Adjusted`)
# Convert to GBP/USD
gbpAdj <- 1/gbpAdj
# Extract EUR dates for plotting later.
eurDates = index(`EUR=X`)
# Create merged data frame.
eurgbp_merged <- data.frame(eurAdj,gbpAdj)
Finally, we merge the prices and dates to form one single dataframe, for use in the remainder of this post:
eurgbp_merged = data.frame(eurDates, eurgbp_merged)
colnames(eurgbp_merged) = c("Dates", "EURUSD", "GBPUSD")
In future blog posts, we will examine how to construct diversified DARWIN Portfolios using the information above in practice.
The Darwinex Team
Additional Resource: Learn more about DARWIN Portfolio Risk (VIDEO)
* please activate CC mode to view subtitles.
Do you have what it takes? – Join the Darwinex Trader Movement!