Skip to main content

Unified Python SDK for multiple stock broker APIs authentication.

Project description

Multi-Broker SDK

Unified Python SDK for authenticating and interacting with multiple Indian stock broker APIs.

Supported Brokers

  • Fyers (v3 API) - Implemented
  • Angel One - Planned
  • Zerodha - Planned
  • Upstox - Planned

Features

  • Unified Interface: consistent API across different brokers.
  • Auto-Authentication: Handles TOTP generation and token management automatically.
  • Secure Token Storage: Encrypts and stores access tokens locally to avoid frequent login requests.
  • Token Management: Automatically refreshes tokens when they expire (handle daily 12 AM reset).

Installation

pip install multi-broker-sdk

Usage

Fyers

from multi_broker_sdk import FyersBroker

# Initialize broker
broker = FyersBroker(
    username="XY12345",
    totp_key="YOUR_TOTP_KEY",
    pin="1234",
    client_id="YOUR_CLIENT_ID",
    secret_key="YOUR_SECRET_KEY",
    redirect_uri="https://trade.fyers.in/api-login/redirect-uri/index.html"
)

# Authenticate (handles TOTP and token generation automatically)
# This will cache the token in ~/.multi_broker_sdk/tokens/
access_token = broker.authenticate()

print(f"Access Token: {access_token}")

# Get Fyers client instance (fyers_apiv3)
client = broker.get_client()

# Use the client
print(client.get_profile())

Security

Tokens are stored in ~/.multi_broker_sdk/tokens/ in an encrypted format using a key derived from your credentials. This ensures that even if someone gets access to the file, they cannot use it without your credentials.

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

multi_broker_sdk-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

multi_broker_sdk-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for multi_broker_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9afa9860f6f7e22a6c4b23265950f889995aab1215b3a4fbad85ebc05654f454
MD5 6abe87078741b789a0e8e07cf09c0315
BLAKE2b-256 ebd270a68e84dacf96cee0f52baa850ccad4b6f9f0ef3cd990138c47a9c96b8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for multi_broker_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ade57d285d466a4535617d9015635bf8bf9a9b4186470a71cd98b0aac0c161aa
MD5 ec6d05dde08095ba99025972e6e8b09b
BLAKE2b-256 b1d550aa7c2bf82ef44e2e2e732f6e063453a0397001e17545c7ad89e2931c6b

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