Skip to main content

Python SDK for QuantifyMe — describe a trading strategy in English, deploy it live in one call.

Project description

quantifyme

Python SDK for QuantifyMe — describe a trading strategy in plain English, deploy it live in one call. Powered by Claude and an ML backtest engine.

pip install quantifyme

60 seconds, zero to live signal

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):

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:

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:

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:

# 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)

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

Error handling

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

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 — 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

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantifyme-0.2.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantifyme-0.2.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file quantifyme-0.2.0.tar.gz.

File metadata

  • Download URL: quantifyme-0.2.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.7

File hashes

Hashes for quantifyme-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a2c23771a6f6dcc12bbb1a6a86f309ae3d2bfb7aabfd21988bbb7205798a7c1c
MD5 9c9ee2e6c6bc1024d88a965758143bdf
BLAKE2b-256 14d3c89538ff9f210091118cef1dae36c8869a5eaef87823c45bff9e9e796fbb

See more details on using hashes here.

File details

Details for the file quantifyme-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: quantifyme-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.7

File hashes

Hashes for quantifyme-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99a937fc45d17477a44d050beaa95bdd71e15cf691b77a760d93c5a4269d83b3
MD5 418a0f66d70771dae6b8a83a01da7110
BLAKE2b-256 21f5e5e91892898862339009744143e998c46247532408c5e4a22af42d5675fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page