Skip to main content

LangChain tools for Mycelia Signal — 185 endpoints across four layers: prices, indices, derivatives, DeFi, compute, perp/TradFi/liquidity regimes, macro risk, divergence, consensus, regime persistence, leadership/breadth equity indices, equity regime composite (MSERC). Automatic x402 payment.

Project description

langchain-mycelia-signal

LangChain tools for Mycelia Signal — cryptographically signed oracle data with automatic x402 (USDC on Base) payment.

185 endpoints across four layers — Layer 1 Oracle Data (prices, indices, derivatives, DeFi, compute, gas, weather, marine, COT), Layer 2 Oracle Information (market synopsis, perp regime, TradFi regime, liquidity regime, equity indices), Layer 3 Oracle Intelligence (macro risk, perp setup, DeFi opportunity, regime change, cross-asset divergence, regime consensus, regime persistence). No API keys. No accounts. Install and go.


Installation

pip install langchain-mycelia-signal

For paid mode (signed attestations with automatic x402 payment):

pip install langchain-mycelia-signal[paid]

Quick Start

from langchain_mycelia_signal import MyceliaSignalTools
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI

tools = MyceliaSignalTools().as_list()  # 34 tools covering 185 endpoints across four layers

llm = ChatOpenAI(model="gpt-4o")
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({"input": "What is the Bitcoin price?"})
result = executor.invoke({"input": "What's the crypto market stress level?"})
result = executor.invoke({"input": "Show me BTC funding rates across exchanges"})
result = executor.invoke({"input": "What's the current perp regime for BTC?"})
result = executor.invoke({"input": "What is the macro risk level right now?"})
result = executor.invoke({"input": "What's the best risk-adjusted DeFi yield?"})
result = executor.invoke({"input": "Is the TradFi equity market stressed?"})
result = executor.invoke({"input": "Is crypto diverging from TradFi right now?"})
result = executor.invoke({"input": "What's the overall regime consensus across all signals?"})

Free vs Paid Mode

Free mode (default — no config needed)

Returns data without cryptographic signature. Data may be up to 5 minutes stale.

tools = MyceliaSignalTools()
print(tools.mode)  # "free"

Paid mode — signed attestations

Add your Base wallet private key to .env:

MYCELIA_WALLET_PRIVATE_KEY=0x...

Payment is handled automatically via x402 (USDC on Base). No code changes required.

tools = MyceliaSignalTools()
print(tools.mode)  # "paid"

Tools (22 total)

get_mycelia_price — Prices, FX, Macro, Commodities

56 pairs across crypto spot, VWAP, precious metals, FX, US/EU economic indicators, and commodities.

get_mycelia_price.invoke({"pair": "BTCUSD"})      # $0.01
get_mycelia_price.invoke({"pair": "EURUSD"})       # $0.01
get_mycelia_price.invoke({"pair": "XAUUSD"})       # $0.01
get_mycelia_price.invoke({"pair": "BTCUSD_VWAP"})  # $0.02
get_mycelia_price.invoke({"pair": "US_CPI"})       # $0.10
get_mycelia_price.invoke({"pair": "WTI"})          # $0.10

Crypto: BTCUSD, BTCEUR, BTCJPY, ETHUSD, ETHEUR, ETHJPY, SOLUSD, SOLEUR, SOLJPY, XRPUSD, ADAUSD, DOGEUSD, USDTUSD, USDCUSD VWAP: BTCUSD_VWAP, BTCEUR_VWAP Metals: XAUUSD, XAUEUR, XAUJPY FX: EURUSD, EURJPY, EURGBP, EURCHF, EURCNY, EURCAD, GBPUSD, GBPJPY, GBPCHF, GBPCNY, GBPCAD, USDJPY, USDCHF, USDCNY, USDCAD, CHFJPY, CHFCAD, CNYJPY, CNYCAD, CADJPY US Econ: US_CPI, US_CPI_CORE, US_UNRATE, US_NFP, US_FEDFUNDS, US_GDP, US_PCE, US_YIELD_CURVE EU Econ: EU_HICP, EU_HICP_CORE, EU_HICP_SERVICES, EU_UNRATE, EU_GDP, EU_EMPLOYMENT Commodities: WTI, BRENT, NATGAS, COPPER, DXY

get_mycelia_index — Market Indices ($0.05)

Four proprietary indices computed from cross-exchange derivatives data (11 exchanges).

get_mycelia_index.invoke({"index": "MSVI_BTC"})   # Volatility index
get_mycelia_index.invoke({"index": "MSXI_BTC"})   # Sentiment index (-100 to +100)
get_mycelia_index.invoke({"index": "MSSI"})        # Stress index (0-100)
get_mycelia_index.invoke({"index": "MSTI"})        # Crypto-TradFi contagion (0-100)

Keys: MSVI_BTC, MSVI_ETH, MSXI_BTC, MSXI_ETH, MSSI, MSTI

get_mycelia_funding — Funding Rates ($0.05)

Cross-exchange perpetual funding rates from 11 venues with per-exchange breakdown.

get_mycelia_funding.invoke({"currency": "BTC"})  # Composite + 11 exchange rates
get_mycelia_funding.invoke({"currency": "ETH"})
get_mycelia_funding.invoke({"currency": "SOL"})

get_mycelia_oi — Open Interest ($0.01)

Cross-exchange open interest with 1h/4h/24h deltas.

get_mycelia_oi.invoke({"currency": "BTC"})

get_mycelia_greeks — Options Greeks ($0.05)

Multi-exchange consensus Greeks across Deribit, OKX, and Bybit.

get_mycelia_greeks.invoke({"currency": "BTC"})  # 2130+ contracts
get_mycelia_greeks.invoke({"currency": "ETH"})  # 1822+ contracts
get_mycelia_greeks.invoke({"currency": "SOL"})  # 246+ contracts

Returns delta, gamma, theta, vega, rho — ATM summary, 25-delta skew, per-expiry breakdown. 30s cache.

get_mycelia_term_structure — Futures Term Structure ($0.05)

Multi-exchange calendar spread basis and annualized carry across Deribit, OKX, and Bybit.

get_mycelia_term_structure.invoke({"currency": "BTC"})
get_mycelia_term_structure.invoke({"currency": "ETH"})
get_mycelia_term_structure.invoke({"currency": "SOL"})

Per-maturity basis, annualized carry, days-to-expiry. Regime: CONTANGO / BACKWARDATION / FLAT.

get_mycelia_svi — SVI Volatility Surface ($0.05)

Gatheral 2004 SVI arbitrage-free IV parameterization.

get_mycelia_svi.invoke({"currency": "BTC"})
get_mycelia_svi.invoke({"currency": "ETH"})
get_mycelia_svi.invoke({"currency": "SOL"})

Returns 5 fitted parameters (a, b, rho, m, sigma) per expiry. Correct negative skew (rho ~ −0.20). Smooth smile interpolation.

get_mycelia_iv_surface — Multi-Exchange IV Surface ($0.05)

Per-strike IV from 3 exchanges with cross-exchange divergence and mispricing alerts.

get_mycelia_iv_surface.invoke({"currency": "BTC"})  # 1040+ strikes, 11 expiries
get_mycelia_iv_surface.invoke({"currency": "ETH"})
get_mycelia_iv_surface.invoke({"currency": "SOL"})

ATM term structure near→far DTE. Max divergence signals actionable arbitrage.

get_mycelia_basis — Basis/Carry ($0.02)

Per-exchange basis (mark vs index), annualized carry, regime (CONTANGO/BACKWARDATION/FLAT).

get_mycelia_basis.invoke({"currency": "BTC"})

get_mycelia_weather — Weather Oracle ($0.10)

ERA5 reanalysis data at any global coordinate. Used for parametric insurance.

get_mycelia_weather.invoke({"lat": 37.77, "lon": -122.41, "metric": "wrsi", "window": "30d"})
get_mycelia_weather.invoke({"lat": 1.35, "lon": 103.82, "metric": "rainfall", "window": "7d"})

Metrics: wrsi, rainfall, temperature, wind

get_mycelia_marine_seastate — Marine Oracle ($0.10)

Significant wave height, swell, and wind waves at any ocean coordinate.

get_mycelia_marine_seastate.invoke({"lat": 25.76, "lon": -80.19})

get_mycelia_gas — Gas Oracle ($0.01-$0.05)

Real-time gas prices for EVM and non-EVM chains.

get_mycelia_gas.invoke({"chain": "ETHEREUM"})  # $0.01
get_mycelia_gas.invoke({"chain": "INDEX"})     # $0.05 — cross-chain comparison

Chains: ETHEREUM, BASE, ARBITRUM, POLYGON, OPTIMISM, SOLANA, INDEX

get_mycelia_compute — GPU Compute Oracle ($0.05)

Real-time GPU pricing from AWS Spot, Vast.ai, RunPod, Akash. 80+ models normalized to $/GPU-hour.

get_mycelia_compute.invoke({"query": "compare"})        # Cheapest per model
get_mycelia_compute.invoke({"query": "best_h100_sxm"})  # Best H100 SXM price
get_mycelia_compute.invoke({"query": "all"})            # All 575+ prices
get_mycelia_compute.invoke({"query": "catalogue"})      # Free — list models

Queries: all, compare, best_h100_sxm, best_a100_sxm, best_h200, best_rtx_4090, best_l40s, best_mi300x, catalogue Sources: AWS Spot, Vast.ai, RunPod, Akash Network

get_mycelia_defi_yield — DeFi Yield Oracle ($0.05)

On-chain lending rates from 7 protocols across 7 chains. Direct smart contract reads.

get_mycelia_defi_yield.invoke({"query": "compare"})     # USDC rates across all protocols
get_mycelia_defi_yield.invoke({"query": "best_usdc"})   # Best USDC supply yield
get_mycelia_defi_yield.invoke({"query": "all"})         # All 40 rates
get_mycelia_defi_yield.invoke({"query": "catalogue"})   # Free — list protocols

Queries: all, compare, best_usdc, best_usdt, best_weth, best_dai, best_wbtc, catalogue Protocols: Aave V3, Spark, Compound V3, Venus, Benqi, Moonwell Chains: Ethereum, Base, Arbitrum, Polygon, Optimism, Avalanche, BNB

get_mycelia_cot — COT Data ($1.00)

CFTC Commitments of Traders for Bitcoin CME futures. Weekly data, auto-refreshed Fridays.

get_mycelia_cot.invoke({})

DLC Oracle Tools

Register and query Bitcoin DLC (Discreet Log Contract) oracle events.

# Free preview
dlc_threshold_preview.invoke({"pair": "BTCUSD", "strike": 90000, "direction": "above"})

# Paid registration ($7.00)
dlc_register_threshold.invoke({"pair": "BTCUSD", "strike": 90000, "direction": "above"})
dlc_register_enum.invoke({"outcomes": ["below_70k", "70k_80k", "above_80k"], "event_id": "my-event", "maturity": 1750000000})
dlc_register_numeric.invoke({"event_id": "my-numeric", "maturity": 1750000000})

# Free queries
dlc_get_attestation.invoke({"event_id": "BTCUSD-2026-04-07T00:00:00Z"})
dlc_list_announcements.invoke({})

get_mycelia_synopsis — Market Synopsis ($0.25)

15-signal market state snapshot in one call. Layer 2 Oracle Information.

get_mycelia_synopsis.invoke({"query": "market"})

Includes: MSSI, MSTI, MSXI_BTC, MSVI_BTC, BTC/ETH/SOL spot prices, BTC funding, OI delta, liquidation flow dominant side, VWAP, basis regime, high-impact events today, next event timing.

get_mycelia_perp_regime — Perp Regime ($0.15)

10-signal perp trading regime classification for BTC, ETH, or SOL. Layer 2 Oracle Information.

get_mycelia_perp_regime.invoke({"currency": "BTC"})
get_mycelia_perp_regime.invoke({"currency": "ETH"})
get_mycelia_perp_regime.invoke({"currency": "SOL"})

Returns: regime (BULLISH_MOMENTUM, BEARISH_MOMENTUM, SQUEEZE_SETUP, LONG_TRAP, VOLATILITY_SPIKE...), bias (LONG/SHORT/NEUTRAL), confidence (0–1), risk level, signal notes.

get_mycelia_macro_risk — Macro Risk Score ($1.00)

Cross-domain macro risk score 0–100. Layer 3 Oracle Intelligence. Disclaimer included.

get_mycelia_macro_risk.invoke({"query": "market"})

Combines: MSSI crypto stress (40%) + MSTI contagion (30%) + economic calendar (30%). Regimes: LOW / MODERATE / ELEVATED / HIGH / CRITICAL.

get_mycelia_perp_setup — Perp Setup Scanner ($1.00)

Scans BTC, ETH, and SOL perp regimes simultaneously. Layer 3 Oracle Intelligence. Disclaimer included.

get_mycelia_perp_setup.invoke({"query": "scan"})

Returns: highest-confidence setup with signal_alignment (not buy/sell), edge, invalidation_conditions, market_bias. Only returns setups above minimum confidence threshold.

get_mycelia_defi_opportunity — DeFi Opportunity ($0.75)

Risk-adjusted DeFi yield across 15+ protocols. Layer 3 Oracle Intelligence. Disclaimer included.

get_mycelia_defi_opportunity.invoke({"query": "usdc"})

Returns: highest_opportunity with raw_apr, stress_penalty, risk_adjusted_apr. MSSI stress penalizes APR up to −4%, MSTI contagion adds −1% to −2% for cross-chain protocols.

get_mycelia_equity_index — Equity/TradFi Indices ($0.05)

Four equity market indices: stress, volatility, leadership, and breadth.

get_mycelia_equity_index.invoke({"index": "MESI"})  # Equity Stress Index 0-100
get_mycelia_equity_index.invoke({"index": "MNVI"})  # NQ Volatility Index 0-100
get_mycelia_equity_index.invoke({"index": "MSLI"})  # Leadership Index 0-100 (NEW S99)
get_mycelia_equity_index.invoke({"index": "MSBI"})  # Breadth Index 0-100 (NEW S99)

MESI: VIX (25%), credit spreads (25%), yield curve (20%), FRED STLFSI4 (15%), DXY (15%). 306s cadence. MNVI: Realized vol (28%), implied vol (28%), term structure (17%), skew (17%), PCR (10%). 114s cadence. MSLI: Growth vs Value IVW/IVE (25%), Tech vs Market XLK/SPY (25%), Small vs Large IWM/SPY (20%), Offensive vs Defensive sectors (15%), Cyclical vs Defensive sectors (15%). 0-100, >50=risk-on leadership. Regimes: RISK_ON/MILD_RISK_ON/NEUTRAL/MILD_DEFENSIVE/DEFENSIVE. 300s cache. MSBI: Sector participation % above 20DMA (40%), RSP/SPY breadth momentum (35%), SPY vs 20DMA deviation (25%). 0-100, >50=expanding breadth. Regimes: EXPANDING/IMPROVING/NEUTRAL/DETERIORATING/CONTRACTING. 300s cache.

get_mycelia_tradfi_regime — TradFi Regime ($0.10)

Layer 2 Oracle Information. Two TradFi regime classifiers.

get_mycelia_tradfi_regime.invoke({"regime": "EQUITY"})    # RISK_ON / NEUTRAL / STRESS / PANIC
get_mycelia_tradfi_regime.invoke({"regime": "LIQUIDITY"}) # DEEP / NORMAL / THIN / FRAGILE

EQUITY: Combines MESI + MNVI + FRED T10Y2Y yield curve. 300s cache. LIQUIDITY: Combines funding rates, OI, basis, liq-flow, orderbook depth. 60s cache.

get_mycelia_regime_change — Regime Change Detector ($0.50)

Layer 3 Oracle Intelligence. Detects perp regime transitions vs 2 hours ago.

get_mycelia_regime_change.invoke({"currency": "BTC"})
get_mycelia_regime_change.invoke({"currency": "ETH"})
get_mycelia_regime_change.invoke({"currency": "SOL"})

Returns: transition type, from/to regimes, duration, change magnitude. 30s cache.

get_mycelia_divergence — Cross-Asset Divergence ($0.50)

Layer 3 Oracle Intelligence. Measures crypto vs TradFi regime divergence.

get_mycelia_divergence.invoke({"query": "market"})

Levels: NONE / LOW / MODERATE / HIGH / EXTREME. Directions: aligned, crypto_bullish_tradfi_stressed, crypto_bearish_tradfi_complacent, crypto_leads_recovery, crypto_ignores_risk, tradfi_stressed_crypto_unmoved. Disclaimer included.

get_mycelia_consensus — Regime Consensus ($0.50)

Layer 3 Oracle Intelligence. Weighted vote across all regime classifiers.

get_mycelia_consensus.invoke({"query": "market"})

Strength: STRONG / MODERATE / WEAK / CONFLICTED. Theme: BULLISH / STRESSED / BEARISH / NEUTRAL / MIXED. Weights: BTC/ETH/SOL perp (1.0×), TradFi (1.5×), MSSI (1.0×), MSTI (0.5×), Macro (1.5×). Disclaimer included.

get_mycelia_regime_persistence — Regime Persistence ($0.15)

Layer 3 Oracle Intelligence. How long has the current regime been running, and how long does it typically last?

get_mycelia_regime_persistence.invoke({"currency": "BTC"})
get_mycelia_regime_persistence.invoke({"currency": "ETH"})
get_mycelia_regime_persistence.invoke({"currency": "SOL"})

Returns: current_regime, duration_hours, historical_percentile, typical_remaining_hours, longest/shortest_run_hours. Reads perp_history.db directly — no upstream HTTP calls. 30s cache. Disclaimer included.


Tool Subsets

from langchain_mycelia_signal import MyceliaSignalTools

tools = MyceliaSignalTools()
tools.as_list()            # All 33 tools
tools.price_tools()        # Just price/FX/macro
tools.index_tools()        # Just MSVI/MSXI/MSSI/MSTI
tools.equity_tools()       # MESI/MNVI/MSLI/MSBI + MSERC
tools.derivatives_tools()  # Funding, OI, basis, Greeks, term structure, SVI, IV surface
tools.data_tools()         # Weather, marine, gas, DeFi yield, COT
tools.regime_tools()       # Layer 2: synopsis, perp regime, TradFi regime
tools.intel_tools()        # All Layer 2 + Layer 3 tools (10 tools)
tools.dlc_tools()          # All 6 DLC tools

Links


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_mycelia_signal-2.7.0.tar.gz (85.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_mycelia_signal-2.7.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_mycelia_signal-2.7.0.tar.gz.

File metadata

  • Download URL: langchain_mycelia_signal-2.7.0.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for langchain_mycelia_signal-2.7.0.tar.gz
Algorithm Hash digest
SHA256 e01646413e38e926686ad430eb832367b0e552df88eedee052e9671f033aa81e
MD5 443916ee74448f4590e732c3405a35b1
BLAKE2b-256 5beffc9e8e2356eda6b22a0b86b314e91542cfd85b3a48060d071b3935fabb10

See more details on using hashes here.

File details

Details for the file langchain_mycelia_signal-2.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_mycelia_signal-2.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d66c3d9e1d6817641eefd5d1b052f145d9a1ce0718acbcc08f482ac07442f957
MD5 5fedd106a33c8fdfda9dfa076fa1c6e3
BLAKE2b-256 4bc6460b1df409a9a9fd6dbba5c9036660a061f7d194d9ea22968172b41d0c2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page