473,416 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,416 developers and data experts.

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 the data we use is the daily data from the New York Stock Exchange.
Expand|Select|Wrap|Line Numbers
  1. Kakushadze et al 2015 Alpha #98: 
  2. (rank(decay_linear(correlation(vwap, sum(adv5, 26.4719), 4.58418), 7.18088)) -
  3. 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

calculation formula of Alpha#98

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

code of Python
⬇️

Image description

code of DolphinDB

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

DolphinDB panel data

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

DolphinDB built-in functions

Let’s take a look at DolphinDB script, which is very similar to the original formulas.
Expand|Select|Wrap|Line Numbers
  1. def alpha98Panel(vwap, open, vol){
  2.     return tsRank(mavg(mcorr(vwap, msum(mavg(vol, 5), 26), 5), 1..7)) - tsRank(mavg(mrank(9 - mimin(mcorr(tsRank(open), 
  3.     tsRank(mavg(vol, 15)), 21), 9), true, 7), 1..8))
  4. }
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

time cost in DolphinDB

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
Feb 20 '24 #1
0 14267

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: David | last post by:
I am learning plsql. I would like to run a stored procedure to calculate my bank account value by predicted 10% annual growth rate. Below is my plsql that is having problems. Your help is highly...
1
by: David | last post by:
Can someone help me with this. I need to calculate the week ending date of the first week of the year based upon a year provided by the user. Is there a simpler way other than writing my own...
2
by: not | last post by:
Hello All, I am trying to develop a relatively simple self-quiz form in javascript, but I'm having no luck getting it to work. What I am looking for is a script that allow the user to select...
5
by: SimonC | last post by:
Help needed for a Javascript beginner. As above in the subject... i need a javascript to run this, but not in the form of a web-page. I want to calculate it between 2 fields in a database that...
1
by: oncewaswillow | last post by:
Hi, I have 3 nested forms and want to calculate a total on the first subform (as the form loads)by adding 2 fields from that form + to a field on the second subform. Second subform is and...
6
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the...
36
by: phil-news-nospam | last post by:
Here is a simpler (no drop shadows) example of the padding bug I see: http://phil.ipal.org/usenet/ciwas/2006-05-08/buttons-1.html So far I find nothing in the CSS2 document that says I should...
3
by: chyaf | last post by:
Ok, am new in this and have an assignment. I've read all I had to read and have been searching through the net and still don't have an answer, it may be simpler than I think.... How can I calculate...
11
by: Thomas | last post by:
Hi, I'm pretty new to the programming world. I got stuck in the following problem. Please guide me about it. Well I'm trying to get the value of (128^100)^2 I've used long double type but to no...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.