473,606 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Simpler Way to Calculate WorldQuant 101 Alphas

2 New Member
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 streamEnginePar ser 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 14349

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

Similar topics

11
7779
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 appreciated. Thanks declare money number := 50000.00; year number := 1;
1
13122
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 UDF?
2
1453
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 one of three answers for each question, and automatically assign a value to their answer ("never"=0, "sometimes"=1, "always"=2). There would be anywhere from ten to thirty questions. I want the script to calculate the running total, and then...
5
6723
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 i have extracted into a report writer. Look forward to hearing.. Cheers... SimonC
1
1765
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 control is Sumpd. I use this =.Form!Sumpd++ which works well as long as the transactiontbl subform has records in
6
4129
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 end is found is less efficient than using sizeof operator , since size of the array is completely determined at compile time. i don't quite understand this. Could anyone explain to me in detail ?
36
3010
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 get this kind of inconsistent result. -- ----------------------------------------------------------------------------- | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
3
2233
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 tax? The idea is I'm creating a program that will calculate tax to an item. So far we've seen the basic arithmetic operands and I'm not sure if I just write 6% of item cost... If anyone can guide me I'd really appreciate it. Thanks!
11
8875
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 avail. I even can't get the value of 2^128. How this problem can be solved? Similarly, I was trying to develoop a program in hich we can calculate
0
8016
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8440
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8306
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6773
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5966
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2448
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1557
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1300
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.