Metadata-Version: 2.5
Name: mantis-imf
Version: 0.1.9
Summary: Instrument Management Facility for MANTIS
Author-email: Louis Zhuang <yzhuang@outlook.com>
Requires-Python: >=3.14
Requires-Dist: adbc-driver-postgresql>=1.12.0
Requires-Dist: asof-store[sql-postgres,sql-sqlite]
Requires-Dist: polars[adbc,pyarrow]>=2.0.0
Requires-Dist: pydantic>=2.0
Requires-Dist: zapros>=0.20.0
Description-Content-Type: text/markdown

# MANTIS Instrument Management Facility

`imf` searches and updates IB instrument records in an `asof-store` database.
Configure the SQL backend once in the repository's `service-registrar.toml`:

```toml
["asof-store.sql"]
sql_uri = "sqlite:///ib-instruments.db"
```

IMF supplies each store's table and value types; `sql_uri` comes from this
section by default. Pass `--sql-uri URI` to any command to override it for that
invocation. For PostgreSQL, set `sql_uri` to the database connection URI. The
`imf index` command requires PostgreSQL and adds trigram indexes to the
instrument and template tables.

## Searching

```powershell
imf search --symbol AAPL
imf search --country US --exchange NASDAQ --product-type STK
imf search --local-symbol "ESZ6"
imf search --field currency=USD --field "contract.exchange=SMART"
imf search --as-of 2026-10-29T12:00:00+00:00 --symbol AAPL
```

Search filters use case-insensitive substring matching by default; pass
`--exact` for exact matches. Repeat `--field NAME=VALUE` to filter additional
JSON fields. Dotted names address nested fields. Results are one JSON object
per line. `--table-name` and `--missing-primary-key-table-name` override the
corresponding table names.

Use `imf fuzzy` to search standard instrument fields with multiple values. Each
value must match at least one field. With no values, it opens an interactive
REPL.

```powershell
imf fuzzy AAPL NASDAQ
imf index
```

## Scraping

```powershell
imf scrape-instruments
imf scrape-reconcile
imf scrape-funds
imf scrape-exchanges
```

The instrument commands accept repeated `--product-type` and
`--product-country` filters. Use `--dry-run` to print the remote product summary
without opening a store. Run any command with `--help` to see its full options.
