import numpy as np
import pandas as pd
SEED = 2026
N_STOCKS = 4000 # stocks in the market
RISK_FREE = 0.0036 # r_f, the return on cash, a month
MARKET_MEAN, MARKET_SD = 0.006, 0.045 # M, the shared market return above cash: average, sd
VALUE_MEAN, VALUE_SD = 0.003, 0.030 # V, the shared value return: average, sd
STOCK_SD = 0.08 # sd of each stock's own random part
ROE_MEAN, ROE_SD = 0.12, 0.08 # return on equity in a fiscal year: average, sd
# The 750 month-ends from July 1963 to December 2025; BMonthEnd() picks each month's last weekday
month_ends = pd.date_range("1963-07-01", "2025-12-31", freq=pd.offsets.BMonthEnd())
# Tickers S0001 to S4000: the numbers 1 to 4,000 as text, filled with zeros to four digits
tickers = "S" + pd.Series(range(1, N_STOCKS + 1)).astype(str).str.zfill(4)
# default_rng(SEED) starts the random number generator, so every run draws the same numbers;
# rng.uniform(a, b, n) draws n numbers equally likely anywhere between a and b, and
# rng.standard_normal(n) draws n normal numbers with an average of 0 and a standard deviation of 1
rng = np.random.default_rng(SEED)
beta = rng.uniform(0.7, 1.3, N_STOCKS) # each stock's market beta
cap = 500 * np.exp(1.5 * rng.standard_normal(N_STOCKS)) # market caps, $ millions
book = cap * np.exp(np.log(0.7) + 0.7 * rng.standard_normal(N_STOCKS)) # book equity
published_book = book.copy() # the book equity of each stock's latest published report
# Each month adds a small table of prices to price_tables, and each March a table of reports
# to report_tables. The first reports, for the fiscal year that ended in December 1962, were
# published at the end of March 1963
price_tables = []
report_tables = [pd.DataFrame({"ticker": tickers, "fiscal_year_end": pd.Timestamp("1962-12-31"),
"published": pd.Timestamp("1963-03-29"), "book_equity": book})]
for date in month_ends:
# The value loading h uses the book-to-market at the previous month-end, from the book
# equity published by then; rank(pct=True) gives each stock its percentile
percentile = pd.Series(published_book / cap).rank(pct=True).to_numpy()
loading = (percentile - 0.5) / 0.7
market = MARKET_MEAN + MARKET_SD * rng.standard_normal() # M, the same for every stock
value = VALUE_MEAN + VALUE_SD * rng.standard_normal() # V, the same for every stock
stock_returns = (RISK_FREE + beta * market + loading * value
+ STOCK_SD * rng.standard_normal(N_STOCKS))
cap = cap * (1 + stock_returns)
price_tables.append(pd.DataFrame({"date": date, "ticker": tickers,
"return": stock_returns, "market_cap": cap}))
if date.month == 12:
# The fiscal year ends: book equity grows by the year's return on equity
book = book * (1 + ROE_MEAN + ROE_SD * rng.standard_normal(N_STOCKS))
if date.month == 3:
# The report on the year that ended in December is published at the end of March
published_book = book.copy()
report_tables.append(pd.DataFrame({"ticker": tickers,
"fiscal_year_end": pd.Timestamp(date.year - 1, 12, 31),
"published": date, "book_equity": book}))
# concat stacks the small tables into one, and ignore_index numbers its rows from 0
prices = pd.concat(price_tables, ignore_index=True)
reports = pd.concat(report_tables, ignore_index=True)Testing a stock characteristic as a factor in Python
Part 2 of 3 in a series on stock characteristics and factors: 1. Portfolio sorts and Fama-MacBeth regressions in Python, 2. Testing a stock characteristic as a factor in Python, 3. Factor investing in Python: value and momentum, step by step.
Part 1 sorted stocks into groups to measure whether a characteristic predicts next month’s return. A characteristic that predicts returns is not yet a factor. Here, a characteristic is a number for each stock, such as its book-to-market, and a factor is a return, one number a month, that many stocks move with and that explains differences in their average returns. The return to test is that of the stocks that score high on the characteristic minus that of the stocks that score low. I test whether a characteristic is indeed a factor, so that Part 3 can invest in it.
I pretend not to know whether value predicts returns and test value in five steps on a simulated market in which value is a factor by design. Value stocks, with a high ratio of book equity to market cap, earn 0.34% a month more on average than growth stocks, with a low ratio.
The animation shows the steps of the test on the simulated stocks.
Simulating the market
In this simulation, the higher a stock scores on value, the higher its expected return. The simulated data includes two tables a data vendor delivers for 4,000 stocks from July 1963 to December 2025: monthly prices and annual reports with publication dates.
Some numbers are my own choices, such as the 4,000 stocks, and I set the market and value returns close to Fama and French’s US factors since 1963. In month \(t+1\), stock \(i\)’s return is
\[r_{i,t+1} = r_f + \beta_i M_{t+1} + h_{i,t} V_{t+1} + 0.08\,\varepsilon_{i,t+1},\]
where \(r_f = 0.36\%\) a month is the risk-free interest rate, \(M_{t+1}\) is the market return above the risk-free interest rate and \(V_{t+1}\) is the value return. Both are the same for every stock and average 0.6% and 0.3% a month, with standard deviations of 4.5% and 3%. So the market term is the CAPM part of the return, and the value term comes on top of it. The last term is the stock’s own noise, with a standard deviation of 8% a month, and each stock’s beta \(\beta_i\) is drawn once, between 0.7 and 1.3. The value loading is
\[h_{i,t} = \frac{p_{i,t} - 0.5}{0.7},\]
where \(p_{i,t}\) is the stock’s book-to-market percentile at the end of month \(t\), from the latest published book equity. So the higher a stock scores on value, the higher its loading, and the more of the value return it earns.
A stock’s market cap grows with its return, because the firms pay no dividends. Every December, book equity grows by about 12% on average, with some random variation, and the annual report comes out at the end of the following March.
# to_string(index=False) prints a table without its row numbers
print(prices.head(3).round({"return": 4, "market_cap": 1}).to_string(index=False))
print()
print(reports.head(3).round({"book_equity": 1}).to_string(index=False)) date ticker return market_cap
1963-07-31 S0001 0.105 22151.3
1963-07-31 S0002 0.098 3327.3
1963-07-31 S0003 -0.056 6102.0
ticker fiscal_year_end published book_equity
S0001 1962-12-31 1963-03-29 4656.5
S0002 1962-12-31 1963-03-29 2480.3
S0003 1962-12-31 1963-03-29 5585.2
Step 1. Stating the idea
I need an intuition, an economic reason, why the characteristic I am interested in should be associated with future returns. Even if it passes all the tests in the next steps, it may still be data mining or chance, pure noise in the sample period, and then fail out of sample. So there must be a reason why I believe the characteristic is a factor.
For value, the idea is that value stocks with a high book-to-market earn more than growth stocks with a low one, consistent with the literature. This may reflect a risk premium or mispricing.
Before looking at any return, I fix the test. Each month, I sort the stocks into five groups by book-to-market and compare the next month’s average return of group 5, the value stocks, with that of group 1, the growth stocks.
Step 2. Measuring the value spread
In Step 2, I measure the difference between the stocks that score high on the characteristic and those that score low. A stock’s book-to-market at the end of month \(t\) is
\[\text{B/M}_{i,t} = \frac{B_{i,t}}{C_{i,t}},\]
where \(B_{i,t}\) is the book equity in the latest report published by then and \(C_{i,t}\) is the market cap. Each month, I sort the stocks into five groups at the 20th, 40th, 60th and 80th percentiles of book-to-market, and a group’s return in month \(t+1\) is the average return of its stocks, as in Part 1.
\[R_{g,t+1} = \frac{1}{N_{g,t}} \sum_{i \in G_{g,t}} r_{i,t+1},\]
where \(R_{g,t+1}\) is group \(g\)’s return in month \(t+1\) and \(G_{g,t}\) is the set of the \(N_{g,t}\) stocks in group \(g\).
I examine whether future returns increase from group 1 to group 5, the highest-scoring stocks. The value spread is group 5’s return minus group 1’s return, \(S_{t+1} = R_{5,t+1} - R_{1,t+1}\).
\[t = \frac{\bar S}{s/\sqrt{T}},\]
where \(t\) is the value spread’s t-statistic, \(\bar S\) the average value spread over the \(T\) months, \(s\) its standard deviation, and \(s/\sqrt{T}\) the standard error of the average when months are independent.
# duplicated marks each row whose date and ticker already appeared in an earlier row
if prices.duplicated(["date", "ticker"]).any():
raise ValueError("a ticker appears twice on one month-end")
# merge_asof gives each row the book equity of the ticker's last report published on or before
# the row's date, and needs both tables sorted by date
panel = pd.merge_asof(prices.sort_values("date"),
reports[["ticker", "published", "book_equity"]].sort_values("published"),
left_on="date", right_on="published", by="ticker")
panel["book_to_market"] = panel["book_equity"] / panel["market_cap"]
panel = panel.sort_values(["ticker", "date"])
# to_period("M") turns each date into its month, and shift(-1) takes each ticker's next row
panel["month"] = panel["date"].dt.to_period("M")
panel["next_month"] = panel.groupby("ticker")["month"].shift(-1)
panel["next_return"] = panel.groupby("ticker")["return"].shift(-1)
# The last month-end has no next month, so it is left out on purpose. Any other row whose next
# row is not the next month, or has no return, stops the calculation
panel = panel.loc[panel["date"] < panel["date"].max()]
if (panel["next_month"] != panel["month"] + 1).any() or panel["next_return"].isna().any():
raise ValueError("a stock has no next-month return")
# transform runs qcut within each month-end: qcut cuts book-to-market at its 20th, 40th, 60th
# and 80th percentiles and labels the groups 0 to 4, so adding 1 gives groups 1 to 5
panel["group"] = panel.groupby("date")["book_to_market"].transform(pd.qcut, 5, labels=False) + 1
# Each group's average next-month return; unstack turns the five groups into columns
group_returns = panel.groupby(["date", "group"])["next_return"].mean().unstack("group")
value_spread = group_returns[5] - group_returns[1] # S: value minus growth
months_used = len(value_spread) # T
standard_error = value_spread.std() / np.sqrt(months_used)
print("Average next-month return by book-to-market group, % a month:")
print((group_returns.mean() * 100).round(2).to_string())
print(f"\nValue spread: average {value_spread.mean() * 100:.2f}% a month, standard deviation "
f"{value_spread.std() * 100:.2f}%, {months_used} months")
print(f"Standard error {standard_error * 100:.3f}%, t-statistic "
f"{value_spread.mean() / standard_error:.2f}")Average next-month return by book-to-market group, % a month:
group
1 0.80
2 0.89
3 0.95
4 1.08
5 1.15
Value spread: average 0.34% a month, standard deviation 3.58%, 749 months
Standard error 0.131%, t-statistic 2.63
Average next-month return increases from group 1, the growth stocks, to group 5, the value stocks. The value spread averages 0.34% a month over 749 months, with a t-statistic of 2.63, so value stocks earned more than growth stocks. The value spread is one return a month, the candidate factor that Steps 3 and 4 test.
Step 3. Testing against the existing factors
Step 3 asks whether the existing factors explain the value spread. To keep it simple, I pretend that the Fama and French factors do not exist, so the only existing factor is the market in the CAPM. I regress the monthly value spread on the market’s return above the risk-free interest rate:
\[S_t = \alpha + b\,\text{MKT}_t + e_t,\]
where \(\alpha\) is the value spread’s alpha, \(b\) is its market beta, \(\text{MKT}_t\) is the equal-weighted average return of all the stocks minus the risk-free interest rate, and \(e_t\) the unexplained part. The beta measures how strongly the value spread moves with the market. The alpha is the average return that is left after the market.
In a realistic setting, I may need to include more factors than the CAPM, such as the five factors of Fama and French, to show that the accepted factors alone cannot explain the characteristic.
import statsmodels.api as sm
# MKT: the average return of all the stocks above cash, in each month
market = (panel.groupby("date")["next_return"].mean() - RISK_FREE).rename("market")
# add_constant adds a column of ones, whose coefficient is the intercept, the alpha, and
# cov_type="HAC" gives Newey-West standard errors, which allow for returns related over
# up to 6 months
value_spread_on_market = sm.OLS(value_spread, sm.add_constant(market)).fit(
cov_type="HAC", cov_kwds={"maxlags": 6})
print(f"Value spread against the market: alpha "
f"{value_spread_on_market.params['const'] * 100:.2f}% a month, t-statistic "
f"{value_spread_on_market.tvalues['const']:.2f}")Value spread against the market: alpha 0.39% a month, t-statistic 2.88
The alpha is 0.39% a month, with a t-statistic of 2.88, so the market does not explain the value spread.
Step 4. Testing the value spread as a factor
Step 4 tests whether the value spread works as a factor. I split the stocks at random into two halves, A and B. From half A, I take the variable I test as a factor, its value spread, and its market return. From half B, I take the stocks to explain, its five book-to-market groups. Because the split is random, the stocks in half B are not part of the value spread from half A.
I explain groups instead of single stocks, because the noise of single stocks largely averages out in a group, so a group’s alpha and loading are measured more precisely.
So I regress each of half B’s groups on half A’s market return alone, as in Step 3, and again with half A’s value spread added, to see whether the groups are associated with the variable from half A:
\[R^B_{g,t} - r_f = \alpha_g + b_g\,\text{MKT}^A_t + h_g\,S^A_t + e_{g,t},\]
where \(h_g\) is the group’s loading on half A’s value spread, how much the group moves with it each month.
If value is a factor, two things hold. First, the groups move with the value spread, both statistically and economically, with loadings that increase from group 1 to group 5. Second, the loadings explain the groups’ average returns, so the alphas become small and not statistically different from zero.
# Each stock joins half A with a chance of 0.5, and half B otherwise. The split has a random
# number generator of its own, with another seed, so its draws are unrelated to the simulation's
split_rng = np.random.default_rng(SEED + 1)
in_half_a = split_rng.uniform(size=N_STOCKS) < 0.5 # True for each stock drawn into half A
tickers_a = tickers[in_half_a]
# isin marks the rows whose ticker is in half A, and ~ swaps True and False
half_a = panel.loc[panel["ticker"].isin(tickers_a)].copy()
half_b = panel.loc[~panel["ticker"].isin(tickers_a)].copy()
# Each half sorts its own stocks into five groups, as in Step 2
half_a["group"] = half_a.groupby("date")["book_to_market"].transform(pd.qcut, 5, labels=False) + 1
half_b["group"] = half_b.groupby("date")["book_to_market"].transform(pd.qcut, 5, labels=False) + 1
groups_a = half_a.groupby(["date", "group"])["next_return"].mean().unstack("group")
groups_b = half_b.groupby(["date", "group"])["next_return"].mean().unstack("group")
# Half A's two factors: its market return above cash and its value spread
factors_a = pd.DataFrame({"market": half_a.groupby("date")["next_return"].mean() - RISK_FREE,
"value spread": groups_a[5] - groups_a[1]})
# Each of half B's groups, regressed on half A's market return alone, then with half A's value
# spread added; rsquared is the share of the variation in the group's monthly returns that a
# regression explains
market_rows = []
value_spread_rows = []
for group in range(1, 6):
return_above_cash = groups_b[group] - RISK_FREE
market_only = sm.OLS(return_above_cash, sm.add_constant(factors_a["market"])).fit(
cov_type="HAC", cov_kwds={"maxlags": 6})
with_value_spread = sm.OLS(return_above_cash, sm.add_constant(factors_a)).fit(
cov_type="HAC", cov_kwds={"maxlags": 6})
# t(alpha) is the alpha's t-statistic; se, its standard error, is for the chart
market_rows.append({"alpha": market_only.params["const"] * 100,
"t(alpha)": market_only.tvalues["const"],
"R-squared": market_only.rsquared,
"se": market_only.bse["const"] * 100})
value_spread_rows.append({"alpha": with_value_spread.params["const"] * 100,
"t(alpha)": with_value_spread.tvalues["const"],
"loading h": with_value_spread.params["value spread"],
"R-squared": with_value_spread.rsquared,
"se": with_value_spread.bse["const"] * 100})
# One table per regression, with one row per group of half B
group_names = ["group 1, growth", "group 2", "group 3", "group 4", "group 5, value"]
market_table = pd.DataFrame(market_rows, index=group_names)
value_spread_table = pd.DataFrame(value_spread_rows, index=group_names)
# drop leaves se out of the printed tables, and replace writes -0.00, a small negative number
# rounded to zero, as 0.00
print("Regression on half A's market return alone (alpha in % a month)")
print(market_table.drop(columns="se").round(2).replace(-0.0, 0.0).to_string())
print("\nRegression on half A's market return and value spread (alpha in % a month)")
print(value_spread_table.drop(columns="se").round(2).replace(-0.0, 0.0).to_string())Regression on half A's market return alone (alpha in % a month)
alpha t(alpha) R-squared
group 1, growth -0.20 -2.86 0.86
group 2 -0.08 -2.20 0.95
group 3 -0.02 -1.32 0.99
group 4 0.10 2.60 0.95
group 5, value 0.19 2.70 0.84
Regression on half A's market return and value spread (alpha in % a month)
alpha t(alpha) loading h R-squared
group 1, growth -0.01 -0.41 -0.50 0.99
group 2 0.02 0.94 -0.25 0.99
group 3 -0.02 -1.31 0.00 0.99
group 4 0.00 -0.06 0.25 0.99
group 5, value -0.01 -0.40 0.50 0.99
The loadings increase from −0.50 for group 1 to 0.50 for group 5, and for group 5, \(R^2\) increases from 0.84 to 0.99 once half A’s value spread is added. The chart compares the alphas, with a 95% confidence interval as a gray line.
import matplotlib.pyplot as plt
RED, TEAL, GREY = "#C0392B", "#17868A", "#888888"
# The site's chart colors: a cream background, dark text, a light grid and a pale frame, so every
# chart on the site has the same look
BG, INK, GRID, SPINE, AXIS_TEXT = "#FCEFE3", "#1f1f1f", "#EADCCC", "#D5C6B4", "#4a4a4a"
# figsize is the figure's width and height in inches
fig, axis = plt.subplots(figsize=(7.6, 4.4))
positions = np.arange(1, 6) # one position per group, 1 to 5
# Teal bars, left of each group: the alphas against the market alone. width is each bar's
# width, and label is its legend text
axis.bar(positions - 0.19, market_table["alpha"], width=0.38, color=TEAL,
label="against the market")
# errorbar draws each 95% confidence interval, the alpha plus or minus 1.96 standard errors;
# fmt="none" draws the lines without markers, and lw is the line width
axis.errorbar(positions - 0.19, market_table["alpha"], yerr=1.96 * market_table["se"],
fmt="none", ecolor=GREY, lw=1.2)
# Red bars, right of each group: the alphas with half A's value spread added
axis.bar(positions + 0.19, value_spread_table["alpha"], width=0.38, color=RED,
label="against the market and the value spread")
axis.errorbar(positions + 0.19, value_spread_table["alpha"], yerr=1.96 * value_spread_table["se"],
fmt="none", ecolor=GREY, lw=1.2)
axis.axhline(0, color=SPINE, lw=1) # the zero line
axis.set_xticks(positions, ["group 1\ngrowth", "group 2", "group 3", "group 4", "group 5\nvalue"])
axis.set_ylabel("alpha, % a month", color=AXIS_TEXT)
axis.set_title("Half B's alphas, before and after adding half A's value spread", color=INK)
# frameon=False draws no box around the legend, and labelcolor="linecolor" writes each entry
# in the color of its bars
axis.legend(frameon=False, loc="upper left", labelcolor="linecolor")
# The site's look: a cream background, a light grid behind the bars, a pale frame on the left
# and bottom only, and no tick marks
fig.patch.set_facecolor(BG)
axis.set_facecolor(BG)
axis.grid(True, axis="y", color=GRID, lw=1.0)
axis.set_axisbelow(True)
axis.spines[["top", "right"]].set_visible(False)
axis.spines[["left", "bottom"]].set_color(SPINE)
axis.tick_params(axis="both", length=0, colors=INK, pad=6)
plt.tight_layout() # fits the labels inside the figure
# dpi sets the saved image's pixels per inch, and bbox_inches="tight" trims the empty margin
plt.savefig("tf_alphas.png", dpi=140, bbox_inches="tight", facecolor=BG)
plt.show()
Against the market alone, the teal alphas increase from −0.20% a month for group 1 to 0.19% for group 5, with t-statistics of −2.86 and 2.70. With half A’s value spread added, the red alphas are all between −0.02% and 0.02%, and every interval contains zero. So half B’s groups are associated with the value spread from half A, and it explains why half B’s value stocks earn more.
With real data, the test uses more groups. Fama and French explain 25 groups of US stocks, sorted on size and book-to-market, with three factors. Besides the market, SMB is the return of small stocks minus big stocks, and HML is the return of value stocks minus growth stocks, their version of the value spread. The 25 groups differ in both size and book-to-market, so the test checks both SMB and HML. The animation runs their test on French’s data, with the market alone and then with all three factors.
Group return − rf = α + b × MKT + s × SMB + h × HML + e
Against the market alone, the alphas of the 25 groups average 0.19% a month, ignoring their sign. With SMB and HML added, they average 0.09% a month, and within every size group the HML loadings increase from growth to value. So, as in the simulation, the groups move with HML, and HML explains much of the differences in their average returns.
If the three factors explained the average returns fully, all 25 alphas would be zero. Testing each alpha on its own is not enough, because even if they did, about one of 25 alphas would have a t-statistic beyond ±1.96 by chance. The GRS test, named after Gibbons, Ross and Shanken, tests whether all 25 alphas are zero together. It gives 4.17 for the market alone and 3.63 for the three factors, both with p-values below 0.01, so both models leave alphas that are statistically different from zero. With three factors, six of the 25 alphas have t-statistics beyond ±1.96, and the one furthest from zero is that of the smallest growth stocks, −0.47% a month, with a t-statistic of −5.08.
Step 5. Checking new data
Step 5 tests the characteristic that I believe is a factor across other samples, either by extending the sample period or by looking at a different set of stocks, such as other countries. A new simulated sample would follow the same assumptions, so this step needs real data, where predictors earn less after they are published.
Limitations
The limitation is that I use only one characteristic for grouping. Normally, I need to sort by other characteristics or variables too, such as size or industry.
The test does not necessarily show why there is a positive association between value and future returns. It could reflect a risk premium, consistent with a factor, or some form of mispricing, which I cannot separate in this case.
The last limitation is that I need a more skeptical cutoff when I am dealing with many factors, such as a t-statistic of about 3 instead of 1.96.
Conclusion
The way I can establish whether a characteristic is a factor is to first compare its future returns across different groups, and then test whether there is a residual, an alpha, when I compare those returns with the existing factors. Last, I test whether its spread explains the returns of other stocks. In this simulated market, value passes these tests.
References
Cochrane, J. H. (2005). Asset pricing (Rev. ed.). Princeton University Press.
Fama, E. F., & French, K. R. (1993). Common risk factors in the returns on stocks and bonds. Journal of Financial Economics, 33(1), 3–56. https://doi.org/10.1016/0304-405X(93)90023-5
Fama, E. F., & French, K. R. (2015). A five-factor asset pricing model. Journal of Financial Economics, 116(1), 1–22. https://doi.org/10.1016/j.jfineco.2014.10.010
French, K. R. (2026a). 25 portfolios formed on size and book-to-market (5 x 5) [Monthly data set]. Kenneth R. French Data Library. https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/Data_Library/tw_5_ports.html
French, K. R. (2026b). Fama/French 3 factors [Monthly data set]. Kenneth R. French Data Library. https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/Data_Library/f-f_factors.html
Gibbons, M. R., Ross, S. A., & Shanken, J. (1989). A test of the efficiency of a given portfolio. Econometrica, 57(5), 1121–1152. https://doi.org/10.2307/1913625
Harvey, C. R., Liu, Y., & Zhu, H. (2016). … and the cross-section of expected returns. The Review of Financial Studies, 29(1), 5–68. https://doi.org/10.1093/rfs/hhv059
Lewellen, J., Nagel, S., & Shanken, J. (2010). A skeptical appraisal of asset pricing tests. Journal of Financial Economics, 96(2), 175–194. https://doi.org/10.1016/j.jfineco.2009.09.001
McLean, R. D., & Pontiff, J. (2016). Does academic research destroy stock return predictability? The Journal of Finance, 71(1), 5–32. https://doi.org/10.1111/jofi.12365
Read next
- Factor investing in Python: value and momentum, step by step Value and momentum in a long-only portfolio, with rebalancing and trading costs.
- Backtest overfitting: when out-of-sample becomes in-sample Why a test on new data has to be run once.
Disclaimer: a teaching example on simulated data, whose returns follow the assumptions in the code. Not investment advice.