Metadata-Version: 2.4
Name: alphameta
Version: 2.4.2
Summary: IBKR trading + SEC research API gateway
Home-page: https://github.com/intelliscale/alphameta
Author: GAO KE
Author-email: gaoke@intelliscale.com
License: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.7
Requires-Dist: httpx>=0.28.1
Requires-Dist: loguru>=0.7.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: orjson>=3.6.7
Requires-Dist: pandas>=2.0.3
Requires-Dist: python-dateutil>=2.9.0
Requires-Dist: fastapi>=0.128.7
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dotenv>=1.2.2
Requires-Dist: uvicorn>=0.40.0
Requires-Dist: ib_async>=2.0.1
Requires-Dist: prompt_toolkit>=3.0.29
Requires-Dist: questionary>=2.0.1
Requires-Dist: aiofiles>=24.1.0
Requires-Dist: aiohttp>=3.7.4
Requires-Dist: websockets>=16.0
Requires-Dist: arrow>=1.1.0
Requires-Dist: cachetools>=6.2.0
Requires-Dist: pandas-market-calendars>=4.1.4
Requires-Dist: pytz>=2020.1
Requires-Dist: whenever>=0.6.9
Requires-Dist: beautifulsoup4>=4.11.1
Requires-Dist: jinja2>3.1.0
Requires-Dist: lark>=1.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: diskcache>=5.6.3
Requires-Dist: ulid-py>=1.1.0
Requires-Dist: prettyprinter>=0.18.0
Requires-Dist: setproctitle>=1.2.2
Requires-Dist: edgartools>=5.30.2
Requires-Dist: yfinance>=1.2.0
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# AlphaMeta

AlphaMeta is a REST API gateway for IBKR (Interactive Brokers) — live trading and real-time market data for stocks, options, futures, and crypto via a standardized REST API. Commands run as HTTP endpoints behind a FastAPI gateway, callable via `curl` or any HTTP client.

Also includes SEC EDGAR research commands — filing listing, 13F investors, insider trades, XBRL financial statements and segment data.

## Quick start

```bash
pip install alphameta
```

Requires an IBKR Gateway or TWS instance for trading operations.

```bash
# Start the API server
alphameta start

# Live quotes
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "quote AAPL"}'

# SEC research (no IBKR needed)
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "filing AAPL 10-K"}'
```

The API serves at `http://127.0.0.1:18080` by default.

## Features

### Commands by category
| Category | Commands |
|----------|----------|
| Live Market Quotes | `quote`, `add`, `remove` (`rm`), `kline`, `depth`, `chain`, `range`, `info`, `align`, `prequalify`, `oadd`, `filing` (`filings`), `investors` (`inv`), `insider-trades` (`insider`), `financial-report` (`frep`), `financial-statement` (`fstmt`), `sec`, `calc-index` (`calcidx`), `capital-flow` (`capflow`), `consensus`, `operating` (`ops`) |
| Order Management | `buy`, `cancel`, `modify`, `evict`, `fast`, `scale`, `straddle` |
| Portfolio | `positions` (`ls`), `balance`, `orders`, `executions`, `report` |
| Technical Indicators | `dex`, `gex`, `dge`, `maxpain` |
| Predicate Management | `ifthen`, `iflist` (`ifls`), `ifrm`, `ifclear`, `ifgroup`, `auto` |
| Quote Management | `qadd`, `qremove` (`qrm`), `qlist`, `qsave`, `qrestore`, `qdelete`, `qclean`, `qsnapshot`, `qloadsnapshot`, `colorset`, `colorsload` |
| Schedule Management | `sched-add` (`sadd`), `sched-list` (`slist`), `sched-cancel` (`scancel`) |
| Task Management | `tasklist`, `taskcancel` |
| Connection | `rid` |
| Utilities | `cash`, `math`, `alert`, `say`, `expand`, `simulate`, `paper`, `reporter`, `daydumper`, `details`, `advice`, `alias`, `clear`, `meta`, `qualify`, `reconnect`, `calendar`, `set`, `unset` |

## Examples

**Bulk symbol expansion:**
```bash
# Add/remove multiple option strikes at once
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "add SPY240412{P,C}005{1,2,3}0000"}'

# Remove by row id
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "rm :{31..37}"}'
```

**Multi-symbol orders:**
```bash
# Buy ~$15k of each symbol
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "expand buy {META,MSFT,NVDA,AMD,AAPL} $15_000 MID"}'
```

**Flexible order pricing:**
```bash
# By quantity or dollar amount, with bracket orders
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "buy AAPL 100 AF @ 233.33 ± 10"}'
```

**Conditional triggers:**
```bash
# Execute command when price condition is met
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "if AAPL last > 300: buy AAPL 100 AF"}'
```

**Account calculator:**
```bash
# Calculate shares buyable on margin, combine with growth projections
curl -X POST "http://127.0.0.1:18080/api/v1/execute" \
  -H "Content-Type: application/json" \
  -d '{"cmd": "(/ :BP3 AAPL)"}'
```

## License

Apache-2.0
