Skip to Content

Markets, data and returns

Market structure in one page

Exchanges (ASX, NYSE, Nasdaq) match orders in a limit order book: bids to buy, asks to sell. The gap is the spread. Market orders cross the spread; limit orders wait. Every trade costs brokerage plus the spread plus slippage (moving the price against yourself).

Data

  • Bars (OHLCV — open, high, low, close, volume) daily or intraday
  • Ticks / order book for microstructure work
  • Corporate actions: splits and dividends must be adjusted for, or returns are wrong
  • Survivorship bias: a dataset of today's index members ignores companies that failed — it flatters every backtest

Returns

import pandas as pd, numpy as np
px = pd.read_csv("ASX_BHP.csv", parse_dates=["date"], index_col="date")["adj_close"]
ret = px.pct_change().dropna()              # simple returns
logret = np.log(px).diff().dropna()          # log returns (add across time)
ann_vol = ret.std() * np.sqrt(252)
Rating
0 0

There are no comments for now.

to be the first to leave a comment.