Buckets:

download
raw
3.01 kB
{
"role_mappings": [
{
"role": "Entity",
"status": "present",
"symbol": "_request",
"file": "easyths/trade_client.py",
"lines": "109",
"notes": "In-repo client SDK TradeClient._request sends every HTTP call (client.request at easyths/trade_client.py:124) to the easyths API server, whose requests pass through RateLimitMiddleware.dispatch (easyths/api/middleware/rate_limit.py:35); it documents the rate_limited error code. External callers (bundled web console, MCP clients) also reach it."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "dispatch",
"file": "easyths/api/middleware/rate_limit.py",
"lines": "35",
"notes": "dispatch of Starlette BaseHTTPMiddleware RateLimitMiddleware, registered in _add_middleware via app.add_middleware(RateLimitMiddleware, calls=rate_limit, period=1) at easyths/api/app.py:104 (only when api_rate_limit > 0; default 100, so on). It derives the client IP as entity id, returns a 429 error_response (line 63) when over limit, else call_next (line 73)."
},
{
"role": "Limiter",
"status": "present",
"symbol": "dispatch",
"file": "easyths/api/middleware/rate_limit.py",
"lines": "35",
"notes": "Decision is inline in the Enforcer's dispatch (same method as Enforcer, no helper): sliding-window check len(recent) >= self.calls at easyths/api/middleware/rate_limit.py:54 over timestamps within self.period."
},
{
"role": "HistoryProvider",
"status": "present",
"symbol": "clients",
"file": "easyths/api/middleware/rate_limit.py",
"lines": "33",
"notes": "In-memory dict self.clients (IP -> list of request timestamps) initialised in RateLimitMiddleware.__init__; no accessor method, so the field is cited. dispatch prunes expired entries (lines 43-50), reads history via setdefault (line 53) and records allowed requests with recent.append(now) (line 70)."
},
{
"role": "PolicyProvider",
"status": "present",
"symbol": "load_toml_file",
"file": "easyths/utils/config.py",
"lines": "50",
"notes": "Policy (calls per 1-second period) comes from config: field api_rate_limit default 100 (easyths/utils/config.py:38), overridden/validated by load_toml_file from [api].rate_limit (lines 92-97); _add_middleware reads it at easyths/api/app.py:102 and passes it to RateLimitMiddleware.__init__ (rate_limit.py:21), stored as self.calls/self.period used by dispatch."
},
{
"role": "System",
"status": "present",
"symbol": "execute_operation",
"file": "easyths/api/routes/operations.py",
"lines": "62",
"notes": "Global middleware guards all routes; after dispatch forwards via call_next (rate_limit.py:73) the main business handler execute_operation (operations router included at easyths/api/app.py) submits a trading operation to the queue. Other routes (system, queue, MCP mount) are equally guarded."
}
]
}

Xet Storage Details

Size:
3.01 kB
·
Xet hash:
a691e5c3e21581a50eaf74c0ab56bf51f3ef7e22a9f2cda7180134783527ef79

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.