Skip to content

feat: historical asset pricing tool#214

Merged
premiumjibles merged 11 commits intomainfrom
feat/historical-asset-pricing
Mar 14, 2026
Merged

feat: historical asset pricing tool#214
premiumjibles merged 11 commits intomainfrom
feat/historical-asset-pricing

Conversation

@premiumjibles
Copy link
Contributor

@premiumjibles premiumjibles commented Mar 13, 2026

Summary

  • Adds getHistoricalPrices tool that fetches historical price data from CoinGecko's market_chart/range endpoint for one or more assets over a date range
  • Accepts the same {assetId?, searchTerm?, network?} input pattern as getAssetPrices, plus startDate, endDate, and dataPoints (1-30, default 2)
  • Returns evenly-spaced price points with computed startPrice, endPrice, and percentChange — enables questions like "what was ETH worth 2 months ago?" or "how much has BTC grown since January?"
  • Uses partial success pattern: individual asset failures don't fail the batch

Test plan

  • 7 unit tests for downsample utility (edge cases: empty, single element, boundary values)
  • 17 tests for getHistoricalPrices tool (schema validation, happy path, partial failure, API errors, empty data, parallel fetching, single data point)
  • Full test suite: 231/231 passing, 0 regressions
  • TypeScript type-check clean
  • Manual test: ask the agent "what was ETH worth 2 months ago?" and verify it uses getHistoricalPrices

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Historical price lookup tool: query multiple assets over custom date ranges with downsampled charts and summary metrics (start/end price, percent change). Now available in the tools menu.
  • UI Improvements

    • Improved Markdown rendering (bold/italic) and refined error message spacing.
  • Documentation

    • Added tickets describing transaction-history and parallel-swap issues; updated verification/testing guidance.
  • Tests

    • Added unit tests covering downsampling and historical-price tool behaviors.

premiumjibles and others added 8 commits March 13, 2026 09:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolves assets via AssetService search -> CAIP-19 -> CoinGecko ID,
fetches market_chart/range per coin in parallel, downsamples, and returns
start/end prices with percent change. Uses partial success pattern where
individual asset failures don't fail the batch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mock.module for @shapeshiftoss/utils was leaking into evmParser tests,
removing AssetService.getIcon. Now mocking only the local helper module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shapeshift-agentic Ready Ready Preview, Comment Mar 14, 2026 0:23am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d14d79a-cff1-4801-a22e-e6956b0d80c2

📥 Commits

Reviewing files that changed from the base of the PR and between 96af555 and ab58bc8.

📒 Files selected for processing (1)
  • CLAUDE.md

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

The PR adds a new getHistoricalPrices tool (schema, execution, CoinGecko range API integration, downsampling, results/errors), exports the new tool, introduces asset-resolution helpers and CoinGecko types, adds tests, removes numerous debug logs across many tools, tweaks two UI components, and adds three bug-report tickets.

Changes

Cohort / File(s) Summary
Historical Pricing Tool
apps/agentic-server/src/tools/getHistoricalPrices.ts, apps/agentic-server/src/tools/__tests__/getHistoricalPrices.test.ts
New tool with Zod schema, asset resolution, CoinGecko market_chart/range fetches, downsampling, per-asset result/error aggregation, and comprehensive tests.
CoinGecko API & Types
apps/agentic-server/src/lib/asset/coingecko/types.ts, apps/agentic-server/src/lib/asset/coingecko/api.ts, apps/agentic-server/src/lib/asset/coingecko/index.ts
Added MarketChartRangeResponse type, implemented getMarketChartRange() and re-exported them.
Downsampling & Asset Resolve
apps/agentic-server/src/lib/asset/coingecko/downsample.ts, apps/agentic-server/src/lib/asset/coingecko/__tests__/downsample.test.ts, apps/agentic-server/src/lib/asset/resolveAsset.ts
New downsample utility with tests; new helpers searchAsset and getAssetMeta to resolve assets/metadata and re-export CoinGecko mapping helper.
Tool Registration & Exports
apps/agentic-server/src/routes/chat.ts, apps/agentic-server/src/index.ts
Registered getHistoricalPricesTool in tools and exported the tool/execute/types from server index. Minor route UI mapping update.
Debug Log Cleanup
apps/agentic-server/src/tools/... (multiple)
apps/agentic-server/src/tools/getAllowance.ts, .../getAssetPrices.ts, .../getAssets.ts, .../getCategories.ts, .../getNewCoins.ts, .../getPriceFeedTokens.ts, .../getTopGainersLosers.ts, .../getTrendingPools.ts, .../getTrendingTokens.ts, .../mathCalculator.ts, .../receive.ts, .../send.ts, .../stopLoss/createStopLoss.ts, .../switchNetwork.ts
Removed console.log debug statements from many tool execute functions; no behavior changes.
UI Component Adjustments
apps/agentic-chat/src/components/Execution.tsx, apps/agentic-chat/src/components/Markdown.tsx
Added padding to error footer rendering and added strong/em rendering overrides for bold/italic styling.
Tests
apps/agentic-server/src/lib/asset/coingecko/__tests__/downsample.test.ts, apps/agentic-server/src/tools/__tests__/getHistoricalPrices.test.ts
Added unit tests for downsampling and extensive tests/mocks for getHistoricalPrices behavior and edge cases.
Asset Resolve Exports
apps/agentic-server/src/lib/asset/resolveAsset.ts
New helpers searchAsset and getAssetMeta and re-export of assetIdToCoingecko.
Tickets / Docs
.tickets/sa-besp.md, .tickets/sa-qczu.md, .tickets/sa-xwbn.md, CLAUDE.md
New bug-report tickets and documentation edits describing transaction-history and parallel-swap issues and the new historical-pricing feature; updated verification commands.

Sequence Diagram

sequenceDiagram
    actor User
    participant Tool as getHistoricalPrices Tool
    participant AssetSvc as Asset Service
    participant CoinGecko as CoinGecko API
    participant Processor as Downsample/Processor

    User->>Tool: request(assets, startDate, endDate, dataPoints)
    Tool->>Tool: validate input (Zod)
    loop per asset
        alt input.assetId
            Tool->>AssetSvc: getAssetMeta(assetId)
        else input.searchTerm
            Tool->>AssetSvc: searchAsset(searchTerm)
        end
        AssetSvc-->>Tool: assetId, symbol, name, coinGeckoId?
    end
    par parallel fetches
        loop per resolved asset
            Tool->>CoinGecko: getMarketChartRange(coinGeckoId, from, to)
            CoinGecko-->>Tool: market chart response
        end
    end
    loop per response
        Tool->>Processor: downsample(prices, dataPoints)
        Processor-->>Tool: sampled points
        Tool->>Tool: compute startPrice, endPrice, percentChange
    end
    Tool-->>User: results[] (successes and per-asset errors)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hoppity hops, the charts now sing,

Coins through time in an even ring,
Logs trimmed tidy, tests in flight,
Downsampled days and markets bright,
A rabbit cheers: data done right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: historical asset pricing tool' clearly and concisely summarizes the main change—adding a new tool for fetching historical price data. It is specific, avoids vague terminology, and aligns with the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/historical-asset-pricing
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add px-4 pb-4 padding to ErrorFooter in Execution.tsx so error text
aligns with the stepper content above it. Create tickets for parallel
swap execution failures (sa-qczu) and transaction history misclassification
(sa-besp).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@premiumjibles premiumjibles marked this pull request as ready for review March 14, 2026 00:18
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@premiumjibles premiumjibles merged commit 7a4596b into main Mar 14, 2026
1 of 3 checks passed
@premiumjibles premiumjibles deleted the feat/historical-asset-pricing branch March 14, 2026 00:22
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.

1 participant