Skip to content

Docs/add remaining docstrings#1188

Open
LuckyAnsari22 wants to merge 3 commits intomarketcalls:mainfrom
LuckyAnsari22:docs/add-remaining-docstrings
Open

Docs/add remaining docstrings#1188
LuckyAnsari22 wants to merge 3 commits intomarketcalls:mainfrom
LuckyAnsari22:docs/add-remaining-docstrings

Conversation

@LuckyAnsari22
Copy link
Copy Markdown
Contributor

@LuckyAnsari22 LuckyAnsari22 commented Mar 28, 2026

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:

  1. Shoonya Full Document Overhaul (broker/shoonya/)

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.

  • Refactors
    • Shoonya: Documented API client and mapping functions in broker/shoonya/api/data.py and broker/shoonya/mapping/order_data.py (args, returns, errors, connection pooling, orders/trades/positions/portfolio/holdings).
    • Zerodha: Clarified margin mapping and response parsing in broker/zerodha/mapping/margin_data.py, including direct CNC/NRML/MIS and order type mappings.
    • Angel: Added clear docstrings for order transforms in 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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant