Metadata-Version: 2.4
Name: quantifyme
Version: 0.1.0
Summary: Python SDK for QuantifyMe — describe a trading strategy in English, deploy it live in one call.
Project-URL: Homepage, https://quantifyme.ai
Project-URL: Documentation, https://api.quantifyme.ai/openapi.json
Project-URL: Source, https://github.com/malcolm1232/HFTAgent
Project-URL: Changelog, https://github.com/malcolm1232/HFTAgent/releases
Author-email: QuantifyMe <support@quantifyme.ai>
License: MIT
Keywords: ai,algorithmic,backtesting,claude,forex,quantifyme,quantitative,trading
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Description-Content-Type: text/markdown

# quantifyme

Python SDK for [QuantifyMe](https://quantifyme.ai) — describe a trading strategy in plain English, deploy it live in one call. Powered by Claude and an ML backtest engine.

```bash
pip install quantifyme
```

## 60 seconds, zero to live signal

```python
from quantifyme import QuantifyMe

qm = QuantifyMe()  # anonymous trial key auto-minted on first call

result = qm.one_shot(
    "Buy EURUSD when RSI drops below 30, sell when RSI rises above 70",
    on_progress=lambda e: print(f"[{e.pct:>3}%] {e.stage}: {e.msg}"),
)

print("Live signals →", result.live_url)
```

That's it. The SDK just did:

1. Minted an anonymous trial API key (50 credits, no signup)
2. Asked Claude to write a Python strategy from your prompt (streamed tokens)
3. Trained an ML model on 28 days of real EURUSD 15-min OHLC data
4. Deployed the trained model for live signal delivery
5. Returned a dashboard URL you can open to see live predictions

## Before / after

Raw HTTP (what you'd have written without the SDK):

```python
import requests, json

resp = requests.post(
    "https://api.quantifyme.ai/api/v1/one_shot",
    headers={"X-API-Key": "qm_..."},
    json={"prompt": "Buy EURUSD when RSI < 30", "deliver_to": {"webhook": True}},
    stream=True, timeout=600,
)

event = None
for line in resp.iter_lines(decode_unicode=True):
    if not line: continue
    if line.startswith("event:"):
        event = line.split(":", 1)[1].strip()
    elif line.startswith("data:"):
        data = json.loads(line.split(":", 1)[1])
        if event == "step":
            print(f"[{data['pct']:>3}%] {data['stage']}: {data.get('msg', '')}")
        elif event == "done":
            print("LIVE:", data["live_url"])
            break
        elif event == "error":
            raise RuntimeError(data["error"])
```

Same thing, with the SDK:

```python
from quantifyme import QuantifyMe
qm = QuantifyMe()
print(qm.one_shot("Buy EURUSD when RSI < 30", on_progress=print).live_url)
```

## Authentication

Three options, checked in order:

```python
qm = QuantifyMe(api_key="qm_...")           # explicit
qm = QuantifyMe.from_env()                  # reads QUANTIFYME_API_KEY
qm = QuantifyMe()                           # auto-mints anonymous trial key
```

Environment variables:
- `QUANTIFYME_API_KEY` — your personal key (get one at https://quantifyme.ai)
- `QUANTIFYME_BASE_URL` — override API base (default `https://api.quantifyme.ai`)

## Granular control

The SDK exposes the full REST API, not just `one_shot`:

```python
# Generate code only (no training / no deploy)
code = qm.generate(
    features="RSI 14, Bollinger Bands",
    signals="Buy on oversold bounce",
    model="Random Forest",
    risk="0.5% stop loss",
).code

# Train + wait for completion
job = qm.train(code=code, model_name="RSI Scalp")
stats = job.wait()                          # blocks until done
print(f"Test profit factor: {stats.test_stats.profit_factor:.2f}")
print(f"Test win rate: {stats.test_stats.win_rate:.1%}")

# List + deploy
for m in qm.models.list():
    print(f"{m.name}: {m.test_stats.total_return:+.2%} on {m.test_stats.n} trades")

qm.deploy("Model 1", channels=["webhook"], webhook_url="https://yours.example.com/hook")

# Live signals
for live in qm.deployed.list():
    print(f"Live: {live.model} → {live.channels}")
```

## Discovery (no auth required)

```python
qm.indicators.schema()   # all built-in indicators + parameters
qm.presets.list()        # curated strategy templates + chip presets
```

## Error handling

```python
from quantifyme import (
    AuthError, RateLimitError, InsufficientCreditsError,
    StreamError, TrainingError,
)

try:
    qm.one_shot("...")
except InsufficientCreditsError:
    print("Out of credits — top up at https://quantifyme.ai/billing")
except RateLimitError:
    print("Slow down")
except AuthError:
    print("Bad API key")
except TrainingError as e:
    print(f"Training failed: {e}")
```

## Context manager

```python
with QuantifyMe() as qm:
    qm.one_shot("Buy on MACD bullish crossover")
# connection cleaned up
```

## What's behind this

QuantifyMe runs 24/7 prediction daemons on your behalf:
- Every 15 minutes, each deployed model receives a fresh EURUSD candle
- Runs `model.predict_proba()` against the latest bar
- Fires signals via webhook POST / Telegram DM when confidence clears your threshold
- All models, credits, and live slots are isolated per-API-key (trial or paid)

Free tier: 1 live model (auto-swap on new deploy), 50 credits.
Pro tier ($3.30/mo): unlimited models + signals + 30K API tokens/month.

## Related packages

- [`quantifyme-mcp`](https://pypi.org/project/quantifyme-mcp/) — Claude MCP server exposing the same API to Claude Code / Desktop as callable tools. Install: `pipx install quantifyme-mcp && claude mcp add quantifyme quantifyme-mcp`.

## Links

- Website: https://quantifyme.ai
- OpenAPI spec: https://api.quantifyme.ai/openapi.json
- Source: https://github.com/malcolm1232/HFTAgent

## License

MIT
