Skip to content

Add QuantOracle action provider#1179

Open
fel123 wants to merge 1 commit intocoinbase:mainfrom
fel123:add-quantoracle-action-provider
Open

Add QuantOracle action provider#1179
fel123 wants to merge 1 commit intocoinbase:mainfrom
fel123:add-quantoracle-action-provider

Conversation

@fel123
Copy link
Copy Markdown

@fel123 fel123 commented May 9, 2026

Summary

Adds a new action provider giving AgentKit agents access to deterministic quant finance math — Black-Scholes pricing, Kelly Criterion sizing, Monte Carlo simulation, full risk audits, and hedge recommendations.

The two paid composite actions (assess_portfolio_risk, recommend_hedge) settle automatically via the agent's wallet using x402 micropayments on Base or Solana — no API key, no signup, no billing infrastructure required. This is the structural fit with AgentKit: the framework's USDC-native wallets unlock paid endpoints that traditional API-key services can't reach as cleanly.

What's new

5 curated actions covering the financial decisions an autonomous trading or finance agent typically faces:

Action Cost Use case
price_option Free Pre-trade Black-Scholes pricing with full Greeks
calculate_kelly Free Optimal bet sizing with full/half/quarter Kelly
simulate_portfolio Free Monte Carlo with retirement-style withdrawals
assess_portfolio_risk $0.04 USDC via x402 Composite Sharpe/Sortino/Calmar/maxDD/VaR/CVaR/Kelly/Hurst audit
recommend_hedge $0.04 USDC via x402 Ranked hedge structures (collar, protective put, partial put, inverse)

Free tier: 1,000 calls/IP/day with no signup or API key, covers all three calculator actions.

Why deterministic finance math matters for agents

LLMs trying to compute Black-Scholes prices, Kelly fractions, or Monte Carlo simulations in-context drift — the numbers are wrong, the Greeks are hallucinated, and the agent can't tell. QuantOracle's API is tested against published textbook values (Hull, Wilmott, Lopez de Prado) with 120 accuracy benchmarks passing.

For agents making financial decisions, this matters: a bad Black-Scholes price is the difference between a profitable trade and a losing one.

Implementation

Follows the existing action-provider pattern (modeled on messari and pyth):

  • quantoracleActionProvider.ts — main class with @CreateAction-decorated methods for each action
  • schemas.ts — Zod schemas with rich .describe() strings for the LLM
  • constants.ts — API base URL (override via QUANTORACLE_API_URL env var)
  • index.ts — re-exports
  • README.md — follows the directory documentation convention (Getting Started, Actions, Rate Limiting, Usage)
  • quantoracleActionProvider.test.ts — 9 jest tests covering happy-path, error-handling, and negative-edge Kelly

Also exports the new provider from src/action-providers/index.ts (placed alphabetically after pyth) and adds a changeset entry.

Validation

  • pnpm run lint — clean
  • pnpm run build — clean
  • pnpm test -- quantoracle — 9/9 passing

Demo

Sample agent prompts the LLM can satisfy via this provider:

  • "Price a 30-day NVDA call with strike $185, spot $180, 28% IV"price_option
  • "I have 55% win rate, $150 avg win, $100 avg loss — what's my Kelly?"calculate_kelly
  • "Simulate $100K over 30 years with 7% return, 16% vol, 4% withdrawal"simulate_portfolio
  • "Audit risk on my last 252 daily returns: [...]"assess_portfolio_risk (paid)
  • "Recommend hedges for my $100K long NVDA position over 30 days"recommend_hedge (paid)

Resources

Happy to adjust scope, copy, or implementation based on review feedback.

Adds a new action provider exposing 5 curated actions for autonomous
trading and finance agents:

  - price_option            (free)  Black-Scholes + full Greeks
  - calculate_kelly         (free)  Kelly Criterion optimal sizing
  - simulate_portfolio      (free)  Monte Carlo simulation
  - assess_portfolio_risk   ($0.04) Composite Sharpe/Sortino/Calmar/
                                    maxDD/VaR/CVaR/Kelly/Hurst audit
  - recommend_hedge         ($0.04) Ranked hedge structures (collar,
                                    protective put, partial put, inverse)

Why deterministic finance math matters for agents:
LLMs trying to compute Black-Scholes prices, Kelly fractions, or Monte
Carlo simulations in-context drift. The numbers are wrong, the Greeks
are hallucinated, and the agent can't tell. QuantOracle's API is tested
against published textbook values (Hull, Wilmott, Lopez de Prado) with
120 accuracy benchmarks passing.

Why this fits AgentKit specifically:
The two paid composites settle automatically via the agent's wallet
using x402 micropayments on Base or Solana. No API key, no signup,
no billing infrastructure required. Free tier covers the calculator
endpoints up to 1,000 calls/IP/day.

Implementation:
  - Follows the existing action-provider pattern (modeled on messari/pyth)
  - Zod schemas for all 5 actions with rich descriptions for the LLM
  - 9 jest tests covering happy-path, error-handling, and negative-edge
    Kelly recommendations — all passing
  - README.md following the directory convention
  - Changeset entry as 'patch' (new feature)

API: https://api.quantoracle.dev (73 endpoints total; this provider
exposes a curated subset)
Docs: https://api.quantoracle.dev/openapi.json
Source: https://github.com/QuantOracledev/quantoracle
@fel123 fel123 requested a review from murrlincoln as a code owner May 9, 2026 02:56
@cb-heimdall
Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@github-actions github-actions Bot added documentation Improvements or additions to documentation action provider New action provider typescript labels May 9, 2026
@MVPuknowme
Copy link
Copy Markdown

MVPuknowme commented May 9, 2026 via email

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

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

3 participants