Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

RealMarketAPI Python SDK (Beta)

Official beta Python SDK for RealMarketAPI REST and WebSocket market data endpoints.

Website: https://realmarketapi.com/

Why use this SDK

  • Thin Python wrapper for RealMarketAPI HTTP and streaming APIs.
  • Simple class-based client for request/response usage.
  • Async WebSocket streams with automatic reconnect behavior.
  • Small dependency footprint (httpx, websockets).

Requirements

  • Python 3.9+
  • RealMarketAPI API key

Install

pip install realmarketapi-python-sdk-beta

Quick start

REST client

from realmarketapi_sdk import RealMarketApiClient

client = RealMarketApiClient(api_key="YOUR_API_KEY")

try:
    price = client.get_price("EURUSD", "M1")
    print("Close:", price.get("closePrice"))
finally:
    client.close()

WebSocket client

import asyncio
from realmarketapi_sdk import RealMarketApiWebSocket

ws = RealMarketApiWebSocket(api_key="YOUR_API_KEY")

async def main() -> None:
    async for tick in ws.stream_price("BTCUSDT", "M1"):
    print(tick)

asyncio.run(main())

REST API methods

All REST methods return a Python dict parsed from JSON and include your API key as query parameter.

get_price(symbol_code, time_frame)

Example:

price = client.get_price("EURUSD", "M1")

Example response payload:

{
    "symbolCode": "EURUSD",
    "timeFrame": "M1",
    "openPrice": 1.07874,
    "highPrice": 1.07882,
    "lowPrice": 1.07868,
    "closePrice": 1.07879,
    "openTime": "2026-05-21T09:12:00Z"
}

get_candles(symbol_code, time_frame)

Example:

candles = client.get_candles("BTCUSDT", "M5")

Example response payload:

{
    "symbolCode": "BTCUSDT",
    "timeFrame": "M5",
    "candles": [
        {
            "openTime": "2026-05-21T09:10:00Z",
            "openPrice": 68620.3,
            "highPrice": 68690.1,
            "lowPrice": 68588.7,
            "closePrice": 68655.8,
            "volume": 128.42
        }
    ]
}

get_history(symbol_code, start_time, end_time, page_number=1, page_size=20)

Example:

history = client.get_history(
    symbol_code="EURUSD",
    start_time="2026-05-20T00:00:00Z",
    end_time="2026-05-21T00:00:00Z",
    page_number=1,
    page_size=20,
)

Example response payload:

{
    "pageNumber": 1,
    "pageSize": 20,
    "totalPages": 14,
    "items": [
        {
            "openTime": "2026-05-20T00:00:00Z",
            "openPrice": 1.07913,
            "highPrice": 1.07942,
            "lowPrice": 1.07898,
            "closePrice": 1.07920,
            "volume": 241.11
        }
    ]
}

get_symbols()

Example:

symbols = client.get_symbols()

Example response payload:

{
    "symbols": ["EURUSD", "BTCUSDT", "XAUUSD"]
}

get_sma(symbol_code, time_frame, period=20)

Example:

sma = client.get_sma("EURUSD", "M15", period=50)

Example response payload:

{
    "symbolCode": "EURUSD",
    "timeFrame": "M15",
    "period": 50,
    "value": 1.08024,
    "openTime": "2026-05-21T09:00:00Z"
}

create_alert(symbol_code, time_frame, rule_type, threshold, cooldown_seconds=300, channels=None)

Creates a new alert rule.

get_alerts(status=None)

Returns alert rules, optionally filtered by status.

delete_alert(alert_id)

Deletes an alert rule by id.

query_screener(time_frame, trend=None, min_rsi=None, max_volatility_pct=None, min_liquidity_score=None, sort_field="SignalScore", sort_direction="Desc", size=25)

Queries symbols by screener filters.

get_strategy_signal(symbol_code, time_frame)

Returns composite strategy signal payload.

create_watchlist(name, tags=None, notes=None)

Creates a cloud watchlist.

get_watchlists()

Returns watchlist collection.

add_watchlist_item(watchlist_id, symbol_code, order=0)

Adds a symbol to a watchlist.

remove_watchlist_item(watchlist_id, symbol_code)

Removes a symbol from a watchlist.

get_market_calendar(date=None, timezone="UTC")

Returns sessions and high-impact market events.

WebSocket streaming methods

The WebSocket client exposes async generators and reconnects after transient failures.

stream_price(symbol_code, time_frame)

Example:

async for event in ws.stream_price("EURUSD", "M1"):
    print(event)

Example message payload:

{
    "symbolCode": "EURUSD",
    "timeFrame": "M1",
    "closePrice": 1.07879,
    "openTime": "2026-05-21T09:12:00Z"
}

stream_candles(symbol_code, time_frame)

Example:

async for event in ws.stream_candles("BTCUSDT", "M5"):
    print(event)

Example message payload:

{
    "symbolCode": "BTCUSDT",
    "timeFrame": "M5",
    "openTime": "2026-05-21T09:10:00Z",
    "openPrice": 68620.3,
    "highPrice": 68690.1,
    "lowPrice": 68588.7,
    "closePrice": 68655.8,
    "volume": 128.42
}

Error handling notes

  • REST methods call response.raise_for_status(), so HTTP 4xx/5xx responses raise httpx.HTTPStatusError.
  • WebSocket streams retry on connection errors using reconnect_delay_seconds (default 2.0).
  • Cancel the async task to stop streaming cleanly.

Beta scope and compatibility

  • Current REST coverage: price, candles, history, symbols, SMA.
  • Expanded REST coverage: alerts, screener, strategy signal, watchlist, and market calendar.
  • Current WebSocket coverage: price and candles.
  • This package is beta and may receive additive changes before stable 1.0.

Metadata

Release files for realmarketapi-python-sdk-beta 0.1.0b2

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

Source distribution (sdist)

Source distribution for realmarketapi-python-sdk-beta 0.1.0b2
File Size Uploaded Provenance Actions
realmarketapi_python_sdk_beta-0.1.0b2.tar.gz 5.6 kB Without provenance Details for realmarketapi_python_sdk_beta-0.1.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for realmarketapi-python-sdk-beta 0.1.0b2
File Interpreter ABI Platform Actions
realmarketapi_python_sdk_beta-0.1.0b2-py3-none-any.whl Python 3 none any Details for realmarketapi_python_sdk_beta-0.1.0b2-py3-none-any.whl

Total release size: 12.3 kB

Release files / realmarketapi_python_sdk_beta-0.1.0b2.tar.gz

Download URL realmarketapi_python_sdk_beta-0.1.0b2.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
51e577671347254a6536367c9d743c2e53cf52afc95d7a714c79c42573411298
BLAKE2b-256 checksum
How to use checksums
cef8a0230c0f41da85e2213d648dcd1d8ac22f01af093f65d63ef0bb03e26a02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / realmarketapi_python_sdk_beta-0.1.0b2-py3-none-any.whl

Download URL realmarketapi_python_sdk_beta-0.1.0b2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4536a63db1cc5ebbcd2355492e481feb10d0229a3e245e02b32d754c01d2ef84
BLAKE2b-256 checksum
How to use checksums
0e780cc935930dd33c48f1970b479a9878ae511a45cd821cedfb1ca2f199608e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for realmarketapi-python-sdk-beta 0.1.0b2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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