29 API Reference

By the WebSimTeam

This chapter can be used as a handy reference guide to all operators and data fields that can be used for building alphas.


The available market data fields given in Table 29.1 can be used in your alpha expression.

Table 29.1 Price volume data for equity

Data name Description Python usage
Open Daily open price dr.GetData("open")
Close Daily close price dr.GetData("close")
High Daily high price dr.GetData("high")
Low Daily low price dr.GetData("low")
Vwap Daily volume weighted price dr.GetData("vwap")
Volume Daily volume dr.GetData("volume")
Returns Daily returns dr.GetData("returns")
adv20 Average daily volume in past 20 days dr.GetData("adv20")
sharesout Daily outstanding shares dr.GetData("sharesout")

Open, high, low, close, volume, vwap, and sharesout represent data that has been carefully adjusted for corporate actions (such as dividend, split, reverse split, etc.) and ready to be used for alpha computation. As a comparison, raw price or volume is actually not ready for direct usage in alpha code; without this distinction, alpha will be unstable.

This can be explained in an example: suppose GOOG (Google) will split 2:1 on April 2 and its current price is at $1,200.

On April 3, it would likely be around $600. Without adjusting, raw price alone will distort the price action.

Adjusted data must be updated every day. For efficiency, WebSim™ calculates only for a fixed look-back period. ...

Get Finding Alphas: A Quantitative Approach to Building Trading Strategies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.