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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multi_broker_sdk-0.1.1.tar.gz.
File metadata
- Download URL: multi_broker_sdk-0.1.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ff472856958c8b82eea039e59d2065d69e7180da7b6dc2276c6359f8e4110b0
|
|
| MD5 |
72ec2dd30c36105a7411a15518925051
|
|
| BLAKE2b-256 |
c170eec88cfcb8add394f305474e9aaee65088b355a0b3bcc8a5d6d4fbc9edb0
|
File details
Details for the file multi_broker_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: multi_broker_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2165daf0d9a906a0f7062907ba65f0d23d71db6801e8e0a672aeda29a2bb282
|
|
| MD5 |
5ab48445fe7b6ff4bdef8c046b00c1f6
|
|
| BLAKE2b-256 |
81cc4ebe6545f28a442f815de96b2abc205706adf732867ca4cefd7c3438465e
|