1.kline基类实现

2.source基类实现
3.时间转换工具datetime convert实现
4.使用binance restapi获取数据实现
5.binance获取数据单元测试
This commit is contained in:
2025-12-05 17:13:20 +08:00
parent b1ffcf9456
commit 9a3769f862
6 changed files with 433 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
from abc import ABC, abstractmethod
import pandas as pd
class DataSource(ABC):
"""数据源基类"""
@abstractmethod
def try_connection(self):
"""尝试连接行情"""
pass
@abstractmethod
def get_historical_data(self, symbol: str, start_date: str, end_date: str, interval: str = "1d") :
"""获取历史数据"""
pass
@abstractmethod
def get_realtime_data(self, symbol: str) :
"""获取实时数据"""
pass