Calculate the Balance of Power (BOP) indicator for a given price series.

The Balance of Power (BOP) indicator measures the strength of buyers versus sellers in the market. It relates the price change to the change in the asset’s trading range.

The formula is as follows:

\[\text{BOP} = (\text{Close} - \text{Open}) / (\text{High} - \text{Low})\]

Also known as: BOP, bull bear power.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Balance of Power (BOP) for you. Just ask in plain English.

Calculate the Balance of Power (BOP) in Python

The Balance of Power (BOP) is available in the Technicals module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_balance_of_power as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_balance_of_power()

Which returns:

Date AAPL MSFT Benchmark
2026-06-18 -0.0202 0.1953 -0.2334
2026-06-22 -0.053 -0.5769 -0.4695
2026-06-23 -0.4343 0.2382 -0.0314
2026-06-24 -0.3373 -0.4333 -0.2119
2026-06-25 -0.814 -0.6613 -0.4719
2026-06-26 0.7479 0.7469 0.002
2026-06-29 -0.5857 -0.4335 0.472
2026-06-30 0.8864 0.297 0.7686
2026-07-01 0.1272 0.2475 0.1076
2026-07-02 0.9219 0.7071 -0.2323

Parameters

get_balance_of_power 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 column name for closing prices in the historical data. 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 BOP. 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.

The Technicals module page introduces the module, and the sidebar lists all of its functions.

Share