Skip to main content

LangChain tools for Mycelia Signal — 176 endpoints across four layers: prices, indices, derivatives, DeFi, compute, perp regime, macro risk, DeFi opportunity. Automatic x402 payment.

Project description

langchain-mycelia-signal

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

176 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), Layer 3 Oracle Intelligence (macro risk, perp setup, DeFi opportunity). 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()  # 22 tools covering 176 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?"})

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_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.


Tool Subsets

from langchain_mycelia_signal import MyceliaSignalTools

tools = MyceliaSignalTools()
tools.as_list()            # All 22 tools
tools.price_tools()        # Just price/FX/macro
tools.index_tools()        # Just MSVI/MSXI/MSSI/MSTI
tools.derivatives_tools()  # Funding, OI, basis
tools.data_tools()         # Weather, marine, gas, DeFi yield, COT
tools.intel_tools()        # Layer 2 + Layer 3 tools (synopsis, perp regime, macro risk, perp setup, DeFi opportunity)
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.4.0.tar.gz (74.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.4.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_mycelia_signal-2.4.0.tar.gz
  • Upload date:
  • Size: 74.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.4.0.tar.gz
Algorithm Hash digest
SHA256 9cbbb7e8cbb004da58b2a80c0bd2886981c46d2efc3c4694f39f4a906f9da36a
MD5 47005b2d4e76f4093a4b11a5c9340fe5
BLAKE2b-256 e23174edeed9aef58f3784946e289ffc2dae32aeedc50cddd5e31706cf3288f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mycelia_signal-2.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd078bf909ee3f37ebc6eca84355a3861074e9821492d21a80fb4fbc11d8785
MD5 47bce61dcaedc556923257edb1af4f81
BLAKE2b-256 d8de531f8c2b1d55ecd9282f39b18b25499dc4a00b84df0fd63f012cf94e02af

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