Team Ai
Apppublic

diegobeyl/backtesting

sourceHugging Faceupdated 9mo agoView on Hugging Face
2likes
test_4h_data.py41 linesDownload Raw Back to tests
1#!/usr/bin/env python32"""3Test para verificar carga de datos en 4h4"""5 6import sys7import os8from pathlib import Path9 10# Configurar path para importar desde backtesting_app11sys.path.insert(0, str(Path(__file__).parent / 'backtesting_app'))12 13import pandas as pd14from core.data_loader import DataLoader15from datetime import datetime, timedelta16 17# Descargar datos en 4h18print("Descargando BTC-USD en 4h...")19end_date = datetime.now().strftime('%Y-%m-%d')20start_date = (datetime.now() - timedelta(days=90)).strftime('%Y-%m-%d')21 22df = DataLoader.download(23    symbol='BTC-USD',24    interval='4h',25    start_date=start_date,26    end_date=end_date,27    source='yahoo'28)29 30print(f"\nVelas obtenidas: {len(df)}")31print(f"Fecha inicial: {df.index[0] if len(df) > 0 else 'N/A'}")32print(f"Fecha final: {df.index[-1] if len(df) > 0 else 'N/A'}")33print(f"\nPrimeras velas:")34print(df.head(10))35print(f"\nÚltimas velas:")36print(df.tail(10))37print(f"\nInfo del DataFrame:")38print(df.info())39print(f"\nValores nulos:")40print(df.isnull().sum())41