Welcome to the Hedgehog Edge API
The Hedgehog Edge Data API provides institutional-grade historical OHLCV data paired with deeply calculated technical indicators (MACD, RSI, Ichimoku, Bollinger Bands, and more) specifically formatted for crypto backtesting and algorithmic trading.Autonomous Payments with x402
We do not use traditional API keys, monthly subscriptions, or fiat credit cards. Our API is built entirely on the x402 protocol. This allows trading algorithms and AI agents to autonomously pay for data on a strictly per-request basis. Payments are settled instantly in USDC on the Base network (Ethereum Layer 2). You only pay for the exact amount of data rows you request.Why x402?
- π€ AI-Native: Perfect for autonomous agents and algorithmic systems
- π° Pay-Per-Use: No subscriptions, no unused quota, no wasted money
- β‘ Instant Settlement: Sub-second payment confirmation on Base L2
- π No API Keys: No credentials to manage, rotate, or secure
- π Decentralized: Direct wallet-to-wallet payments, no intermediaries
Base API URL
All API requests should be directed to our dedicated x402 data server:Prerequisites
Before you begin, ensure you have:- Node.js (v16 or higher)
- An Ethereum wallet with a private key
- USDC on Base Mainnet (~$0.10+ for testing)
- ETH on Base Mainnet (~$0.01+ for gas fees)
Quickstart: Fetching Paid Data
To interact with our API, you or your AI agent will need an Ethereum-compatible wallet funded with USDC on Base, and the official x402 SDK to handle the cryptographic payment handshake.1. Install Dependencies
Install the required x402 packages and a Web3 wallet handler (likeviem) in your Node.js environment:
2. Configure Your Environment
Create a.env file in your project root:
.env file to version control! Add it to .gitignore.
3. Implement the Client
The x402 SDK automatically intercepts our402 Payment Required response, calculates the dynamic price based on your requested data range, signs the USDC transfer with your private key, and retries the request to fetch the data.
Here is the complete implementation to fetch 1-hour BTC/USD data:
4. Run Your Script
Understanding the Payment Flow
When you make a request, hereβs what happens behind the scenes:- Initial Request: Your client makes a GET request to our API
- 402 Payment Required: Server responds with payment instructions (amount, wallet address, asset)
- SDK Negotiation: x402 SDK parses the payment requirement
- USDC Transfer: SDK executes USDC payment on Base mainnet using your wallet
- Payment Proof: SDK creates cryptographic proof of payment
- Retry with Proof: SDK retries the original request with payment proof
- Data Delivery: Server validates payment and returns your data
Dynamic Pricing
Our pricing is calculated dynamically based on the volume of data you request.Cost Factors
- Number of rows: Based on the date range and interval
- Indicators requested: More indicators = slightly higher cost
- Timeframe: Hourly data costs more than daily (more rows)
Example Costs
- 24 hours of 1h data with all indicators: ~$0.10 USDC
- 7 days of 1d data with specific indicators: ~$0.05 USDC
- 1 month of 4h data with basic indicators: ~$0.15 USDC
Verification
The precise USDC amount required will be transmitted to your client during the initial 402 HTTP handshake. The x402 SDK displays this before proceeding with payment.Available Timeframes
The API supports 5 different timeframes:| Interval | Endpoint Path | Use Case |
|---|---|---|
| 1 hour | /api/data/1h | Day trading, scalping |
| 4 hours | /api/data/4h | Swing trading |
| 12 hours | /api/data/12h | Multi-day positions |
| 1 day | /api/data/1d | Position trading |
| 1 week | /api/data/1w | Long-term investing |
Request Parameters
Required Parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
symbol | string | "BTC/USD" | Trading pair symbol |
startDate | string | "2025-01-01" | Start date (YYYY-MM-DD) |
endDate | string | "2025-01-31" | End date (YYYY-MM-DD) |
Optional Parameters
| Parameter | Type | Default | Example | Description |
|---|---|---|---|---|
indicators | string | Limited set | "sma20,rsi14,macd_line" | Comma-separated indicator list or "all" |
limit | integer | 100 | 500 | Maximum records to return |
offset | integer | 0 | 0 | Pagination offset (not recommended with x402) |
Indicator Examples
Response Structure
Successful responses follow this structure:Supported Symbols
We support most major cryptocurrency trading pairs with USD: Major Pairs: BTC/USD, ETH/USD, SOL/USD, BNB/USD, XRP/USD, ADA/USD, DOGE/USD DeFi Tokens: UNI/USD, LINK/USD, AAVE/USD, MATIC/USD, AVAX/USD Layer 1s: DOT/USD, ATOM/USD, NEAR/USD, APT/USD And many more! To check if a symbol is available, make a small test request (1-2 days of data).Error Handling
Always implement proper error handling in production:Next Steps
Now that you can connect to the API, explore our documentation to unlock the full power of the platform:π Documentation
- Indicator Reference - Complete catalog of all 110+ technical indicators
- API Documentation - Comprehensive API reference with advanced examples
- x402 Testing Guide - Deep dive into x402 payment testing
π― Common Use Cases
For Day Traders:Best Practices
π Security
- Never hardcode private keys in your source code
- Use environment variables (
.envfiles) - Add
.envto.gitignore - Use dedicated wallets for API payments (not your main holdings)
π° Cost Optimization
- Request specific indicators instead of
"all"when possible - Use appropriate timeframes (daily instead of hourly for long-term analysis)
- Cache historical data (it doesnβt change!)
β‘ Performance
- Set appropriate timeouts (30 seconds recommended)
- Implement retry logic for network errors
- Validate parameters before sending requests
Support & Community
Need help? Weβve got you covered:- π Read the Docs: Start with INDICATOR-REFERENCE.md
- π§ͺ Test Locally: Use small date ranges to experiment
- π¬ Issues: Report bugs or request features via GitHub Issues
Legal & Disclaimer
This API provides data for informational and research purposes only. Not financial advice. Cryptocurrency trading carries significant risk. Always conduct your own research (DYOR) before making trading decisions. All payments are final and non-refundable. Ensure you have correct parameters before requesting data.Ready to build? Start with a simple request and explore from there. Happy coding! π