Finance in this project
Follow a trading decision: the information available, the holdings it creates, and the results that follow.
What was known when the decision was made?
A trading method receives information, chooses a portfolio, and later sees the result. The order matters. A decision time is the point at which the method must act. Its information cutoff is the latest time from which it may use data.
Financial reports also have two times: the period they describe and the date they are released. A report about last year's earnings may not be public until several months later. A time zone can also change which event came first.
Using later information in an earlier decision is called lookahead bias. An LLM creates another possible route: it may remember what happened to a named company. Removing names and dates can reduce this clue, but a distinctive event or number may still reveal the history.
Read more: Course starter: daily information and simulation rules ↗
What do the input numbers mean?
StockBench brings together prices, company information, and news. These describe different parts of the market. The course starter includes the released local data; individual fields may be missing. A missing value means the information is unavailable; it does not mean the value is zero.
| Input | Plain meaning |
|---|---|
| Open and close | Prices at the start and end of a trading session. |
| Trading volume | The number of shares traded during a period. |
| Recent returns | Price changes measured relative to earlier prices. |
| Earnings per share | Company profit, under a stated accounting definition, divided by the relevant share count. |
| News | A report about an event, with a publication time and source. |
A price is a dollar amount for one share. A return is a relative change. For Stock A, a move from $50 to $52 gives a price return of ($52 − $50) / $50 = 4%. This does not yet include its $1 dividend.
One common company measure is the price-to-earnings ratio, or P/E:
Past earnings and forecast earnings are different inputs. News describes events and expectations; its tone is not a direct measurement of the next price move.
Read more: FINRA: prices and company value measures ↗
From a decision to a portfolio
A portfolio contains cash and shares. Its value changes when prices move, dividends arrive, or costs are paid. For our two fictional stocks:
V is total value, C is cash, q is the number of shares, and P is the share price. A stock's weight is its holding value divided by V.
A target is the desired holding after a trade, rather than the amount to buy. In the course starter, a strategy returns share quantities: positive to buy and negative to sell. The orders_from_weights helper can turn target portfolio weights into orders. The original LLM adapter also uses target_cash_amount, which means the target dollar value held in a stock; it does not mean uninvested cash.
Trading costs and basis points
A basis point, or bp, is 0.01%. Thus 10 bps = 0.10% = 0.001.
One common definition of turnover is total traded dollars divided by portfolio value before the trades. Here it is 200 / 1,000 = 20%. Some reports use half this amount. Fee rates, execution prices, and trade constraints depend on the runner's rules.
Read more: Investor.gov: how orders are executed ↗ · Course starter: orders and target weights ↗
Reading the result
Cumulative return is the total change from the starting account value. With no money added or withdrawn:
Here R is cumulative return. The account ending at $1,015 has R = 1,015 / 1,000 − 1 = 1.5%. Returns over several days compound; simply adding them generally gives a different answer.
Drawdown measures a fall from a previous peak. Maximum drawdown is the largest such fall in the observed path:
Downside risk focuses on returns below a chosen target. The Sortino ratio compares average return above that target with a measure of how much returns fall below the target. A target could be 0% per day. Its value depends on the target, time unit, and exact formula. StockBench uses its own calculation, so a number from another package may not match.
A benchmark is a clearly defined reference portfolio. Its market, dates, cash treatment, and costs affect the comparison. It gives context to a return; it is not a promise of what was easy to earn.
Prediction accuracy counts correct answers. Profit also depends on price-move size and invested dollars. Many correct predictions of small gains can be outweighed by a few large losses.
Read more: CFA Institute: the Sortino ratio ↗ · StockBench metric definitions ↗