Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 539 Bytes

File metadata and controls

16 lines (12 loc) · 539 Bytes

Financial time series

Measure market uncertainty over time with permutation and spectral entropy.

import pandas as pd
from entroscope import permutation, spectral

stock_prices = pd.read_csv("sp500.csv")["close"]
perm_entropy = permutation.rolling(stock_prices, window=50, order=3)
spec_entropy = spectral.rolling(stock_prices, window=50)

Permutation entropy is robust to noise and captures ordinal structure; spectral entropy reveals whether price movement is dominated by a few cycles (low) or broadband/noisy (high).