42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
"""
|
|
CN (China) Market Data Fetcher
|
|
"""
|
|
import pandas as pd
|
|
from .base import DataFetcher
|
|
|
|
class CnFetcher(DataFetcher):
|
|
def __init__(self, api_key: str, data_source: str = 'Tushare'):
|
|
super().__init__(api_key)
|
|
self.data_source = data_source
|
|
|
|
if self.data_source == 'Tushare':
|
|
from app.clients.tushare_cn_client import TushareCnClient
|
|
self.client = TushareCnClient(api_key)
|
|
else:
|
|
# Default to Tushare
|
|
if self.data_source == 'Akshare':
|
|
raise NotImplementedError("Akshare client not yet implemented")
|
|
from app.clients.tushare_cn_client import TushareCnClient
|
|
self.client = TushareCnClient(api_key)
|
|
|
|
def get_income_statement(self, symbol: str) -> pd.DataFrame:
|
|
return self.client.get_income_statement(symbol)
|
|
|
|
def get_balance_sheet(self, symbol: str) -> pd.DataFrame:
|
|
return self.client.get_balance_sheet(symbol)
|
|
|
|
def get_cash_flow(self, symbol: str) -> pd.DataFrame:
|
|
return self.client.get_cash_flow(symbol)
|
|
|
|
def get_market_metrics(self, symbol: str) -> dict:
|
|
return self.client.get_market_metrics(symbol)
|
|
|
|
def get_historical_metrics(self, symbol: str, dates: list) -> pd.DataFrame:
|
|
return self.client.get_historical_metrics(symbol, dates)
|
|
|
|
def get_dividends(self, symbol: str) -> pd.DataFrame:
|
|
return self.client.get_dividends(symbol)
|
|
|
|
def get_repurchases(self, symbol: str) -> pd.DataFrame:
|
|
return self.client.get_repurchases(symbol)
|