Skip to main content

A unified, high-performance API layer that powers all trading infrastructure across the HedgeTech ecosystem, providing modular, scalable, and real-time interfaces for market data, order management, and execution systems.

Project description

HedgeTech Python SDK

HedgeTech Python SDK is a professional, lightweight, and modular Python package designed to provide seamless access to HedgeTech services. The SDK is crafted for developers, data analysts, and algorithmic traders who want to interact with the Tehran Stock Exchange (TSE & IFB) using a clean, reliable, and easy-to-use API. It supports both synchronous and asynchronous workflows, offering maximum flexibility and performance for different application scenarios.

Note: This SDK requires Python >= 3.10 and is currently in Beta. Some APIs may change in future releases, but it is stable enough for daily use.

Features

  • Secure authentication with both async and sync clients.
  • Real-time and historical market data retrieval from TSE & IFB.
  • Modular and maintainable architecture, designed to support multiple engines (DataEngine engines, WebSocket clients, etc.).
  • Structured request and response types for robust data handling.
  • Fully asynchronous support for high-performance applications.
  • Easy to integrate into trading bots, analytics pipelines, dashboards, or WebSocket feeds.

Installation

Install HedgeTech SDK via PyPI:

pip install HedgeTech

Updating the Package

To update HedgeTech SDK to the latest version in your environment, use:

pip install --upgrade HedgeTech

Usage

The SDK exposes all major clients through the top-level modules, so you generally do not need to import internal implementation files directly.

Authentication

Note: Make sure to use the matching async or sync Auth client depending on your workflow.

Async Authentication

from HedgeTech.Auth import AuthAsyncClient

auth_async_client = await AuthAsyncClient.login(
    UserName_or_Email='<YOUR UserName_or_Email>',
    Password='<YOUR Password>'
)
print(auth_async_client.token)

Sync Authentication

from HedgeTech.Auth import AuthSyncClient

auth_sync_client = AuthSyncClient.login(
    UserName_or_Email='<YOUR UserName_or_Email>',
    Password='<YOUR Password>'
)
print(auth_sync_client.token)

DataEngine / TSE IFB

The DataEngine is designed to support multiple engines in a modular way. Each engine provides its own async and sync clients, structured request and response types, and can be integrated with other engines such as WebSocket clients.

Important Note on Sync vs Async: All clients have the same method names and behavior in both Sync and Async versions. The only difference is how they execute: Sync runs in a blocking manner, while Async requires await and an event loop. This design allows you to switch between Sync and Async without changing the logic or input/output of your code.

Async Data Client

from HedgeTech.DataEngine import DataEngine_TseIfb_AsyncClient

client = DataEngine_TseIfb_AsyncClient(auth_async_client)
data = await client.live_best_limit_by_isin(
    symbol_isins=['IRT1AHRM0001','IRO1IKCO0001']
)
print(data)

# websocket Example

async for update in client.websocket_by_name(
    channels=["best-limit", "order-book"],
    symbol_names=["فملی","اطلس"]
):

    print(update["data"])

Sync Data Client

from HedgeTech.DataEngine import DataEngine_TseIfb_SyncClient

client = DataEngine_TseIfb_SyncClient(auth_sync_client)
data = client.historical_ohlcv_by_name(
    symbolName='مهرگان',
    start_timestamp=0,
    end_timestamp='1763411432',
    AdjustedPrice=True,
    Resolution='D'
)
print(data)

# websocket Example

for update in client.websocket_by_isin(
    channels=["best-limit", "order-book"],
    symbol_isins=["IR1234567890"]
):

    print(update["data"])

Important Notes for Users

  • This SDK requires Python >=3.10.
  • The SDK is currently in Beta — APIs may change in future releases, but it is usable for most workflows.
  • Always install dependencies with the specified versions to avoid compatibility issues.
  • Async clients require an asyncio event loop.
  • All main clients are exposed through top-level modules; you do not need to access internal files.
  • Keywords and classifiers are chosen to make the SDK easy to find for developers working in finance, trading, and data analysis.

Modules Overview

HedgeTech.Auth

Handles authentication for all HedgeTech clients. The async (AuthAsyncClient) and sync (AuthSyncClient) clients are exposed through the top-level Auth module.

HedgeTech.DataEngine

Handles interactions with the Tehran Stock Exchange IFB and other engines. Provides:

  • Async and sync clients for fetching market data.
  • Structured request and response types for predictable and robust data handling.
  • Modular design that allows integration of additional engines, such as WebSocket clients or future data engines, without modifying the main interface.

Contributing

We welcome contributions from the community! Please follow standard Python coding conventions, write clear documentation for any new features, and submit pull requests for improvements or bug fixes.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for full details.

Support

For questions or issues, please open a GitHub issue or contact the HedgeTech team directly. We aim to provide timely support and guidance for all developers using the SDK.

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

hedgetech-0.2.0b1.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

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

hedgetech-0.2.0b1-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file hedgetech-0.2.0b1.tar.gz.

File metadata

  • Download URL: hedgetech-0.2.0b1.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for hedgetech-0.2.0b1.tar.gz
Algorithm Hash digest
SHA256 a71fba98e8e39d5e2a4ae3686914a7d9c628e0c8b98fdc7d3656c4b6fc73c822
MD5 d4f47b9a3945d0f821da80742e56a375
BLAKE2b-256 d04b0fbca13b8e65bb9f4dbf35d9a44b0c3435b9389f010a454b5da37674e701

See more details on using hashes here.

File details

Details for the file hedgetech-0.2.0b1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for hedgetech-0.2.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 c809ffbc4e056607f8b8f1c85c4f3af68928cfca96cb082966ff02acd9da4fda
MD5 96d477073847adb7bfda2bd832a74bbb
BLAKE2b-256 3540a0ffde35b742a9de77e58825f048b2b2fedba78c781ea2aa3245216d8427

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