Skip to main content

Python SDK for the Numin Financial Market Analysis API

Project description

Numin Python SDK

Python client library for the Numin Financial Market Analysis API.

Installation

pip install numin

Quick Start

from numin import Numin

client = Numin(api_key="numin_xxxxx")

# Get a projection for SPY
projection = client.projections.single_ticker(
    ticker="SPY",
    timeframe="daily",
    start_date="2026-01-15",
)
print(projection)

client.close()

Authentication

Pass your API key directly or set it as an environment variable:

# Option 1: Pass directly
client = Numin(api_key="numin_xxxxx")

# Option 2: Environment variable
# export NUMIN_API_KEY=numin_xxxxx
client = Numin()

Usage

Projections

from numin import Numin

client = Numin(api_key="numin_xxxxx")

# Single ticker
result = client.projections.single_ticker(
    ticker="SPY",
    timeframe="daily",
    start_date="2026-01-15",
)

# Multiple tickers, same timeframe
results = client.projections.multi_ticker(
    tickers=["SPY", "QQQ", "AAPL"],
    timeframe="daily",
    start_date="2026-01-15",
)

# Multiple tickers, multiple timeframes
results = client.projections.multi_ticker_multi_timeframe(
    tickers=["SPY", "AAPL"],
    timeframes=["daily", "1hour", "5min"],
    start_date="2026-01-15",
)

Harmonics

harmonics = client.harmonics.single_ticker(
    ticker="SPY",
    timeframe="daily",
    start_date="2026-01-15",
    bars=20,
    comprehensive=True,
    use_harmonic=False,
)

Market Data

bars = client.market_data.get(ticker="SPY", timeframe="daily")

Reports

# Download report and save to file
report_bytes = client.reports.download(
    ticker="SPY",
    timeframe="daily",
    start_date="2026-01-15",
    file_path="reports/SPY_daily.docx",
)

# Or just get the bytes
report_bytes = client.reports.download(
    ticker="SPY",
    timeframe="daily",
)

Async Usage

import asyncio
from numin import AsyncNumin

async def main():
    async with AsyncNumin(api_key="numin_xxxxx") as client:
        projection = await client.projections.single_ticker(
            ticker="SPY",
            timeframe="daily",
            start_date="2026-01-15",
        )
        print(projection)

asyncio.run(main())

Error Handling

from numin import Numin, NotFoundError, BadRequestError, AuthenticationError

client = Numin(api_key="numin_xxxxx")

try:
    result = client.projections.single_ticker(
        ticker="INVALID",
        timeframe="daily",
        start_date="2026-01-15",
    )
except NotFoundError as e:
    print(f"Data not found: {e.message}")
except BadRequestError as e:
    print(f"Invalid request: {e.message}")
except AuthenticationError as e:
    print(f"Auth failed: {e.message}")

Configuration

client = Numin(
    api_key="numin_xxxxx",
    base_url="http://localhost:8000",  # Custom base URL
    timeout=180.0,                     # Request timeout in seconds (default: 120)
    max_retries=3,                     # Max retries on failure (default: 2)
)

Context Manager

# Sync
with Numin(api_key="numin_xxxxx") as client:
    result = client.projections.single_ticker(...)

# Async
async with AsyncNumin(api_key="numin_xxxxx") as client:
    result = await client.projections.single_ticker(...)

Valid Timeframes

daily, weekly, monthly, 1min, 5min, 10min, 15min, 30min, 1hour, 2hour, 4hour

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

numin_client-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

numin_client-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file numin_client-0.1.0.tar.gz.

File metadata

  • Download URL: numin_client-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for numin_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a026659a0f91422079cc33f4d7878d940a866641520628cd67d717736fe561d1
MD5 c7b8355c33272356c67d900b99ae73d5
BLAKE2b-256 b8e702662b5cc037a163d21b53f32aaccc5e3015de22fb2140dd7699764a19d8

See more details on using hashes here.

File details

Details for the file numin_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: numin_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for numin_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8344780a77ede6359b1976eb611ac869c0d5e7e5e1e7c602e56b490b777e1b5d
MD5 2fd26c3f4ec75b80d10fc06455471e36
BLAKE2b-256 ebb241c5a998bcb11197ae8801aab393fcea53cb5fa367614f09e4bc373560f3

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