Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:HKUDS AI Trader Get Daily Price Crypto

From Leeroopedia


Knowledge Sources
Domains Data_Engineering, Financial_Data, Cryptocurrency
Last Updated 2026-02-09 14:00 GMT

Overview

Concrete tool for fetching daily cryptocurrency OHLCV data from Alpha Vantage API, wrapping the internal get_crypto_daily_price function.

Description

The get_daily_price function in the crypto module is a thin wrapper around get_crypto_daily_price that delegates to Alpha Vantage's DIGITAL_CURRENCY_DAILY endpoint. It backs up existing data before fetching, merges new data with historical records, and converts the response to a standardized JSON format compatible with the rest of the data pipeline.

Usage

Import and call this function when populating the crypto data directory with daily price data for major cryptocurrencies. Typically called in a loop over the 10-coin universe (BTC, ETH, XRP, SOL, ADA, SUI, LINK, AVAX, LTC, DOT).

Code Reference

Source Location

  • Repository: AI-Trader
  • File: data/crypto/get_daily_price_crypto.py
  • Lines: L324-329

Signature

def get_daily_price(symbol: str):
    """
    Fetches daily crypto OHLCV from Alpha Vantage and saves to JSON.

    Args:
        symbol: Cryptocurrency symbol (e.g. "BTC", "ETH")

    Returns:
        None. Delegates to get_crypto_daily_price(symbol, market="USD")
    """

Import

from data.crypto.get_daily_price_crypto import get_daily_price

I/O Contract

Inputs

Name Type Required Description
symbol str Yes Cryptocurrency symbol (e.g. "BTC", "ETH", "SOL")
ALPHAADVANTAGE_API_KEY str (env) Yes Alpha Vantage API key from environment

Outputs

Name Type Description
daily_prices_{SYMBOL}.json File JSON file in data/crypto/coin/ with merged OHLCV data

Usage Examples

Fetch All Crypto Prices

from data.crypto.get_daily_price_crypto import get_daily_price

crypto_symbols = ["BTC", "ETH", "XRP", "SOL", "ADA", "SUI", "LINK", "AVAX", "LTC", "DOT"]

for symbol in crypto_symbols:
    get_daily_price(symbol)
    # Creates: data/crypto/coin/daily_prices_{symbol}.json

Related Pages

Requires Environment

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment