GET Notional Cap
/notional_cap
Example Query:
Example Response:
Data Source
Values are configured and managed exclusively by the hedger. These caps are set per trading pair and reflect the hedger’s risk management strategy for individual assets.
Notional Cap Implementation (Rasa)
Router
Logic
Ensures the provided
symbol_id
exists and is well-formed; raises a 400/422 if not.Queries the hedger’s capacity engine for the per-symbol maximum notional cap and current usage.
Emits metrics for monitoring and alerting.
FastAPI serializes this to JSON matching
OpenInterestResponseSchema
:
Steps to Implement Your Own Version
Define the Response Schema
Implement Symbol Validation
Write
symbol_id_validator(symbol_id: int)
that checks against yourSymbol
table or whitelist.
Build The Capacity Engine
In
OpenCapEngine
, implementget_cap_and_used_amount_async(symbol_id, from_stats=True)
to return(Decimal total_cap, Decimal used)
, using:Per-symbol config table for maximum caps.
Positions table to sum currently open notional on that symbol.
Add the FastAPI Route
In your
common_router
, add theGET /notional_cap/{symbol_id}
handler as shown, importing the schema, validator, and engine.Attach the same rate-limiting and
@with_context_db_session
decorators.
Last updated