TRIN (Arms Index)
Calculate the TRIN (Arms Index) for a given price series.
TRIN compares the ratio of advancing to declining issues against the ratio of volume in advancing issues to volume in declining issues. It is a market-wide breadth reading computed across all tickers in the Toolkit instance (excluding the synthetic “Portfolio” and “Benchmark” columns), and the resulting single reading is broadcast to every ticker column so it lines up with the other breadth indicators.
The formula is as follows:
\[\text{TRIN} = (\text{Advancing Issues} / \text{Declining Issues}) / (\text{Advancing Volume} / \text{Declining Volume})\]Also known as: Arms Index, TRIN.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the TRIN (Arms Index) for you. Just ask in plain English.
Calculate the TRIN (Arms Index) in Python
The TRIN (Arms Index) is available in the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_trin as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_trin()
Which returns:
| Date | AAPL | MSFT | Benchmark |
|---|---|---|---|
| 2026-06-18 | 0.85 | 0.85 | 0.85 |
| 2026-06-22 | 1.12 | 1.12 | 1.12 |
| 2026-06-23 | 0.97 | 0.97 | 0.97 |
| 2026-06-24 | 1.05 | 1.05 | 1.05 |
| 2026-06-25 | 1.31 | 1.31 | 1.31 |
| 2026-06-26 | 0.79 | 0.79 | 0.79 |
| 2026-06-29 | 0.91 | 0.91 | 0.91 |
| 2026-06-30 | 0.88 | 0.88 | 0.88 |
| 2026-07-01 | 0.94 | 0.94 | 0.94 |
| 2026-07-02 | 1.02 | 1.02 | 1.02 |
Parameters
get_trin accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The name of the column containing the close prices. Defaults to “Adj Close”.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the indicator values. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.
Related Breadth Indicators
The Technicals module page introduces the module, and the sidebar lists all of its functions.