1.kline基类实现
2.source基类实现 3.时间转换工具datetime convert实现 4.使用binance restapi获取数据实现 5.binance获取数据单元测试
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user