brokerkit-core
The framework half of BrokerKit: the models, the interfaces every broker adapter implements, and the assembly layer that resolves create_broker("zerodha", ...) to a live, authenticated broker.
This package ships no broker integrations. Install it alongside at least one adapter.
pip install brokerkit-core brokerkit-zerodha
Available adapters: brokerkit-groww, brokerkit-fyers, brokerkit-upstox, brokerkit-dhan, brokerkit-angelone, brokerkit-zerodha.
The idea
Every Indian broker ships its own SDK with its own auth flow, symbol format, units (some report prices in paise, some in rupees), error convention (some raise, some return a failure dict, some return status: false and only log it) and its own idea of what a "quote" contains. brokerkit-core defines one typed, async contract; each adapter absorbs its broker's quirks behind it.
from brokerkit import create_broker
broker = await create_broker("zerodha", api_key=..., api_secret=..., access_token=...)
instruments = await broker.instruments.fetch_instruments()
reliance = next(i for i in instruments if i.symbol == "RELIANCE")
quote = await broker.market.get_quote(reliance)
print(quote.last_price, quote.volume)
await broker.close()
Swap "zerodha" for "fyers" and nothing else changes.
The contract
Every broker exposes the same providers:
| Attribute | Interface | Methods |
|---|---|---|
broker.auth |
AuthProvider |
login, get_token |
broker.instruments |
InstrumentProvider |
fetch_instruments |
broker.orders |
OrderProvider |
place_order, modify, cancel, get_order, list_orders |
broker.portfolio |
PortfolioProvider |
holdings, positions |
broker.market |
MarketDataProvider |
get_quote, get_ltp, get_ohlc, get_option_chain |
broker.historical |
HistoricalDataProvider |
get_candles |
broker.streaming |
StreamingProvider |
subscribe_ltp, unsubscribe_ltp, close |
Plus three interfaces that only some brokers implement, deliberately kept off the shared Broker base so no broker is forced to carry a hole: ChargesProvider, FundamentalsProvider, NewsProvider, MarketInformationProvider.
Design decisions worth knowing
- Async-native. Every interface method is
async def. Adapters wrap sync vendor SDKs withasyncio.to_thread; blocking calls never run inside an interface method. - Pydantic v2 models,
Decimalprices. Validation at construction, JSON-serializable for API/agent layers. Enums are stdlibStrEnum. - Instruments are a thin adapter, not a store.
fetch_instruments()downloads, normalizes and returns — the framework holds no cache, no indexes, no lookups. Storage and querying belong to your app. Calling it again re-downloads, because brokers update masters daily. - Instance-scoped state only. No module-level tokens, clients or caches, so one process can hold several accounts.
BrokerManagercomposes N named brokers on top of that. - Adapters are plugins. Core never imports an adapter.
create_broker("dhan", ...)lazily importsbrokerkit_dhan, whoseBrokersubclass self-registers via__init_subclass__. Adding a broker touches no core code.
Models
Instrument, Order / OrderRequest, Position, Holding, Quote / Ohlc / DepthLevel, Candle, Tick, OptionChain / OptionContract / OptionGreeks, BrokerageCharges, and the fundamentals/news/market-information models.
Two cross-broker facts these encode:
Tick.minute_ohlconly ever populates for Upstox — it is the one broker whose feed computes a live 1-minute candle server-side. Everywhere else it staysNoneand you aggregate ticks yourself.Instrument.isinisNonefor Angel One and Zerodha — their instrument masters have no ISIN column at all. ISIN is the natural cross-broker join key for equities, so join those two onexchange_tokeninstead; it matches exactly across Groww, Fyers, Dhan and Zerodha.
Multiple accounts
from brokerkit import BrokerManager
manager = BrokerManager()
await manager.add("main", "zerodha", api_key=..., api_secret=..., access_token=...)
await manager.add("data", "fyers", client_id=..., secret_key=..., ...)
quote = await manager["data"].market.get_quote(instrument)
await manager.close_all()
License
MIT © 2026 Aditya Vishwakarma
Metadata
Release files for brokerkit-core 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| brokerkit_core-1.0.3.tar.gz | 33.3 kB | Without provenance | Details for brokerkit_core-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brokerkit_core-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for brokerkit_core-1.0.3-py3-none-any.whl |
Total release size: 79.2 kB
Release files / brokerkit_core-1.0.3.tar.gz
| Download URL | brokerkit_core-1.0.3.tar.gz |
|---|---|
| Size | 33.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53d99c0e9499ccabefd75b874b58a32460f77749ee86ac6699378359ed2aae75
|
|
BLAKE2b-256 checksum How to use checksums |
e53fbd1e71e90fe6249837040445685e46780dd0d571fd3b5453725eab917e9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / brokerkit_core-1.0.3-py3-none-any.whl
| Download URL | brokerkit_core-1.0.3-py3-none-any.whl |
|---|---|
| Size | 45.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5dc1a8dc5e174b075e2641304fa3b946115da65c3e0dadee4d1981c5179c06fe
|
|
BLAKE2b-256 checksum How to use checksums |
b16af5c93bd49d1127d52c32c3a53b25d56cd455d8d0cb07c2df62a2aea58d4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for brokerkit-core 1.0.3
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.