Metadata-Version: 2.4
Name: cotmetrics
Version: 0.1.0
Summary: Turn raw COT data into positioning metrics and trading signals (positioning index, concentration/clustering/position-size, reversal signals).
Author-email: "Matt S." <cotanalyzer@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/mspinola/cotmetrics
Project-URL: Repository, https://github.com/mspinola/cotmetrics
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.5
Requires-Dist: numpy
Requires-Dist: pyarrow>=10
Requires-Dist: PyYAML>=6.0
Requires-Dist: pytz
Requires-Dist: requests>=2.28
Requires-Dist: xlrd>=2.0
Requires-Dist: cotdata>=0.1.0
Provides-Extra: options
Requires-Dist: yfinance; extra == "options"
Provides-Extra: scheduler
Requires-Dist: schedule; extra == "scheduler"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: ruff==0.15.22; extra == "dev"
Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
Dynamic: license-file

# cotmetrics

Turn raw COT (Commitments of Traders) data into positioning metrics and trading
signals — the positioning index, concentration / clustering / position-size,
reversal signals, and the `CotIndexer` that assembles per-instrument weekly panels.

Split out of `cot-analyzer` so the metrics layer installs without the Dash/Plotly
dashboard stack. Reads prices/COT from the shared [`cotdata`](../cotdata) store.

## Install (workspace, editable)

```bash
pip install -e ../cotdata -e .[options,scheduler,dev]
export COTDATA_STORE=~/code/cotdata_store     # shared data store
export COTMETRICS_CACHE=~/.cache/cotmetrics    # derived per-instrument parquet cache
```

## Use

```python
import cotmetrics                                   # flat metric fns
from cotmetrics.indexer import cotIndexer, boot_options_update
from cotmetrics.signals import append_trading_signals
cotmetrics.calculate_cot_index(...)
```

`import cotmetrics` is side-effect-free. Constructing the indexer
(`from cotmetrics.indexer import cotIndexer`) loads the store; the daily options
fetch runs only when you call `boot_options_update()` explicitly.

## Config / paths

| env | meaning | default |
|-----|---------|---------|
| `COTDATA_STORE` | shared price/COT store (from cotdata) | required |
| `COTMETRICS_CACHE` | derived per-instrument parquet cache | `~/.cache/cotmetrics` |
| `COTMETRICS_PARAMS` | instrument/params config | packaged **sample** `params.yaml` |
| `COTMETRICS_DATA` | legacy raw_cot_data.parquet + real_test_data exports | `<cache>/../cotmetrics_data` |

The packaged `params.yaml` is a small **generic sample** (a handful of well-known
symbols, untuned 52-week lookbacks) so cotmetrics runs out of the box. For a real
instrument universe and any tuned parameters, set `COTMETRICS_PARAMS` to your own
config file.
