Skip to main content

market-stack-sdk (Python)

HTTP client for Alpha API (/v1).

Install

From this directory:

pip install .

Usage

from market_stack_sdk import MarketStackClient

with MarketStackClient(api_key="YOUR_API_KEY") as client:
    # Defaults to https://developers.manasija.in
    from market_stack_sdk import AnnouncementsQueryParams, DailySummaryRequest, NewsQueryParams

    print(client.get_news(NewsQueryParams(symbols=["RELIANCE"], limit=10)))
    print(client.get_announcements(AnnouncementsQueryParams(symbols=["RELIANCE"])))
    print(
        client.get_earnings_detail(
            {"symbol": "MEDIASSIST", "quarter": "q4_26", "detailed": True}
        )
    )
    print(
        client.post_daily_summary(
            {
                "body": DailySummaryRequest(
                    portfolio=[{"symbol": "RELIANCE", "exposure": 10}]
                )
            }
        )
    )

All calls automatically send X-API-Key from the provided api_key.

Use get, post, put, patch, delete, or request for any public /v1 endpoint.

WebSocket (/v1/ws)

Requires the websockets package (installed with this SDK).

import asyncio
from market_stack_sdk import MarketStackClient, SubscribeOptions

async def main() -> None:
    client = MarketStackClient(api_key="YOUR_API_KEY")
    async with client.websocket() as ws:
        await ws.subscribe(
            SubscribeOptions(product="announcements", symbols=["RELIANCE"], detailed=False)
        )
        async for event in ws.events():
            if event.kind == "subscribed":
                print("ready", event.product, event.tier)
            elif event.kind == "data":
                print(event.channel, event.data.get("symbol"))

asyncio.run(main())

Direct session import (without creating MarketStackClient):

import asyncio
from market_stack_sdk import AlphaWebSocketSession, SubscribeOptions

async def main() -> None:
    async with AlphaWebSocketSession(api_key="YOUR_API_KEY", auto_reconnect=True) as ws:
        await ws.subscribe(
            SubscribeOptions(product="news", symbols=["RELIANCE"], detailed=True)
        )
        await ws.run()

asyncio.run(main())

Callback style:

async with client.websocket(on_data=lambda e: print(e.data)) as ws:
    await ws.subscribe(product="alerts", symbols=["RELIANCE"])
    await ws.run()

# Optional resilience hooks:
# async with client.websocket(
#     auto_reconnect=True,
#     reconnect_initial_delay=1.0,
#     reconnect_max_delay=30.0,
#     on_reconnect_attempt=lambda attempt, delay, reason: print(attempt, delay, reason),
#     on_open=lambda reason: print("connected", reason),
#     on_close=lambda reason: print("closed", reason),
# ) as ws:
#     ...

Metadata

Release files for market-stack-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for market-stack-sdk 0.2.0
File Size Uploaded
market_stack_sdk-0.2.0.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for market-stack-sdk 0.2.0
File Interpreter ABI Platform
market_stack_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / market_stack_sdk-0.2.0.tar.gz

Download URL market_stack_sdk-0.2.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
beeae5b72b8bf2794d028fa458ed8207029d6fc08c7788a0854202752e763c07
BLAKE2b-256 checksum
How to use checksums
57bfef8f433d1510982755514a0c9bd74a4c34492fbd2e2c04919b3d644a02b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 27, 2026.

Transparency log

Release files / market_stack_sdk-0.2.0-py3-none-any.whl

Download URL market_stack_sdk-0.2.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4588027d754f9af052edb5789ba3f9cd7874293fdfbd3811f72545ec8ea6947
BLAKE2b-256 checksum
How to use checksums
9fa57f53d9f8b9b6dd3f3bc814900cce6f7fdc8be2a39f459e68c01020bff6b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page