A Simpler Way to Calculate WorldQuant 101 Alphas

The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.

Take the calculation formula of Alpha#98 for example, and th…


This content originally appeared on DEV Community and was authored by DolphinDB

The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.

Take the calculation formula of Alpha#98 for example, and the data we use is the daily data from the New York Stock Exchange.

Kakushadze et al 2015 Alpha #98: 
(rank(decay_linear(correlation(vwap, sum(adv5, 26.4719), 4.58418), 7.18088)) -
rank(decay_linear(Ts_Rank(Ts_ArgMin(correlation(rank(open), rank(adv15), 20.8187), 8.62571), 6.95668), 8.07206)))

This formula involves both cross-sectional data and time series data, and the calculation uses nested functions with up to 6 levels, which is extremely difficult to implement in most systems.

Image description

We can significantly reduce the development cost of complex calculations such as Alpha#98 by using DolphinDB’s built-in functions with panel data (in matrix form).

Image description

Image description

Why is DolphinDB’s code so concise and elegant? 😲

On the one hand, using panel data provided by DolphinDB to implement the Alpha#98 factor simplifies the calculation logic and makes the code very precise. Panel data is a matrix that combines cross-sectional data and time-series data.

Image description

On the other hand, DolphinDB has more than 1,500 built-in functions and many of them are optimized. You can implement all 101 alphas with DolphinDB built-in functions.

Image description

Let’s take a look at DolphinDB script, which is very similar to the original formulas.

def alpha98Panel(vwap, open, vol){
    return tsRank(mavg(mcorr(vwap, msum(mavg(vol, 5), 26), 5), 1..7)) - tsRank(mavg(mrank(9 - mimin(mcorr(tsRank(open), 
    tsRank(mavg(vol, 15)), 21), 9), true, 7), 1..8))
}

Run the script, and it only takes 986ms to generate a matrix with 7,162 columns and 252 rows and calculate Alpha#98 with the matrix.

Image description

Furthermore, DolphinDB supports unified stream and batch processing. It provides the streamEngineParser function to automatically form a pipeline of stream engines to carry out the specified metrics calculation. You can directly use the Alpha#98 function as the metrics, with no need to modify the script for metrics calculation.

Click the demo below to get more info! 👇
https://youtu.be/B0lYBAI_FEc


This content originally appeared on DEV Community and was authored by DolphinDB


Print Share Comment Cite Upload Translate Updates
APA

DolphinDB | Sciencx (2024-08-21T02:31:10+00:00) A Simpler Way to Calculate WorldQuant 101 Alphas. Retrieved from https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/

MLA
" » A Simpler Way to Calculate WorldQuant 101 Alphas." DolphinDB | Sciencx - Wednesday August 21, 2024, https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/
HARVARD
DolphinDB | Sciencx Wednesday August 21, 2024 » A Simpler Way to Calculate WorldQuant 101 Alphas., viewed ,<https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/>
VANCOUVER
DolphinDB | Sciencx - » A Simpler Way to Calculate WorldQuant 101 Alphas. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/
CHICAGO
" » A Simpler Way to Calculate WorldQuant 101 Alphas." DolphinDB | Sciencx - Accessed . https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/
IEEE
" » A Simpler Way to Calculate WorldQuant 101 Alphas." DolphinDB | Sciencx [Online]. Available: https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/. [Accessed: ]
rf:citation
» A Simpler Way to Calculate WorldQuant 101 Alphas | DolphinDB | Sciencx | https://www.scien.cx/2024/08/21/a-simpler-way-to-calculate-worldquant-101-alphas/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.