Skip to content

fix(mcp): normalize theta/vega/rho in calc_indexes response - #52

Merged
huacnlee merged 2 commits into
mainfrom
fix-executions-side
May 20, 2026
Merged

fix(mcp): normalize theta/vega/rho in calc_indexes response#52
huacnlee merged 2 commits into
mainfrom
fix-executions-side

Conversation

@huacnlee

Copy link
Copy Markdown
Member

Summary

  • calc_indexes tool was returning raw unscaled Greek values that differ from what the Longbridge app displays
  • Apply the same normalization as longbridge-terminal CLI before returning results:
    • theta: raw value is annualized (×252) → divide by 252 for per-trading-day value
    • vega: raw value is scaled by 100 → divide by 100 for per-1%-IV-change value
    • rho: raw value is scaled by 100 → divide by 100 for per-1%-rate-change value

Test plan

  • Start MCP server locally and call calc_indexes with theta, vega, rho fields
  • Verify returned values match the Longbridge app display (same as longbridge calc-index CLI output)

Fixes longbridge/developers#1014

🤖 Generated with Claude Code

huacnlee and others added 2 commits May 19, 2026 10:56
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The calc_indexes API returns these Greeks as raw unscaled values that
differ from what the Longbridge app displays:
- theta: annualized (×252) → divide by 252 for per-trading-day
- vega:  scaled by 100 → divide by 100 for per-1%-IV-change
- rho:   scaled by 100 → divide by 100 for per-1%-rate-change

Matches the normalization applied by the longbridge-terminal CLI.
Fixes longbridge/developers#1014.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@huacnlee
huacnlee merged commit d4a0e55 into main May 20, 2026
1 check passed
@huacnlee
huacnlee deleted the fix-executions-side branch May 20, 2026 11:20
hogan-yuan pushed a commit that referenced this pull request Jul 6, 2026
## Summary

- `calc_indexes` tool was returning raw unscaled Greek values that
differ from what the Longbridge app displays
- Apply the same normalization as `longbridge-terminal` CLI before
returning results:
- **theta**: raw value is annualized (×252) → divide by 252 for
per-trading-day value
- **vega**: raw value is scaled by 100 → divide by 100 for
per-1%-IV-change value
- **rho**: raw value is scaled by 100 → divide by 100 for
per-1%-rate-change value

## Test plan

- [ ] Start MCP server locally and call `calc_indexes` with `theta`,
`vega`, `rho` fields
- [ ] Verify returned values match the Longbridge app display (same as
`longbridge calc-index` CLI output)

Fixes longbridge/developers#1014

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

API返回的期权theta和vega数据,和app不一样,差好多

1 participant