lixinger-python 0.2.0__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. lixinger/__init__.py +10 -12
  2. lixinger/api/cn/company/__init__.py +0 -3
  3. lixinger/api/cn/company/company.py +9 -5
  4. lixinger/api/cn/company/dividend.py +34 -8
  5. lixinger/api/cn/company/equity_change.py +11 -7
  6. lixinger/api/cn/company/fundamental/__init__.py +47 -0
  7. lixinger/api/cn/company/fundamental/bank.py +114 -0
  8. lixinger/api/cn/company/fundamental/insurance.py +114 -0
  9. lixinger/api/cn/company/fundamental/non_financial.py +114 -0
  10. lixinger/api/cn/company/fundamental/other_financial.py +114 -0
  11. lixinger/api/cn/company/fundamental/security.py +114 -0
  12. lixinger/api/cn/company/namespace.py +66 -7
  13. lixinger/api/cn/company/profile.py +9 -5
  14. lixinger/api/cn/index/tracking_fund.py +9 -3
  15. lixinger/client.py +19 -4
  16. lixinger/models/cn/company/__init__.py +12 -2
  17. lixinger/models/cn/company/dividend.py +28 -2
  18. lixinger/models/cn/company/fundamental/__init__.py +15 -0
  19. lixinger/models/cn/company/{fundamental.py → fundamental/bank.py} +3 -3
  20. lixinger/models/cn/company/fundamental/insurance.py +16 -0
  21. lixinger/models/cn/company/fundamental/non_financial.py +16 -0
  22. lixinger/models/cn/company/fundamental/other_financial.py +16 -0
  23. lixinger/models/cn/company/fundamental/security.py +16 -0
  24. {lixinger_python-0.2.0.dist-info → lixinger_python-0.3.1.dist-info}/METADATA +1 -1
  25. {lixinger_python-0.2.0.dist-info → lixinger_python-0.3.1.dist-info}/RECORD +27 -17
  26. lixinger/api/cn/company/fundamental.py +0 -228
  27. {lixinger_python-0.2.0.dist-info → lixinger_python-0.3.1.dist-info}/WHEEL +0 -0
  28. {lixinger_python-0.2.0.dist-info → lixinger_python-0.3.1.dist-info}/licenses/LICENSE +0 -0
lixinger/__init__.py CHANGED
@@ -2,12 +2,11 @@ from lixinger.api.cn.company import get_company, get_equity_change, get_profile
2
2
  from lixinger.api.cn.company.candlestick import get_candlestick
3
3
  from lixinger.api.cn.company.fs.non_financial import get_non_financial_statements
4
4
  from lixinger.api.cn.company.fundamental import (
5
- get_bank,
6
- get_fundamental,
7
- get_insurance,
8
- get_non_financial,
9
- get_other_financial,
10
- get_security,
5
+ get_bank_fundamental,
6
+ get_insurance_fundamental,
7
+ get_non_financial_fundamental,
8
+ get_other_financial_fundamental,
9
+ get_security_fundamental,
11
10
  )
12
11
  from lixinger.api.cn.company.indices import get_indices
13
12
  from lixinger.api.cn.fund import (
@@ -70,10 +69,9 @@ __all__ = [
70
69
  "get_index_candlestick",
71
70
  "get_index_drawdown",
72
71
  "get_non_financial_statements",
73
- "get_fundamental",
74
- "get_non_financial",
75
- "get_bank",
76
- "get_insurance",
77
- "get_security",
78
- "get_other_financial",
72
+ "get_non_financial_fundamental",
73
+ "get_bank_fundamental",
74
+ "get_insurance_fundamental",
75
+ "get_security_fundamental",
76
+ "get_other_financial_fundamental",
79
77
  ]
@@ -5,7 +5,6 @@ from lixinger.api.cn.company.candlestick import CandlestickAPI, get_candlestick
5
5
  from lixinger.api.cn.company.company import CompanyAPI, get_company
6
6
  from lixinger.api.cn.company.dividend import DividendAPI, get_dividend
7
7
  from lixinger.api.cn.company.equity_change import EquityChangeAPI, get_equity_change
8
- from lixinger.api.cn.company.fundamental import FundamentalAPI
9
8
  from lixinger.api.cn.company.indices import IndicesAPI, get_indices
10
9
  from lixinger.api.cn.company.profile import CompanyProfileAPI, get_profile
11
10
 
@@ -18,8 +17,6 @@ __all__ = [
18
17
  # Equity
19
18
  "EquityChangeAPI",
20
19
  "get_equity_change",
21
- # Fundamental
22
- "FundamentalAPI",
23
20
  # Market data
24
21
  "CandlestickAPI",
25
22
  "get_candlestick",
@@ -36,11 +36,15 @@ class CompanyAPI(BaseAPI):
36
36
  包含股票详细信息的 DataFrame
37
37
 
38
38
  Example:
39
- >>> client = LixingerClient()
40
- >>> df = client.company.company.get_company(
41
- ... stock_codes=["000001", "600036"]
42
- ... )
43
- >>> print(df.head())
39
+ 获取股票信息::
40
+
41
+ from lixinger import AsyncLixingerClient
42
+
43
+ async with AsyncLixingerClient() as client:
44
+ df = await client.company.company.get_company(
45
+ stock_codes=["000001", "600036"]
46
+ )
47
+ print(df)
44
48
 
45
49
  """
46
50
  payload: dict[str, Any] = {}
@@ -14,27 +14,47 @@ class DividendAPI(BaseAPI):
14
14
  async def get_dividend(
15
15
  self,
16
16
  stock_code: str,
17
- start_date: str | None = None,
17
+ start_date: str,
18
18
  end_date: str | None = None,
19
+ limit: int | None = None,
19
20
  ) -> pd.DataFrame:
20
21
  """获取分红数据.
21
22
 
22
23
  API Endpoint: /cn/company/dividend
23
24
  API Method: POST
25
+ Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/company/dividend
24
26
 
25
27
  Args:
26
28
  stock_code: 股票代码
27
- start_date: 开始日期 (YYYY-MM-DD)
28
- end_date: 结束日期 (YYYY-MM-DD)
29
+ start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
30
+ end_date: 结束日期 (YYYY-MM-DD), 可选。默认值是上周一
31
+ limit: 返回最近数据的数量, 可选
32
+
33
+ Returns:
34
+ 包含分红数据的 DataFrame
35
+
36
+ Example:
37
+ 获取分红数据::
38
+
39
+ from lixinger import AsyncLixingerClient
40
+
41
+ async with AsyncLixingerClient() as client:
42
+ df = await client.company.dividend.get_dividend(
43
+ stock_code="600036",
44
+ start_date="2023-01-01",
45
+ end_date="2024-01-01"
46
+ )
47
+ print(df)
29
48
 
30
49
  """
31
50
  payload: dict[str, Any] = {
32
51
  "stockCode": stock_code,
52
+ "startDate": start_date,
33
53
  }
34
- if start_date is not None:
35
- payload["startDate"] = start_date
36
54
  if end_date is not None:
37
55
  payload["endDate"] = end_date
56
+ if limit is not None:
57
+ payload["limit"] = limit
38
58
 
39
59
  data = await self._request("POST", "/cn/company/dividend", json=payload)
40
60
  for item in data:
@@ -49,19 +69,25 @@ _api_instance = DividendAPI()
49
69
  @api
50
70
  async def get_dividend(
51
71
  stock_code: str,
52
- start_date: str | None = None,
72
+ start_date: str,
53
73
  end_date: str | None = None,
74
+ limit: int | None = None,
54
75
  ) -> pd.DataFrame:
55
76
  """获取分红数据.
56
77
 
57
78
  Args:
58
79
  stock_code: 股票代码
59
- start_date: 开始日期 (YYYY-MM-DD)
60
- end_date: 结束日期 (YYYY-MM-DD)
80
+ start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
81
+ end_date: 结束日期 (YYYY-MM-DD), 可选。默认值是上周一
82
+ limit: 返回最近数据的数量, 可选
83
+
84
+ Returns:
85
+ 包含分红数据的 DataFrame
61
86
 
62
87
  """
63
88
  return await _api_instance.get_dividend(
64
89
  stock_code=stock_code,
65
90
  start_date=start_date,
66
91
  end_date=end_date,
92
+ limit=limit,
67
93
  )
@@ -34,13 +34,17 @@ class EquityChangeAPI(BaseAPI):
34
34
  包含股本变动信息的 DataFrame
35
35
 
36
36
  Example:
37
- >>> client = LixingerClient()
38
- >>> df = client.company.equity_change.get_equity_change(
39
- ... stock_code="000001",
40
- ... start_date="2023-01-01",
41
- ... end_date="2023-12-31"
42
- ... )
43
- >>> print(df.head())
37
+ 获取股本变动信息::
38
+
39
+ from lixinger import AsyncLixingerClient
40
+
41
+ async with AsyncLixingerClient() as client:
42
+ df = await client.company.equity_change.get_equity_change(
43
+ stock_code="000001",
44
+ start_date="2023-01-01",
45
+ end_date="2023-12-31"
46
+ )
47
+ print(df)
44
48
 
45
49
  """
46
50
  payload: dict[str, Any] = {
@@ -0,0 +1,47 @@
1
+ """Fundamental data APIs.
2
+
3
+ This module provides access to fundamental data APIs for different types of companies:
4
+ - Non-financial companies (非金融企业)
5
+ - Banks (银行)
6
+ - Insurance companies (保险)
7
+ - Securities companies (证券)
8
+ - Other financial companies (其他金融)
9
+
10
+ Each company type has its own dedicated API endpoint and data model.
11
+ """
12
+
13
+ from lixinger.api.cn.company.fundamental.bank import (
14
+ BankFundamentalAPI,
15
+ get_bank_fundamental,
16
+ )
17
+ from lixinger.api.cn.company.fundamental.insurance import (
18
+ InsuranceFundamentalAPI,
19
+ get_insurance_fundamental,
20
+ )
21
+ from lixinger.api.cn.company.fundamental.non_financial import (
22
+ NonFinancialFundamentalAPI,
23
+ get_non_financial_fundamental,
24
+ )
25
+ from lixinger.api.cn.company.fundamental.other_financial import (
26
+ OtherFinancialFundamentalAPI,
27
+ get_other_financial_fundamental,
28
+ )
29
+ from lixinger.api.cn.company.fundamental.security import (
30
+ SecurityFundamentalAPI,
31
+ get_security_fundamental,
32
+ )
33
+
34
+ __all__ = [
35
+ # API Classes
36
+ "BankFundamentalAPI",
37
+ "InsuranceFundamentalAPI",
38
+ "NonFinancialFundamentalAPI",
39
+ "OtherFinancialFundamentalAPI",
40
+ "SecurityFundamentalAPI",
41
+ # Functional APIs
42
+ "get_bank_fundamental",
43
+ "get_insurance_fundamental",
44
+ "get_non_financial_fundamental",
45
+ "get_other_financial_fundamental",
46
+ "get_security_fundamental",
47
+ ]
@@ -0,0 +1,114 @@
1
+ """Bank fundamental data APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.company.fundamental.bank import BankFundamentalSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class BankFundamentalAPI(BaseAPI):
14
+ """Bank fundamental data APIs."""
15
+
16
+ async def get_bank_fundamental(
17
+ self,
18
+ stock_codes: list[str],
19
+ metrics: list[str],
20
+ date: str | None = None,
21
+ start_date: str | None = None,
22
+ end_date: str | None = None,
23
+ ) -> pd.DataFrame:
24
+ """获取银行基本面数据.
25
+
26
+ API Endpoint: /cn/company/fundamental/bank
27
+ API Method: POST
28
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fundamental/bank
29
+
30
+ Args:
31
+ stock_codes: 股票代码列表
32
+ metrics: 指标列表
33
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
34
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
35
+ end_date: 结束日期 (YYYY-MM-DD), 可选
36
+
37
+ Returns:
38
+ 包含银行基本面数据的 DataFrame
39
+
40
+ Example:
41
+ 获取招商银行的估值指标::
42
+
43
+ from lixinger import AsyncLixingerClient
44
+
45
+ async with AsyncLixingerClient() as client:
46
+ df = await client.company.fundamental.bank.get_bank_fundamental(
47
+ stock_codes=["600036"],
48
+ metrics=["pe_ttm", "pb", "roe"],
49
+ start_date="2023-01-01",
50
+ end_date="2023-12-31"
51
+ )
52
+ print(df)
53
+
54
+ """
55
+ payload: dict[str, Any] = {
56
+ "stockCodes": stock_codes,
57
+ "metricsList": metrics,
58
+ }
59
+ if date is not None:
60
+ payload["date"] = date
61
+ if start_date is not None:
62
+ payload["startDate"] = start_date
63
+ if end_date is not None:
64
+ payload["endDate"] = end_date
65
+
66
+ data = await self._request("POST", "/cn/company/fundamental/bank", json=payload)
67
+ return get_response_df(data, BankFundamentalSchema)
68
+
69
+
70
+ # Functional API instance
71
+ _api_instance = BankFundamentalAPI()
72
+
73
+
74
+ @api
75
+ async def get_bank_fundamental(
76
+ stock_codes: list[str],
77
+ metrics: list[str],
78
+ date: str | None = None,
79
+ start_date: str | None = None,
80
+ end_date: str | None = None,
81
+ ) -> pd.DataFrame:
82
+ """获取银行基本面数据.
83
+
84
+ Args:
85
+ stock_codes: 股票代码列表
86
+ metrics: 指标列表
87
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
88
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
89
+ end_date: 结束日期 (YYYY-MM-DD), 可选
90
+
91
+ Returns:
92
+ 包含银行基本面数据的 DataFrame
93
+
94
+ Example:
95
+ 获取招商银行的估值指标::
96
+
97
+ from lixinger import get_bank_fundamental
98
+
99
+ df = await get_bank_fundamental(
100
+ stock_codes=["600036"],
101
+ metrics=["pe_ttm", "pb", "roe"],
102
+ start_date="2023-01-01",
103
+ end_date="2023-12-31"
104
+ )
105
+ print(df)
106
+
107
+ """
108
+ return await _api_instance.get_bank_fundamental(
109
+ stock_codes=stock_codes,
110
+ metrics=metrics,
111
+ date=date,
112
+ start_date=start_date,
113
+ end_date=end_date,
114
+ )
@@ -0,0 +1,114 @@
1
+ """Insurance company fundamental data APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.company.fundamental.insurance import InsuranceFundamentalSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class InsuranceFundamentalAPI(BaseAPI):
14
+ """Insurance company fundamental data APIs."""
15
+
16
+ async def get_insurance_fundamental(
17
+ self,
18
+ stock_codes: list[str],
19
+ metrics: list[str],
20
+ date: str | None = None,
21
+ start_date: str | None = None,
22
+ end_date: str | None = None,
23
+ ) -> pd.DataFrame:
24
+ """获取保险企业基本面数据.
25
+
26
+ API Endpoint: /cn/company/fundamental/insurance
27
+ API Method: POST
28
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fundamental/insurance
29
+
30
+ Args:
31
+ stock_codes: 股票代码列表
32
+ metrics: 指标列表
33
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
34
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
35
+ end_date: 结束日期 (YYYY-MM-DD), 可选
36
+
37
+ Returns:
38
+ 包含保险企业基本面数据的 DataFrame
39
+
40
+ Example:
41
+ 获取中国平安的估值指标::
42
+
43
+ from lixinger import AsyncLixingerClient
44
+
45
+ async with AsyncLixingerClient() as client:
46
+ df = await client.company.fundamental.insurance.get_insurance_fundamental(
47
+ stock_codes=["601318"],
48
+ metrics=["pe_ttm", "pb"],
49
+ start_date="2023-01-01",
50
+ end_date="2023-12-31"
51
+ )
52
+ print(df)
53
+
54
+ """
55
+ payload: dict[str, Any] = {
56
+ "stockCodes": stock_codes,
57
+ "metricsList": metrics,
58
+ }
59
+ if date is not None:
60
+ payload["date"] = date
61
+ if start_date is not None:
62
+ payload["startDate"] = start_date
63
+ if end_date is not None:
64
+ payload["endDate"] = end_date
65
+
66
+ data = await self._request("POST", "/cn/company/fundamental/insurance", json=payload)
67
+ return get_response_df(data, InsuranceFundamentalSchema)
68
+
69
+
70
+ # Functional API instance
71
+ _api_instance = InsuranceFundamentalAPI()
72
+
73
+
74
+ @api
75
+ async def get_insurance_fundamental(
76
+ stock_codes: list[str],
77
+ metrics: list[str],
78
+ date: str | None = None,
79
+ start_date: str | None = None,
80
+ end_date: str | None = None,
81
+ ) -> pd.DataFrame:
82
+ """获取保险企业基本面数据.
83
+
84
+ Args:
85
+ stock_codes: 股票代码列表
86
+ metrics: 指标列表
87
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
88
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
89
+ end_date: 结束日期 (YYYY-MM-DD), 可选
90
+
91
+ Returns:
92
+ 包含保险企业基本面数据的 DataFrame
93
+
94
+ Example:
95
+ 获取中国平安的估值指标::
96
+
97
+ from lixinger import get_insurance_fundamental
98
+
99
+ df = await get_insurance_fundamental(
100
+ stock_codes=["601318"],
101
+ metrics=["pe_ttm", "pb"],
102
+ start_date="2023-01-01",
103
+ end_date="2023-12-31"
104
+ )
105
+ print(df)
106
+
107
+ """
108
+ return await _api_instance.get_insurance_fundamental(
109
+ stock_codes=stock_codes,
110
+ metrics=metrics,
111
+ date=date,
112
+ start_date=start_date,
113
+ end_date=end_date,
114
+ )
@@ -0,0 +1,114 @@
1
+ """Non-financial company fundamental data APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.company.fundamental.non_financial import NonFinancialFundamentalSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class NonFinancialFundamentalAPI(BaseAPI):
14
+ """Non-financial company fundamental data APIs."""
15
+
16
+ async def get_non_financial_fundamental(
17
+ self,
18
+ stock_codes: list[str],
19
+ metrics: list[str],
20
+ date: str | None = None,
21
+ start_date: str | None = None,
22
+ end_date: str | None = None,
23
+ ) -> pd.DataFrame:
24
+ """获取非金融企业基本面数据.
25
+
26
+ API Endpoint: /cn/company/fundamental/non_financial
27
+ API Method: POST
28
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fundamental/non_financial
29
+
30
+ Args:
31
+ stock_codes: 股票代码列表
32
+ metrics: 指标列表
33
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
34
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
35
+ end_date: 结束日期 (YYYY-MM-DD), 可选
36
+
37
+ Returns:
38
+ 包含非金融企业基本面数据的 DataFrame
39
+
40
+ Example:
41
+ 获取贵州茅台的估值指标::
42
+
43
+ from lixinger import AsyncLixingerClient
44
+
45
+ async with AsyncLixingerClient() as client:
46
+ df = await client.company.fundamental.non_financial.get_non_financial_fundamental(
47
+ stock_codes=["600519"],
48
+ metrics=["pe_ttm", "pb", "ps_ttm"],
49
+ start_date="2023-01-01",
50
+ end_date="2023-12-31"
51
+ )
52
+ print(df)
53
+
54
+ """
55
+ payload: dict[str, Any] = {
56
+ "stockCodes": stock_codes,
57
+ "metricsList": metrics,
58
+ }
59
+ if date is not None:
60
+ payload["date"] = date
61
+ if start_date is not None:
62
+ payload["startDate"] = start_date
63
+ if end_date is not None:
64
+ payload["endDate"] = end_date
65
+
66
+ data = await self._request("POST", "/cn/company/fundamental/non_financial", json=payload)
67
+ return get_response_df(data, NonFinancialFundamentalSchema)
68
+
69
+
70
+ # Functional API instance
71
+ _api_instance = NonFinancialFundamentalAPI()
72
+
73
+
74
+ @api
75
+ async def get_non_financial_fundamental(
76
+ stock_codes: list[str],
77
+ metrics: list[str],
78
+ date: str | None = None,
79
+ start_date: str | None = None,
80
+ end_date: str | None = None,
81
+ ) -> pd.DataFrame:
82
+ """获取非金融企业基本面数据.
83
+
84
+ Args:
85
+ stock_codes: 股票代码列表
86
+ metrics: 指标列表
87
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
88
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
89
+ end_date: 结束日期 (YYYY-MM-DD), 可选
90
+
91
+ Returns:
92
+ 包含非金融企业基本面数据的 DataFrame
93
+
94
+ Example:
95
+ 获取贵州茅台的估值指标::
96
+
97
+ from lixinger import get_non_financial_fundamental
98
+
99
+ df = await get_non_financial_fundamental(
100
+ stock_codes=["600519"],
101
+ metrics=["pe_ttm", "pb", "ps_ttm"],
102
+ start_date="2023-01-01",
103
+ end_date="2023-12-31"
104
+ )
105
+ print(df)
106
+
107
+ """
108
+ return await _api_instance.get_non_financial_fundamental(
109
+ stock_codes=stock_codes,
110
+ metrics=metrics,
111
+ date=date,
112
+ start_date=start_date,
113
+ end_date=end_date,
114
+ )
@@ -0,0 +1,114 @@
1
+ """Other financial company fundamental data APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.company.fundamental.other_financial import OtherFinancialFundamentalSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class OtherFinancialFundamentalAPI(BaseAPI):
14
+ """Other financial company fundamental data APIs."""
15
+
16
+ async def get_other_financial_fundamental(
17
+ self,
18
+ stock_codes: list[str],
19
+ metrics: list[str],
20
+ date: str | None = None,
21
+ start_date: str | None = None,
22
+ end_date: str | None = None,
23
+ ) -> pd.DataFrame:
24
+ """获取其他金融企业基本面数据.
25
+
26
+ API Endpoint: /cn/company/fundamental/other_financial
27
+ API Method: POST
28
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fundamental/other_financial
29
+
30
+ Args:
31
+ stock_codes: 股票代码列表
32
+ metrics: 指标列表
33
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
34
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
35
+ end_date: 结束日期 (YYYY-MM-DD), 可选
36
+
37
+ Returns:
38
+ 包含其他金融企业基本面数据的 DataFrame
39
+
40
+ Example:
41
+ 获取其他金融企业的估值指标::
42
+
43
+ from lixinger import AsyncLixingerClient
44
+
45
+ async with AsyncLixingerClient() as client:
46
+ df = await client.company.fundamental.other_financial.get_other_financial_fundamental(
47
+ stock_codes=["600999"],
48
+ metrics=["pe_ttm", "pb"],
49
+ start_date="2023-01-01",
50
+ end_date="2023-12-31"
51
+ )
52
+ print(df)
53
+
54
+ """
55
+ payload: dict[str, Any] = {
56
+ "stockCodes": stock_codes,
57
+ "metricsList": metrics,
58
+ }
59
+ if date is not None:
60
+ payload["date"] = date
61
+ if start_date is not None:
62
+ payload["startDate"] = start_date
63
+ if end_date is not None:
64
+ payload["endDate"] = end_date
65
+
66
+ data = await self._request("POST", "/cn/company/fundamental/other_financial", json=payload)
67
+ return get_response_df(data, OtherFinancialFundamentalSchema)
68
+
69
+
70
+ # Functional API instance
71
+ _api_instance = OtherFinancialFundamentalAPI()
72
+
73
+
74
+ @api
75
+ async def get_other_financial_fundamental(
76
+ stock_codes: list[str],
77
+ metrics: list[str],
78
+ date: str | None = None,
79
+ start_date: str | None = None,
80
+ end_date: str | None = None,
81
+ ) -> pd.DataFrame:
82
+ """获取其他金融企业基本面数据.
83
+
84
+ Args:
85
+ stock_codes: 股票代码列表
86
+ metrics: 指标列表
87
+ date: 日期 (YYYY-MM-DD), 与 start_date 二选一
88
+ start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
89
+ end_date: 结束日期 (YYYY-MM-DD), 可选
90
+
91
+ Returns:
92
+ 包含其他金融企业基本面数据的 DataFrame
93
+
94
+ Example:
95
+ 获取其他金融企业的估值指标::
96
+
97
+ from lixinger import get_other_financial_fundamental
98
+
99
+ df = await get_other_financial_fundamental(
100
+ stock_codes=["600999"],
101
+ metrics=["pe_ttm", "pb"],
102
+ start_date="2023-01-01",
103
+ end_date="2023-12-31"
104
+ )
105
+ print(df)
106
+
107
+ """
108
+ return await _api_instance.get_other_financial_fundamental(
109
+ stock_codes=stock_codes,
110
+ metrics=metrics,
111
+ date=date,
112
+ start_date=start_date,
113
+ end_date=end_date,
114
+ )