Docs/add remaining docstrings#1188
Open
LuckyAnsari22 wants to merge 3 commits intomarketcalls:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FOSS Hack 2026 Contribution 🚀
This Pull Request represents the final major milestone in standardizing the OpenAlgo broker integration documentation. Building off of previous documentation sweeps, this PR targets the last core files remaining in the translation and mapping interfaces for three major brokers: Shoonya, Zerodha, and Angel Broking.
Prior to these upgrades, key logic defining how margin data was translated or how async connection pooling was handled under the hood resided entirely undocumented.
🛠️ Key Changes
This PR features massive documentation refactors across the following exact endpoints:
api/data.py: Added explicit, high-level Google docstrings for internal async data routines (_fetch_single_quote_async, _process_quotes_batch_async). Documented how the connection-pooling and API key modifications occur, allowing future developers to understand how Shoonya effectively manages networking limits.
mapping/order_data.py: Completely documented all mapping and calculations translating Shoonya payload formats into standard OpenAlgo order details (transform_tradebook_data, map_portfolio_data, calculate_portfolio_statistics, etc.).
2. Zerodha Margin Logic Definitions (broker/zerodha/mapping/margin_data.py)
Thoroughly documented the complex calculation differences occurring between partially optimized initial logic and fully optimized spread margin configurations inside parse_margin_response.
Clear definitions added for translation configurations applied to transform_margin_positions.
3. Angel Mapping Completions (broker/angel/mapping/transform_data.py)
Finalized the translation methodologies converting API payloads into the Angel Broking expected structures (transform_modify_order_data, map_variety).
Documented precise parameter behaviors handling mapping reverse lookups (reverse_map_product_type).
✅ Checklist
Adopted project-standard Google-Style formatting strictly parsing Args, Returns, and Raises dictionaries natively inline.
Complex core translation mechanisms inside Zerodha spread calculations accurately defined for debugging support.
Tested locally and confirmed syntax integrity natively functioning as expected without regressions.
💡 Impact
This pulls the final core modules in line with OpenAlgo's professional maintainability scope. With Shoonya's internal methods now fully described, future integrations can safely reverse engineer API functionality or create highly performant trading extensions with no deep, initial friction traversing module definitions.
Summary by cubic
Standardized Google-style docstrings across Shoonya, Zerodha, and Angel mapping/data modules to clarify transformations, margin logic, and async quote fetching. Improves readability and maintainability with no behavior changes.
broker/shoonya/api/data.pyandbroker/shoonya/mapping/order_data.py(args, returns, errors, connection pooling, orders/trades/positions/portfolio/holdings).broker/zerodha/mapping/margin_data.py, including direct CNC/NRML/MIS and order type mappings.broker/angel/mapping/transform_data.py, including modify-order flow and product/type/variety reverse mappings.Written for commit f8942ab. Summary will update on new commits.