Releases: chuci-qin/quant1024
v0.3.0 - Multi-Source Data Retrieval with Backtest Optimization
π What's New in v0.3.0
β¨ Major Features
Multi-Source Data Retrieval
-
β DataRetriever - Unified interface for multiple data sources
- π¦ Exchange sources: 1024ex (β ), Binance, Coinbase, IBKR
- π Finance sources: Yahoo Finance (β ), Bloomberg, Alpha Vantage
- βοΈ Blockchain sources: Chainlink (framework), The Graph
-
β BacktestDataset - Optimized dataset for backtesting
- Batch retrieval for multiple symbols
- Train/test split functionality
- CSV import/export
- Data quality validation
Backtest Optimization
- β Data caching - Framework for caching historical data
- β Batch retrieval - Get multiple symbols in one call
- β Timestamp alignment - Critical for multi-asset backtest
- β Missing value handling - Forward fill for price data
- β Data validation - Remove duplicates and invalid data
- β Auto indicators - SMA (20, 50, 200), returns, log returns, volatility
- β Train/test split - Easy dataset splitting for backtesting
- β CSV support - Save and load datasets
Adapter Pattern Architecture
- β
BaseAdapter- Abstract interface for all data sources - β
ExchangeAdapter- Wraps exchange APIs (1024ex implemented) - β
FinanceAdapter- Wraps finance data APIs (Yahoo implemented) - β
BlockchainAdapter- Wraps blockchain data sources (framework)
Standardized DataFrame Output
All data sources return the same format:
DataFrame columns:
- timestamp (datetime): UTC time
- open, high, low, close (float): OHLC prices
- volume (float): trading volume
- source (str): data source name ("1024ex", "yahoo", etc.)
- provider_type (str): source type ("exchange", "finance", "blockchain")
- asset_class (str): asset type ("crypto", "stock", "index", "forex")π§ͺ Testing & Quality
- β 24 new tests for data retrieval module
- β 125 total tests (24 new + 101 existing)
- β 100% pass rate
- β Integration with Yahoo Finance tested
- β Backtest scenarios tested
- β Multi-source compatibility verified
π Documentation & Examples
- β
Complete backtest example (
examples/backtest_example.py) - β 6 usage scenarios demonstrated
- β Multi-source data comparison examples
- β Train/test split examples
- β Comprehensive API documentation
π¦ Installation
# Basic installation
pip install quant1024==0.3.0
# With Yahoo Finance support
pip install quant1024[yahoo]==0.3.0
# With blockchain support
pip install quant1024[blockchain]==0.3.0
# With all optional features
pip install quant1024[all]==0.3.0π Quick Start
Basic Usage
from quant1024 import DataRetriever
# Get data from 1024ex
data = DataRetriever(source="1024ex", api_key="...", api_secret="...")
btc = data.get_klines("BTC-PERP", interval="1d", days=365)
# Get data from Yahoo Finance (free, no auth required)
data = DataRetriever(source="yahoo")
aapl = data.get_klines("AAPL", interval="1d", days=365)
# Data comes with metadata
print(btc['source'].iloc[0]) # "1024ex"
print(btc['provider_type'].iloc[0]) # "exchange"
print(btc['asset_class'].iloc[0]) # "crypto"Backtest Dataset
from quant1024 import BacktestDataset
# Create backtest dataset
dataset = BacktestDataset(
source="yahoo",
symbols=["BTC-USD", "ETH-USD", "AAPL", "SPY"],
interval="1d",
days=365,
enable_cache=True
)
# Load all data
data_dict = dataset.load(
fill_missing=True,
validate_data=True,
add_indicators=True,
align_timestamps=True # Critical for multi-asset backtest
)
# Split for training and testing
train, test = dataset.split(train_ratio=0.8)
# Get summary
summary = dataset.get_summary()
print(summary)Multi-Source Comparison
from quant1024 import DataRetriever
import pandas as pd
# From 1024ex
data_1024 = DataRetriever(source="1024ex", api_key="...", api_secret="...")
btc_1024 = data_1024.get_klines("BTC-PERP", interval="1h", days=7)
# From Yahoo Finance
data_yahoo = DataRetriever(source="yahoo")
btc_yahoo = data_yahoo.get_klines("BTC-USD", interval="1h", days=7)
# Compare prices
df_all = pd.concat([btc_1024, btc_yahoo])
comparison = df_all.groupby('source')['close'].agg(['mean', 'min', 'max'])
print(comparison)π§ Technical Details
New Dependencies
Required:
pandas>=2.0.0- DataFrame operationsnumpy>=1.24.0- Numerical computing
Optional:
yfinance>=0.2.0- Yahoo Finance supportweb3>=6.0.0- Blockchain support
Supported Data Sources
| Source | Type | Asset Classes | Auth Required | Free | Status |
|---|---|---|---|---|---|
| 1024ex | exchange | crypto | β | β | β Implemented |
| Yahoo Finance | finance | all | β | β | β Implemented |
| Binance | exchange | crypto | β | β | π Planned |
| Chainlink | blockchain | crypto | β | β | π Framework |
| Bloomberg | finance | all | β | β | π Planned |
| IBKR | broker | all | β | β | π Planned |
Supported Time Intervals
1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1w
π Links
- PyPI: https://pypi.org/project/quant1024/
- GitHub: https://github.com/chuci-qin/quant1024
- Documentation: https://github.com/chuci-qin/quant1024#readme
- Issues: https://github.com/chuci-qin/quant1024/issues
π Statistics
- Files Changed: 13 files
- Lines Added: 2,170 insertions
- New Tests: 24 tests
- Total Tests: 125 tests (100% pass)
- Code Quality: Fully type-annotated
π Breaking Changes
None. v0.3.0 is fully backward compatible with v0.2.0.
All v0.2.0 features continue to work:
- β Exchange1024ex - 38 API endpoints
- β HMAC authentication
- β Pydantic models
- β Exception handling
π Acknowledgments
Thanks to all contributors and users for feedback and support!
Full Changelog: v0.2.0...v0.3.0
v0.2.0 - Add 1024ex Exchange Support
π What's New in v0.2.0
β¨ Major Features
Complete 1024ex Exchange Integration
- β
38 API endpoints fully implemented
- System interfaces (3): Server time, health check, exchange info
- Market data (8): Markets, ticker, orderbook, trades, klines, funding rate, stats
- Trading (8): Place/cancel/update orders, batch operations, TP/SL
- Account (6): Balance, positions, margin, leverage, sub-accounts
- Funding (4): Deposit, withdraw, history
- Historical data (5): Order/trade/funding/liquidation history, PnL
- Smart ADL (4): Config, protection pool, history
Cross-Exchange Architecture
- β
BaseExchangeabstract class for unified interface - β Seamless switching between exchanges (1024ex, Binance, IBKR in future)
- β Modular design for easy extension
Security & Authentication
- β HMAC-SHA256 authentication module
- β Automatic signature generation
- β Retry mechanism with exponential backoff
- β Rate limit handling
Type Safety
- β 13 Pydantic data models
- β Full type annotations
- β Runtime validation
Error Handling
- β Comprehensive exception system (8 exception classes)
- β Detailed error messages
- β Graceful degradation
π§ͺ Testing & Quality
- β 101 tests passing (83 new + 18 existing)
- β 100% API endpoint coverage
- β
Mock testing with
responseslibrary - β Integration testing verified
- β Independent project integration audit passed
π Documentation
- β Comprehensive API documentation
- β Usage examples and tutorials
- β Complete integration guide
- β Audit report and testing documentation
π§ Technical Details
Dependencies
requests>=2.31.0pydantic>=2.0.0
Python Support
- Python 3.8+
- Python 3.9, 3.10, 3.11, 3.12 tested
π¦ Installation
pip install quant1024==0.2.0π Quick Start
from quant1024 import Exchange1024ex
# Initialize client
client = Exchange1024ex(
api_key="your_api_key",
api_secret="your_api_secret"
)
# Get markets
markets = client.get_markets()
# Get ticker
ticker = client.get_ticker("BTC-PERP")
print(f"BTC Price: {ticker['last_price']}")
# Place order
order = client.place_order(
market="BTC-PERP",
side="buy",
order_type="limit",
price="60000",
size="0.01"
)π Links
- PyPI: https://pypi.org/project/quant1024/
- GitHub: https://github.com/chuci-qin/quant1024
- Documentation: https://github.com/chuci-qin/quant1024#readme
- Issues: https://github.com/chuci-qin/quant1024/issues
π Statistics
- Files Changed: 16 files
- Lines Added: 2,681 insertions
- API Endpoints: 38/38 (100%)
- Test Coverage: 101/101 (100%)
- Code Quality: Fully type-annotated
π Acknowledgments
Thanks to all contributors and the 1024 Exchange team for making this release possible!
Full Changelog: v0.1.0...v0.2.0