chore: final FOSS Hack 2026 polish on active endpoints#1192
Open
LuckyAnsari22 wants to merge 1 commit intomarketcalls:mainfrom
Open
chore: final FOSS Hack 2026 polish on active endpoints#1192LuckyAnsari22 wants to merge 1 commit intomarketcalls:mainfrom
LuckyAnsari22 wants to merge 1 commit intomarketcalls:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="broker/angel/api/funds.py">
<violation number="1" location="broker/angel/api/funds.py:25">
P2: Docstring promises `{}` on failure/parse failure, but uncaught JSON and float parsing paths can raise exceptions instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| auth_token (str): JWT or session string provided natively by Angel login. | ||
|
|
||
| Returns: | ||
| dict: Standardized payload containing available cash, collateral, m2m, and utilized debits matching OpenAlgo dictionary schemas exactly. Or returns an empty {} dict on complete failure or parse failure. |
Contributor
There was a problem hiding this comment.
P2: Docstring promises {} on failure/parse failure, but uncaught JSON and float parsing paths can raise exceptions instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At broker/angel/api/funds.py, line 25:
<comment>Docstring promises `{}` on failure/parse failure, but uncaught JSON and float parsing paths can raise exceptions instead.</comment>
<file context>
@@ -12,7 +12,18 @@
+ auth_token (str): JWT or session string provided natively by Angel login.
+
+ Returns:
+ dict: Standardized payload containing available cash, collateral, m2m, and utilized debits matching OpenAlgo dictionary schemas exactly. Or returns an empty {} dict on complete failure or parse failure.
+ """
api_key = os.getenv("BROKER_API_KEY")
</file context>
Suggested change
| dict: Standardized payload containing available cash, collateral, m2m, and utilized debits matching OpenAlgo dictionary schemas exactly. Or returns an empty {} dict on complete failure or parse failure. | |
| dict: Standardized payload containing available cash, collateral, m2m, and utilized debits matching OpenAlgo dictionary schemas exactly. Returns {} when response data is absent; request/parse/conversion errors may raise. |
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 acts as the final maintainability polish for the OpenAlgo ecosystem, specifically targeting database ingestion vulnerabilities and documenting the outermost REST API utilities. It builds upon the global error handling refactor and standardization schemas implemented over the past month.
🛠️ Key Changes
broker/angel/database/master_contract_db.py
)
Found a fragile try/except block where Bulk SQL Inserts and Pandas JSON schema parsing failures were being natively swallowed by simple logger.info() and logger.error() strings without context.
Hardened this pipeline by injecting standard logger.exception() structures so failed database synchronizations actually expose their crash stack traces to the system admins.
2. OpenAlgo Endpoint Documentation (
restx_api/market_holidays.py
&
broker/angel/api/funds.py
)
Standardized the internal
get_margin_data()
fetching logic for Angel Broking with PEP-compliant Google-style docstrings, specifically documenting how OpenAlgo dynamically calculates collateral natively versus utilized payout.
Upgraded the documentation schema for the native
MarketHolidays
REST controller resolving endpoint descriptions.
✅ Checklist
Database insertion failures now log full diagnostic logger.exception data instead of failing silently.
Margin and Holiday API controllers adhere to OpenAlgo's Google-style document schemas.
Tested locally without breaking legacy REST consumers.
Summary by cubic
Hardened DB ingestion error handling and improved REST docs to make failures visible and API behavior clearer. Stack traces are now logged for bulk insert and master contract download failures, and endpoint docstrings describe collateral calculation and response shapes.
Bug Fixes
logger.exceptionfor bulk insert and master contract download failures to log full stack traces.Documentation
get_margin_data()detailing dynamic collateral calculation and return schema.MarketHolidays.postdocstring to describe behavior, weekend handling, and JSON response format.Written for commit c2031b8. Summary will update on new commits.