Skip to main content

cci

Calculate the Commodity Channel Index (CCI).

The CCI is designed to detect beginning and ending market trends. The range of 100 to -100 is the normal trading range. CCI values outside of this range indicate overbought or oversold conditions. You can also look for price divergence in the CCI. If the price is making new highs, and the CCI is not, then a price correction is likely.

Example​

from openbb import obb

stock_data = obb.equity.price.historical(symbol='TSLA', start_date='2023-01-01', provider='fmp')
cci_data = obb.technical.cci(data=stock_data.results, length=14, scalar=0.015)

Parameters​

NameTypeDescriptionDefaultOptional
dataList[Data]The data to use for the CCI calculation.False
indexstrIndex column name to use with data, by default "date".dateFalse
lengthintThe length of the CCI, by default 14.14False
scalarfloatThe scalar of the CCI, by default 0.015.0.015False

Returns​

OBBject
results : List[Data]
The CCI data.