lixinger-python 0.3.7__py3-none-any.whl → 0.3.9__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.
lixinger/__init__.py CHANGED
@@ -1,6 +1,12 @@
1
1
  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
- from lixinger.api.cn.company.fs.non_financial import get_non_financial_statements
3
+ from lixinger.api.cn.company.fs import (
4
+ get_bank_statements,
5
+ get_insurance_statements,
6
+ get_non_financial_statements,
7
+ get_other_financial_statements,
8
+ get_security_statements,
9
+ )
4
10
  from lixinger.api.cn.company.fundamental import (
5
11
  get_bank_fundamental,
6
12
  get_insurance_fundamental,
@@ -28,6 +34,7 @@ from lixinger.api.cn.index import (
28
34
  get_index_bank_statements,
29
35
  get_index_fundamental,
30
36
  get_index_hybrid_statements,
37
+ get_index_margin_trading,
31
38
  get_index_non_financial_statements,
32
39
  get_index_security_statements,
33
40
  get_tracking_fund,
@@ -69,10 +76,15 @@ __all__ = [
69
76
  "get_constituent_weightings",
70
77
  "get_index_fundamental",
71
78
  "get_tracking_fund",
79
+ "get_index_margin_trading",
72
80
  "get_candlestick",
73
81
  "get_index_candlestick",
74
82
  "get_index_drawdown",
75
83
  "get_non_financial_statements",
84
+ "get_bank_statements",
85
+ "get_insurance_statements",
86
+ "get_security_statements",
87
+ "get_other_financial_statements",
76
88
  "get_non_financial_fundamental",
77
89
  "get_bank_fundamental",
78
90
  "get_insurance_fundamental",
@@ -1,5 +1,46 @@
1
- """Financial statement APIs."""
1
+ """Financial statement APIs.
2
2
 
3
- from lixinger.api.cn.company.fs.non_financial import get_non_financial_statements
3
+ This module provides access to company financial statement APIs by company type:
4
4
 
5
- __all__ = ["get_non_financial_statements"]
5
+ - non_financial: Non-financial companies (非金融企业)
6
+ - bank: Banks (银行)
7
+ - insurance: Insurance companies (保险)
8
+ - security: Securities companies (证券)
9
+ - other_financial: Other financial companies (租赁、消费金融等)
10
+ """
11
+
12
+ from lixinger.api.cn.company.fs.bank import (
13
+ BankStatementAPI,
14
+ get_bank_statements,
15
+ )
16
+ from lixinger.api.cn.company.fs.insurance import (
17
+ InsuranceStatementAPI,
18
+ get_insurance_statements,
19
+ )
20
+ from lixinger.api.cn.company.fs.non_financial import (
21
+ NonFinancialStatementAPI,
22
+ get_non_financial_statements,
23
+ )
24
+ from lixinger.api.cn.company.fs.other_financial import (
25
+ OtherFinancialStatementAPI,
26
+ get_other_financial_statements,
27
+ )
28
+ from lixinger.api.cn.company.fs.security import (
29
+ SecurityStatementAPI,
30
+ get_security_statements,
31
+ )
32
+
33
+ __all__ = [
34
+ # API Classes
35
+ "BankStatementAPI",
36
+ "InsuranceStatementAPI",
37
+ "NonFinancialStatementAPI",
38
+ "OtherFinancialStatementAPI",
39
+ "SecurityStatementAPI",
40
+ # Functional APIs
41
+ "get_bank_statements",
42
+ "get_insurance_statements",
43
+ "get_non_financial_statements",
44
+ "get_other_financial_statements",
45
+ "get_security_statements",
46
+ ]
@@ -0,0 +1,132 @@
1
+ """Bank financial statement 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.fs.bank import BankStatementSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+ from lixinger.utils.dict import flatten_dict
12
+
13
+
14
+ class BankStatementAPI(BaseAPI):
15
+ """Bank financial statement APIs."""
16
+
17
+ async def get_bank_statements( # noqa: PLR0913
18
+ self,
19
+ stock_codes: list[str],
20
+ metrics: list[str],
21
+ date: str | None = None,
22
+ start_date: str | None = None,
23
+ end_date: str | None = None,
24
+ limit: int | None = None,
25
+ ) -> pd.DataFrame:
26
+ """获取A股上市银行的财务报表数据.
27
+
28
+ API Endpoint: /cn/company/fs/bank
29
+ API Method: POST
30
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fs/bank
31
+
32
+ 获取A股上市银行的财务报表数据,包括利润表、资产负债表、现金流量表、
33
+ 正常财务指标以及银行特有财务指标(净息差、净利差、资本充足率、
34
+ 不良率、拨贷比等)。
35
+
36
+ Args:
37
+ stock_codes: 股票代码列表,长度 >=1 且 <=100。当传入 start_date
38
+ 时只能传入一个股票代码。
39
+ metrics: 指标列表,格式为
40
+ ``[granularity].[tableName].[fieldName].[expressionCalculateType]``,
41
+ 例如 ``"q.ps.oi.t"``。当 stock_codes 长度大于 1 时最多 48 个
42
+ 指标;等于 1 时最多 128 个指标。
43
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。支持 ``"latest"``。
44
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
45
+ end_date: 结束日期 (YYYY-MM-DD),可选,默认上周一。
46
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
47
+
48
+ Returns:
49
+ 包含A股银行财务报表数据的 DataFrame。
50
+
51
+ Example:
52
+ 获取民生银行和工商银行的营业收入::
53
+
54
+ from lixinger import AsyncLixingerClient
55
+
56
+ async with AsyncLixingerClient() as client:
57
+ df = await client.cn_company.fs.bank.get_bank_statements(
58
+ stock_codes=["600016", "601398"],
59
+ metrics=["q.ps.oi.t"],
60
+ date="2026-03-31",
61
+ )
62
+ print(df)
63
+
64
+ """
65
+ payload: dict[str, Any] = {
66
+ "stockCodes": stock_codes,
67
+ "metricsList": metrics,
68
+ }
69
+ if date is not None:
70
+ payload["date"] = date
71
+ if start_date is not None:
72
+ payload["startDate"] = start_date
73
+ if end_date is not None:
74
+ payload["endDate"] = end_date
75
+ if limit is not None:
76
+ payload["limit"] = limit
77
+
78
+ data = await self._request("POST", "/cn/company/fs/bank", json=payload)
79
+
80
+ # Flatten nested metrics (e.g. {"q": {"ps": {"oi": {"t": ...}}}})
81
+ flattened_data = [flatten_dict(item) for item in data]
82
+
83
+ return get_response_df(flattened_data, BankStatementSchema)
84
+
85
+
86
+ # Functional API instance
87
+ _api_instance = BankStatementAPI()
88
+
89
+
90
+ @api
91
+ async def get_bank_statements( # noqa: PLR0913
92
+ stock_codes: list[str],
93
+ metrics: list[str],
94
+ date: str | None = None,
95
+ start_date: str | None = None,
96
+ end_date: str | None = None,
97
+ limit: int | None = None,
98
+ ) -> pd.DataFrame:
99
+ """获取A股上市银行的财务报表数据.
100
+
101
+ Args:
102
+ stock_codes: 股票代码列表。
103
+ metrics: 指标列表。
104
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。
105
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
106
+ end_date: 结束日期 (YYYY-MM-DD),可选。
107
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
108
+
109
+ Returns:
110
+ 包含A股银行财务报表数据的 DataFrame。
111
+
112
+ Example:
113
+ 获取民生银行的营业收入::
114
+
115
+ from lixinger import get_bank_statements
116
+
117
+ df = await get_bank_statements(
118
+ stock_codes=["600016"],
119
+ metrics=["q.ps.oi.t"],
120
+ date="2026-03-31",
121
+ )
122
+ print(df)
123
+
124
+ """
125
+ return await _api_instance.get_bank_statements(
126
+ stock_codes=stock_codes,
127
+ metrics=metrics,
128
+ date=date,
129
+ start_date=start_date,
130
+ end_date=end_date,
131
+ limit=limit,
132
+ )
@@ -0,0 +1,132 @@
1
+ """Insurance financial statement 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.fs.insurance import InsuranceStatementSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+ from lixinger.utils.dict import flatten_dict
12
+
13
+
14
+ class InsuranceStatementAPI(BaseAPI):
15
+ """Insurance financial statement APIs."""
16
+
17
+ async def get_insurance_statements( # noqa: PLR0913
18
+ self,
19
+ stock_codes: list[str],
20
+ metrics: list[str],
21
+ date: str | None = None,
22
+ start_date: str | None = None,
23
+ end_date: str | None = None,
24
+ limit: int | None = None,
25
+ ) -> pd.DataFrame:
26
+ """获取A股保险公司的财务报表数据.
27
+
28
+ API Endpoint: /cn/company/fs/insurance
29
+ API Method: POST
30
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fs/insurance
31
+
32
+ 获取A股保险公司的财务报表数据,包括利润表、资产负债表、现金流量表、
33
+ 正常财务指标以及保险公司特有财务指标(内含价值、新业务价值、
34
+ 核心偿付能力充足率、综合偿付能力充足率等)。
35
+
36
+ Args:
37
+ stock_codes: 股票代码列表,长度 >=1 且 <=100。当传入 start_date
38
+ 时只能传入一个股票代码。
39
+ metrics: 指标列表,格式为
40
+ ``[granularity].[tableName].[fieldName].[expressionCalculateType]``,
41
+ 例如 ``"q.ps.toi.t"``。当 stock_codes 长度大于 1 时最多 48 个
42
+ 指标;等于 1 时最多 128 个指标。
43
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。支持 ``"latest"``。
44
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
45
+ end_date: 结束日期 (YYYY-MM-DD),可选,默认上周一。
46
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
47
+
48
+ Returns:
49
+ 包含A股保险公司财务报表数据的 DataFrame。
50
+
51
+ Example:
52
+ 获取中国平安的营业总收入::
53
+
54
+ from lixinger import AsyncLixingerClient
55
+
56
+ async with AsyncLixingerClient() as client:
57
+ df = await client.cn_company.fs.insurance.get_insurance_statements(
58
+ stock_codes=["601318"],
59
+ metrics=["q.ps.toi.t"],
60
+ date="2026-03-31",
61
+ )
62
+ print(df)
63
+
64
+ """
65
+ payload: dict[str, Any] = {
66
+ "stockCodes": stock_codes,
67
+ "metricsList": metrics,
68
+ }
69
+ if date is not None:
70
+ payload["date"] = date
71
+ if start_date is not None:
72
+ payload["startDate"] = start_date
73
+ if end_date is not None:
74
+ payload["endDate"] = end_date
75
+ if limit is not None:
76
+ payload["limit"] = limit
77
+
78
+ data = await self._request("POST", "/cn/company/fs/insurance", json=payload)
79
+
80
+ # Flatten nested metrics (e.g. {"q": {"ps": {"toi": {"t": ...}}}})
81
+ flattened_data = [flatten_dict(item) for item in data]
82
+
83
+ return get_response_df(flattened_data, InsuranceStatementSchema)
84
+
85
+
86
+ # Functional API instance
87
+ _api_instance = InsuranceStatementAPI()
88
+
89
+
90
+ @api
91
+ async def get_insurance_statements( # noqa: PLR0913
92
+ stock_codes: list[str],
93
+ metrics: list[str],
94
+ date: str | None = None,
95
+ start_date: str | None = None,
96
+ end_date: str | None = None,
97
+ limit: int | None = None,
98
+ ) -> pd.DataFrame:
99
+ """获取A股保险公司的财务报表数据.
100
+
101
+ Args:
102
+ stock_codes: 股票代码列表。
103
+ metrics: 指标列表。
104
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。
105
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
106
+ end_date: 结束日期 (YYYY-MM-DD),可选。
107
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
108
+
109
+ Returns:
110
+ 包含A股保险公司财务报表数据的 DataFrame。
111
+
112
+ Example:
113
+ 获取中国平安的营业总收入::
114
+
115
+ from lixinger import get_insurance_statements
116
+
117
+ df = await get_insurance_statements(
118
+ stock_codes=["601318"],
119
+ metrics=["q.ps.toi.t"],
120
+ date="2026-03-31",
121
+ )
122
+ print(df)
123
+
124
+ """
125
+ return await _api_instance.get_insurance_statements(
126
+ stock_codes=stock_codes,
127
+ metrics=metrics,
128
+ date=date,
129
+ start_date=start_date,
130
+ end_date=end_date,
131
+ limit=limit,
132
+ )
@@ -14,13 +14,14 @@ from lixinger.utils.dict import flatten_dict
14
14
  class NonFinancialStatementAPI(BaseAPI):
15
15
  """Non-financial statement APIs."""
16
16
 
17
- async def get_non_financial_statements(
17
+ async def get_non_financial_statements( # noqa: PLR0913
18
18
  self,
19
19
  stock_codes: list[str],
20
20
  metrics: list[str],
21
21
  date: str | None = None,
22
22
  start_date: str | None = None,
23
23
  end_date: str | None = None,
24
+ limit: int | None = None,
24
25
  ) -> pd.DataFrame:
25
26
  """获取非金融企业财务报表数据.
26
27
 
@@ -34,6 +35,7 @@ class NonFinancialStatementAPI(BaseAPI):
34
35
  date: 日期 (YYYY-MM-DD), 与 startDate 二选一
35
36
  start_date: 开始日期 (YYYY-MM-DD), 与 date 二选一
36
37
  end_date: 结束日期 (YYYY-MM-DD), 可选
38
+ limit: 返回最近数据的数量,仅在 date range 请求下生效
37
39
 
38
40
  """
39
41
  payload: dict[str, Any] = {
@@ -46,6 +48,8 @@ class NonFinancialStatementAPI(BaseAPI):
46
48
  payload["startDate"] = start_date
47
49
  if end_date is not None:
48
50
  payload["endDate"] = end_date
51
+ if limit is not None:
52
+ payload["limit"] = limit
49
53
 
50
54
  data = await self._request("POST", "/cn/company/fs/non_financial", json=payload)
51
55
 
@@ -60,12 +64,13 @@ _api_instance = NonFinancialStatementAPI()
60
64
 
61
65
 
62
66
  @api
63
- async def get_non_financial_statements(
67
+ async def get_non_financial_statements( # noqa: PLR0913
64
68
  stock_codes: list[str],
65
69
  metrics: list[str],
66
70
  date: str | None = None,
67
71
  start_date: str | None = None,
68
72
  end_date: str | None = None,
73
+ limit: int | None = None,
69
74
  ) -> pd.DataFrame:
70
75
  """获取非金融企业财务报表数据."""
71
76
  return await _api_instance.get_non_financial_statements(
@@ -74,4 +79,5 @@ async def get_non_financial_statements(
74
79
  date=date,
75
80
  start_date=start_date,
76
81
  end_date=end_date,
82
+ limit=limit,
77
83
  )
@@ -0,0 +1,131 @@
1
+ """Other financial company financial statement 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.fs.other_financial import OtherFinancialStatementSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+ from lixinger.utils.dict import flatten_dict
12
+
13
+
14
+ class OtherFinancialStatementAPI(BaseAPI):
15
+ """Other financial company financial statement APIs."""
16
+
17
+ async def get_other_financial_statements( # noqa: PLR0913
18
+ self,
19
+ stock_codes: list[str],
20
+ metrics: list[str],
21
+ date: str | None = None,
22
+ start_date: str | None = None,
23
+ end_date: str | None = None,
24
+ limit: int | None = None,
25
+ ) -> pd.DataFrame:
26
+ """获取A股其他金融公司(租赁、消费金融等)的财务报表数据.
27
+
28
+ API Endpoint: /cn/company/fs/other_financial
29
+ API Method: POST
30
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fs/other_financial
31
+
32
+ 获取A股其他金融公司(租赁、消费金融等)的财务报表数据,包括利润表、
33
+ 资产负债表、现金流量表以及各类财务指标。
34
+
35
+ Args:
36
+ stock_codes: 股票代码列表,长度 >=1 且 <=100。当传入 start_date
37
+ 时只能传入一个股票代码。
38
+ metrics: 指标列表,格式为
39
+ ``[granularity].[tableName].[fieldName].[expressionCalculateType]``,
40
+ 例如 ``"q.ps.toi.t"``。当 stock_codes 长度大于 1 时最多 48 个
41
+ 指标;等于 1 时最多 128 个指标。
42
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。支持 ``"latest"``。
43
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
44
+ end_date: 结束日期 (YYYY-MM-DD),可选,默认上周一。
45
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
46
+
47
+ Returns:
48
+ 包含A股其他金融公司财务报表数据的 DataFrame。
49
+
50
+ Example:
51
+ 获取江苏租赁的营业总收入::
52
+
53
+ from lixinger import AsyncLixingerClient
54
+
55
+ async with AsyncLixingerClient() as client:
56
+ df = await client.cn_company.fs.other_financial.get_other_financial_statements(
57
+ stock_codes=["600901"],
58
+ metrics=["q.ps.toi.t"],
59
+ date="2026-03-31",
60
+ )
61
+ print(df)
62
+
63
+ """
64
+ payload: dict[str, Any] = {
65
+ "stockCodes": stock_codes,
66
+ "metricsList": metrics,
67
+ }
68
+ if date is not None:
69
+ payload["date"] = date
70
+ if start_date is not None:
71
+ payload["startDate"] = start_date
72
+ if end_date is not None:
73
+ payload["endDate"] = end_date
74
+ if limit is not None:
75
+ payload["limit"] = limit
76
+
77
+ data = await self._request("POST", "/cn/company/fs/other_financial", json=payload)
78
+
79
+ # Flatten nested metrics (e.g. {"q": {"ps": {"toi": {"t": ...}}}})
80
+ flattened_data = [flatten_dict(item) for item in data]
81
+
82
+ return get_response_df(flattened_data, OtherFinancialStatementSchema)
83
+
84
+
85
+ # Functional API instance
86
+ _api_instance = OtherFinancialStatementAPI()
87
+
88
+
89
+ @api
90
+ async def get_other_financial_statements( # noqa: PLR0913
91
+ stock_codes: list[str],
92
+ metrics: list[str],
93
+ date: str | None = None,
94
+ start_date: str | None = None,
95
+ end_date: str | None = None,
96
+ limit: int | None = None,
97
+ ) -> pd.DataFrame:
98
+ """获取A股其他金融公司(租赁、消费金融等)的财务报表数据.
99
+
100
+ Args:
101
+ stock_codes: 股票代码列表。
102
+ metrics: 指标列表。
103
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。
104
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
105
+ end_date: 结束日期 (YYYY-MM-DD),可选。
106
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
107
+
108
+ Returns:
109
+ 包含A股其他金融公司财务报表数据的 DataFrame。
110
+
111
+ Example:
112
+ 获取江苏租赁的营业总收入::
113
+
114
+ from lixinger import get_other_financial_statements
115
+
116
+ df = await get_other_financial_statements(
117
+ stock_codes=["600901"],
118
+ metrics=["q.ps.toi.t"],
119
+ date="2026-03-31",
120
+ )
121
+ print(df)
122
+
123
+ """
124
+ return await _api_instance.get_other_financial_statements(
125
+ stock_codes=stock_codes,
126
+ metrics=metrics,
127
+ date=date,
128
+ start_date=start_date,
129
+ end_date=end_date,
130
+ limit=limit,
131
+ )
@@ -0,0 +1,132 @@
1
+ """Security (securities firm) financial statement 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.fs.security import SecurityStatementSchema
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+ from lixinger.utils.dict import flatten_dict
12
+
13
+
14
+ class SecurityStatementAPI(BaseAPI):
15
+ """Security (securities firm) financial statement APIs."""
16
+
17
+ async def get_security_statements( # noqa: PLR0913
18
+ self,
19
+ stock_codes: list[str],
20
+ metrics: list[str],
21
+ date: str | None = None,
22
+ start_date: str | None = None,
23
+ end_date: str | None = None,
24
+ limit: int | None = None,
25
+ ) -> pd.DataFrame:
26
+ """获取A股证券公司的财务报表数据.
27
+
28
+ API Endpoint: /cn/company/fs/security
29
+ API Method: POST
30
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/company/fs/security
31
+
32
+ 获取A股证券公司的财务报表数据,包括利润表、资产负债表、现金流量表、
33
+ 正常财务指标以及证券公司特有财务指标(净资本、风险覆盖率、
34
+ 资本杠杆率、流动性覆盖率、净稳定资金率等)。
35
+
36
+ Args:
37
+ stock_codes: 股票代码列表,长度 >=1 且 <=100。当传入 start_date
38
+ 时只能传入一个股票代码。
39
+ metrics: 指标列表,格式为
40
+ ``[granularity].[tableName].[fieldName].[expressionCalculateType]``,
41
+ 例如 ``"q.ps.toi.t"``。当 stock_codes 长度大于 1 时最多 48 个
42
+ 指标;等于 1 时最多 128 个指标。
43
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。支持 ``"latest"``。
44
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
45
+ end_date: 结束日期 (YYYY-MM-DD),可选,默认上周一。
46
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
47
+
48
+ Returns:
49
+ 包含A股证券公司财务报表数据的 DataFrame。
50
+
51
+ Example:
52
+ 获取中信证券的营业总收入::
53
+
54
+ from lixinger import AsyncLixingerClient
55
+
56
+ async with AsyncLixingerClient() as client:
57
+ df = await client.cn_company.fs.security.get_security_statements(
58
+ stock_codes=["600030"],
59
+ metrics=["q.ps.toi.t"],
60
+ date="2026-03-31",
61
+ )
62
+ print(df)
63
+
64
+ """
65
+ payload: dict[str, Any] = {
66
+ "stockCodes": stock_codes,
67
+ "metricsList": metrics,
68
+ }
69
+ if date is not None:
70
+ payload["date"] = date
71
+ if start_date is not None:
72
+ payload["startDate"] = start_date
73
+ if end_date is not None:
74
+ payload["endDate"] = end_date
75
+ if limit is not None:
76
+ payload["limit"] = limit
77
+
78
+ data = await self._request("POST", "/cn/company/fs/security", json=payload)
79
+
80
+ # Flatten nested metrics (e.g. {"q": {"ps": {"toi": {"t": ...}}}})
81
+ flattened_data = [flatten_dict(item) for item in data]
82
+
83
+ return get_response_df(flattened_data, SecurityStatementSchema)
84
+
85
+
86
+ # Functional API instance
87
+ _api_instance = SecurityStatementAPI()
88
+
89
+
90
+ @api
91
+ async def get_security_statements( # noqa: PLR0913
92
+ stock_codes: list[str],
93
+ metrics: list[str],
94
+ date: str | None = None,
95
+ start_date: str | None = None,
96
+ end_date: str | None = None,
97
+ limit: int | None = None,
98
+ ) -> pd.DataFrame:
99
+ """获取A股证券公司的财务报表数据.
100
+
101
+ Args:
102
+ stock_codes: 股票代码列表。
103
+ metrics: 指标列表。
104
+ date: 日期 (YYYY-MM-DD),与 start_date 二选一。
105
+ start_date: 开始日期 (YYYY-MM-DD),与 date 二选一。
106
+ end_date: 结束日期 (YYYY-MM-DD),可选。
107
+ limit: 返回最近数据的数量,仅在 date range 请求下生效。
108
+
109
+ Returns:
110
+ 包含A股证券公司财务报表数据的 DataFrame。
111
+
112
+ Example:
113
+ 获取中信证券的营业总收入::
114
+
115
+ from lixinger import get_security_statements
116
+
117
+ df = await get_security_statements(
118
+ stock_codes=["600030"],
119
+ metrics=["q.ps.toi.t"],
120
+ date="2026-03-31",
121
+ )
122
+ print(df)
123
+
124
+ """
125
+ return await _api_instance.get_security_statements(
126
+ stock_codes=stock_codes,
127
+ metrics=metrics,
128
+ date=date,
129
+ start_date=start_date,
130
+ end_date=end_date,
131
+ limit=limit,
132
+ )
@@ -5,7 +5,11 @@ from lixinger.api.cn.company.candlestick import CandlestickAPI
5
5
  from lixinger.api.cn.company.company import CompanyAPI
6
6
  from lixinger.api.cn.company.dividend import DividendAPI
7
7
  from lixinger.api.cn.company.equity_change import EquityChangeAPI
8
+ from lixinger.api.cn.company.fs.bank import BankStatementAPI
9
+ from lixinger.api.cn.company.fs.insurance import InsuranceStatementAPI
8
10
  from lixinger.api.cn.company.fs.non_financial import NonFinancialStatementAPI
11
+ from lixinger.api.cn.company.fs.other_financial import OtherFinancialStatementAPI
12
+ from lixinger.api.cn.company.fs.security import SecurityStatementAPI
9
13
  from lixinger.api.cn.company.fundamental.bank import BankFundamentalAPI
10
14
  from lixinger.api.cn.company.fundamental.insurance import InsuranceFundamentalAPI
11
15
  from lixinger.api.cn.company.fundamental.non_financial import NonFinancialFundamentalAPI
@@ -43,11 +47,31 @@ class FundamentalNamespace:
43
47
 
44
48
 
45
49
  class FSNamespace:
46
- """Namespace for financial statement APIs."""
50
+ """Namespace for financial statement APIs.
47
51
 
48
- def __init__(self, non_financial: NonFinancialStatementAPI):
52
+ Groups all financial statement APIs by company type:
53
+
54
+ - non_financial: Non-financial companies (非金融企业)
55
+ - bank: Banks (银行)
56
+ - insurance: Insurance companies (保险)
57
+ - security: Securities companies (证券)
58
+ - other_financial: Other financial companies (租赁、消费金融等)
59
+ """
60
+
61
+ def __init__(
62
+ self,
63
+ non_financial: NonFinancialStatementAPI,
64
+ bank: BankStatementAPI,
65
+ insurance: InsuranceStatementAPI,
66
+ security: SecurityStatementAPI,
67
+ other_financial: OtherFinancialStatementAPI,
68
+ ):
49
69
  """Initialize the financial statement namespace."""
50
70
  self.non_financial = non_financial
71
+ self.bank = bank
72
+ self.insurance = insurance
73
+ self.security = security
74
+ self.other_financial = other_financial
51
75
 
52
76
 
53
77
  class CompanyNamespace:
@@ -66,8 +90,12 @@ class CompanyNamespace:
66
90
  - fundamental.security: Securities company fundamental data
67
91
  - fundamental.other_financial: Other financial company fundamental data
68
92
  - candlestick: Candlestick data API
69
- - fs: Financial statement APIs
93
+ - fs: Financial statement APIs (contains sub-APIs for different company types)
70
94
  - fs.non_financial: Non-financial statements API
95
+ - fs.bank: Bank statements API
96
+ - fs.insurance: Insurance statements API
97
+ - fs.security: Security statements API
98
+ - fs.other_financial: Other financial company statements API
71
99
  - indices: Company indices API
72
100
  - dividend: Dividend data API
73
101
  - announcement: Announcement data API
@@ -86,6 +114,10 @@ class CompanyNamespace:
86
114
  fundamental_other_financial: OtherFinancialFundamentalAPI,
87
115
  candlestick: CandlestickAPI,
88
116
  fs_non_financial: NonFinancialStatementAPI,
117
+ fs_bank: BankStatementAPI,
118
+ fs_insurance: InsuranceStatementAPI,
119
+ fs_security: SecurityStatementAPI,
120
+ fs_other_financial: OtherFinancialStatementAPI,
89
121
  indices: IndicesAPI,
90
122
  dividend: DividendAPI,
91
123
  announcement: AnnouncementAPI,
@@ -103,6 +135,10 @@ class CompanyNamespace:
103
135
  fundamental_other_financial: Other financial company fundamental data API
104
136
  candlestick: Candlestick data API
105
137
  fs_non_financial: Non-financial statements API
138
+ fs_bank: Bank statements API
139
+ fs_insurance: Insurance statements API
140
+ fs_security: Security statements API
141
+ fs_other_financial: Other financial company statements API
106
142
  indices: Company indices API
107
143
  dividend: Dividend data API
108
144
  announcement: Announcement data API
@@ -119,7 +155,13 @@ class CompanyNamespace:
119
155
  other_financial=fundamental_other_financial,
120
156
  )
121
157
  self.candlestick = candlestick
122
- self.fs = FSNamespace(non_financial=fs_non_financial)
158
+ self.fs = FSNamespace(
159
+ non_financial=fs_non_financial,
160
+ bank=fs_bank,
161
+ insurance=fs_insurance,
162
+ security=fs_security,
163
+ other_financial=fs_other_financial,
164
+ )
123
165
  self.indices = indices
124
166
  self.dividend = dividend
125
167
  self.announcement = announcement
@@ -22,6 +22,10 @@ from lixinger.api.cn.index.fundamental import (
22
22
  get_index_fundamental,
23
23
  )
24
24
  from lixinger.api.cn.index.index import IndexAPI, get_index
25
+ from lixinger.api.cn.index.margin_trading import (
26
+ IndexMarginTradingAPI,
27
+ get_index_margin_trading,
28
+ )
25
29
  from lixinger.api.cn.index.tracking_fund import TrackingFundAPI, get_tracking_fund
26
30
 
27
31
  __all__ = [
@@ -37,6 +41,8 @@ __all__ = [
37
41
  "get_drawdown",
38
42
  "IndexFundamentalAPI",
39
43
  "get_index_fundamental",
44
+ "IndexMarginTradingAPI",
45
+ "get_index_margin_trading",
40
46
  "TrackingFundAPI",
41
47
  "get_tracking_fund",
42
48
  # Index financial statements
@@ -0,0 +1,117 @@
1
+ """Index margin trading and securities lending 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.index.margin_trading import IndexMarginTrading
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class IndexMarginTradingAPI(BaseAPI):
14
+ """Index margin trading and securities lending APIs."""
15
+
16
+ async def get_margin_trading(
17
+ self,
18
+ stock_code: str,
19
+ start_date: str,
20
+ end_date: str | None = None,
21
+ limit: int | None = None,
22
+ ) -> pd.DataFrame:
23
+ """获取指数融资融券数据.
24
+
25
+ 获取大陆指数每日的融资融券数据. 可按指数代码批量查询返回每日指数融资买入金额、
26
+ 融资偿还金额、融资净买入金额、融资余额、融券卖出金额、融券偿还金额、
27
+ 融券净卖出金额、融券余额等数据. 当用户想了解某指数每日的融资融券余额以及变动情况、
28
+ 观察杠杆资金进出节奏或分析做空力量时, 调用此接口.
29
+
30
+ API Endpoint: /cn/index/margin-trading-and-securities-lending
31
+ API Method: POST
32
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/index/margin-trading-and-securities-lending
33
+
34
+ Args:
35
+ stock_code: 指数代码, 请参考指数信息API获取合法的stockCode
36
+ start_date: 信息起始时间 (YYYY-MM-DD, 北京时间), 开始和结束的时间间隔不超过10年
37
+ end_date: 结束信息日期 (YYYY-MM-DD, 北京时间), 默认为今天结束
38
+ limit: 返回最近数据的数量
39
+
40
+ Returns:
41
+ DataFrame containing margin trading data with columns:
42
+
43
+ - date: 数据时间
44
+ - stock_code: 指数代码
45
+ - financing_purchase_amount: 融资买入金额
46
+ - financing_repayment_amount: 融资偿还金额
47
+ - financing_net_purchase_amount: 融资净买入金额
48
+ - financing_balance: 融资余额
49
+ - securities_sell_amount: 融券卖出金额
50
+ - securities_repayment_amount: 融券偿还金额
51
+ - securities_net_sell_amount: 融券净卖出金额
52
+ - securities_balance: 融券余额
53
+ - financing_balance_to_market_cap: 融资余额占流通市值比例
54
+ - securities_balance_to_market_cap: 融券余额占流通市值比例
55
+
56
+ Example:
57
+ 获取上证50指数融资融券数据::
58
+
59
+ from lixinger import AsyncLixingerClient
60
+
61
+ async with AsyncLixingerClient() as client:
62
+ df = await client.cn_index.margin_trading.get_margin_trading(
63
+ stock_code="000016",
64
+ start_date="2025-06-13",
65
+ end_date="2026-06-13",
66
+ )
67
+ print(df)
68
+
69
+ """
70
+ payload: dict[str, Any] = {
71
+ "stockCode": stock_code,
72
+ "startDate": start_date,
73
+ }
74
+ if end_date is not None:
75
+ payload["endDate"] = end_date
76
+ if limit is not None:
77
+ payload["limit"] = limit
78
+
79
+ data = await self._request(
80
+ "POST",
81
+ "/cn/index/margin-trading-and-securities-lending",
82
+ json=payload,
83
+ )
84
+ for item in data:
85
+ item["stockCode"] = stock_code
86
+ return get_response_df(data, IndexMarginTrading)
87
+
88
+
89
+ # Functional API instance
90
+ _api_instance = IndexMarginTradingAPI()
91
+
92
+
93
+ @api
94
+ async def get_index_margin_trading(
95
+ stock_code: str,
96
+ start_date: str,
97
+ end_date: str | None = None,
98
+ limit: int | None = None,
99
+ ) -> pd.DataFrame:
100
+ """获取指数融资融券数据.
101
+
102
+ Args:
103
+ stock_code: 指数代码
104
+ start_date: 信息起始时间 (YYYY-MM-DD)
105
+ end_date: 结束信息日期 (YYYY-MM-DD)
106
+ limit: 返回最近数据的数量
107
+
108
+ Returns:
109
+ DataFrame containing index margin trading data
110
+
111
+ """
112
+ return await _api_instance.get_margin_trading(
113
+ stock_code=stock_code,
114
+ start_date=start_date,
115
+ end_date=end_date,
116
+ limit=limit,
117
+ )
@@ -10,6 +10,7 @@ from lixinger.api.cn.index.fs.non_financial import IndexNonFinancialStatementAPI
10
10
  from lixinger.api.cn.index.fs.security import IndexSecurityStatementAPI
11
11
  from lixinger.api.cn.index.fundamental import IndexFundamentalAPI
12
12
  from lixinger.api.cn.index.index import IndexAPI
13
+ from lixinger.api.cn.index.margin_trading import IndexMarginTradingAPI
13
14
  from lixinger.api.cn.index.tracking_fund import TrackingFundAPI
14
15
 
15
16
 
@@ -60,6 +61,7 @@ class IndexNamespace:
60
61
  - candlestick: Index candlestick data API (get_candlestick)
61
62
  - drawdown: Index drawdown data API (get_drawdown)
62
63
  - tracking_fund: Index tracking fund API (get_tracking_fund)
64
+ - margin_trading: Index margin trading API (get_margin_trading)
63
65
  - fs: Index financial statement APIs (sub-APIs for different index types)
64
66
  - fs.non_financial: Non-financial index statements
65
67
  - fs.bank: Bank index statements
@@ -77,6 +79,7 @@ class IndexNamespace:
77
79
  candlestick: IndexCandlestickAPI,
78
80
  drawdown: DrawdownAPI,
79
81
  tracking_fund: TrackingFundAPI,
82
+ margin_trading: IndexMarginTradingAPI,
80
83
  fs_non_financial: IndexNonFinancialStatementAPI,
81
84
  fs_bank: IndexBankStatementAPI,
82
85
  fs_security: IndexSecurityStatementAPI,
@@ -92,6 +95,7 @@ class IndexNamespace:
92
95
  candlestick: Index candlestick data API
93
96
  drawdown: Index drawdown data API
94
97
  tracking_fund: Index tracking fund API
98
+ margin_trading: Index margin trading and securities lending API
95
99
  fs_non_financial: Non-financial index statement API
96
100
  fs_bank: Bank index statement API
97
101
  fs_security: Security index statement API
@@ -105,6 +109,7 @@ class IndexNamespace:
105
109
  self.candlestick = candlestick
106
110
  self.drawdown = drawdown
107
111
  self.tracking_fund = tracking_fund
112
+ self.margin_trading = margin_trading
108
113
  self.fs = IndexFSNamespace(
109
114
  non_financial=fs_non_financial,
110
115
  bank=fs_bank,
@@ -140,3 +145,7 @@ class IndexNamespace:
140
145
  def get_tracking_fund(self, *args, **kwargs):
141
146
  """Alias for tracking_fund.get_tracking_fund."""
142
147
  return self.tracking_fund.get_tracking_fund(*args, **kwargs)
148
+
149
+ def get_margin_trading(self, *args, **kwargs):
150
+ """Alias for margin_trading.get_margin_trading."""
151
+ return self.margin_trading.get_margin_trading(*args, **kwargs)
lixinger/client.py CHANGED
@@ -5,7 +5,11 @@ from lixinger.api.cn.company.candlestick import CandlestickAPI
5
5
  from lixinger.api.cn.company.company import CompanyAPI
6
6
  from lixinger.api.cn.company.dividend import DividendAPI
7
7
  from lixinger.api.cn.company.equity_change import EquityChangeAPI
8
+ from lixinger.api.cn.company.fs.bank import BankStatementAPI
9
+ from lixinger.api.cn.company.fs.insurance import InsuranceStatementAPI
8
10
  from lixinger.api.cn.company.fs.non_financial import NonFinancialStatementAPI
11
+ from lixinger.api.cn.company.fs.other_financial import OtherFinancialStatementAPI
12
+ from lixinger.api.cn.company.fs.security import SecurityStatementAPI
9
13
  from lixinger.api.cn.company.fundamental.bank import BankFundamentalAPI
10
14
  from lixinger.api.cn.company.fundamental.insurance import InsuranceFundamentalAPI
11
15
  from lixinger.api.cn.company.fundamental.non_financial import NonFinancialFundamentalAPI
@@ -32,6 +36,7 @@ from lixinger.api.cn.index import (
32
36
  IndexCandlestickAPI,
33
37
  IndexFundamentalAPI,
34
38
  IndexHybridStatementAPI,
39
+ IndexMarginTradingAPI,
35
40
  IndexNonFinancialStatementAPI,
36
41
  IndexSecurityStatementAPI,
37
42
  TrackingFundAPI,
@@ -134,6 +139,10 @@ class AsyncLixingerClient:
134
139
  )
135
140
  cn_company_candlestick = CandlestickAPI(self._http_client, self.config, self._rate_limiter)
136
141
  cn_company_fs_non_financial = NonFinancialStatementAPI(self._http_client, self.config, self._rate_limiter)
142
+ cn_company_fs_bank = BankStatementAPI(self._http_client, self.config, self._rate_limiter)
143
+ cn_company_fs_insurance = InsuranceStatementAPI(self._http_client, self.config, self._rate_limiter)
144
+ cn_company_fs_security = SecurityStatementAPI(self._http_client, self.config, self._rate_limiter)
145
+ cn_company_fs_other_financial = OtherFinancialStatementAPI(self._http_client, self.config, self._rate_limiter)
137
146
  cn_company_indices = IndicesAPI(self._http_client, self.config, self._rate_limiter)
138
147
  cn_company_dividend = DividendAPI(self._http_client, self.config, self._rate_limiter)
139
148
  cn_company_announcement = AnnouncementAPI(self._http_client, self.config, self._rate_limiter)
@@ -150,6 +159,10 @@ class AsyncLixingerClient:
150
159
  fundamental_other_financial=cn_company_fundamental_other_financial,
151
160
  candlestick=cn_company_candlestick,
152
161
  fs_non_financial=cn_company_fs_non_financial,
162
+ fs_bank=cn_company_fs_bank,
163
+ fs_insurance=cn_company_fs_insurance,
164
+ fs_security=cn_company_fs_security,
165
+ fs_other_financial=cn_company_fs_other_financial,
153
166
  indices=cn_company_indices,
154
167
  dividend=cn_company_dividend,
155
168
  announcement=cn_company_announcement,
@@ -158,6 +171,10 @@ class AsyncLixingerClient:
158
171
  # Legacy flat access (deprecated, for backward compatibility)
159
172
  self.cn_company_candlestick = cn_company_candlestick
160
173
  self.cn_company_fs_non_financial = cn_company_fs_non_financial
174
+ self.cn_company_fs_bank = cn_company_fs_bank
175
+ self.cn_company_fs_insurance = cn_company_fs_insurance
176
+ self.cn_company_fs_security = cn_company_fs_security
177
+ self.cn_company_fs_other_financial = cn_company_fs_other_financial
161
178
  self.cn_company_indices = cn_company_indices
162
179
  self.cn_company_dividend = cn_company_dividend
163
180
  self.cn_company_announcement = cn_company_announcement
@@ -170,6 +187,7 @@ class AsyncLixingerClient:
170
187
  cn_index_drawdown = DrawdownAPI(self._http_client, self.config, self._rate_limiter)
171
188
  cn_index_fundamental = IndexFundamentalAPI(self._http_client, self.config, self._rate_limiter)
172
189
  cn_index_tracking_fund = TrackingFundAPI(self._http_client, self.config, self._rate_limiter)
190
+ cn_index_margin_trading = IndexMarginTradingAPI(self._http_client, self.config, self._rate_limiter)
173
191
  cn_index_fs_non_financial = IndexNonFinancialStatementAPI(self._http_client, self.config, self._rate_limiter)
174
192
  cn_index_fs_bank = IndexBankStatementAPI(self._http_client, self.config, self._rate_limiter)
175
193
  cn_index_fs_security = IndexSecurityStatementAPI(self._http_client, self.config, self._rate_limiter)
@@ -184,6 +202,7 @@ class AsyncLixingerClient:
184
202
  candlestick=cn_index_candlestick,
185
203
  drawdown=cn_index_drawdown,
186
204
  tracking_fund=cn_index_tracking_fund,
205
+ margin_trading=cn_index_margin_trading,
187
206
  fs_non_financial=cn_index_fs_non_financial,
188
207
  fs_bank=cn_index_fs_bank,
189
208
  fs_security=cn_index_fs_security,
@@ -197,6 +216,7 @@ class AsyncLixingerClient:
197
216
  self.cn_index_drawdown = cn_index_drawdown
198
217
  self.cn_index_fundamental = cn_index_fundamental
199
218
  self.cn_index_tracking_fund = cn_index_tracking_fund
219
+ self.cn_index_margin_trading = cn_index_margin_trading
200
220
  self.cn_index_fs_non_financial = cn_index_fs_non_financial
201
221
  self.cn_index_fs_bank = cn_index_fs_bank
202
222
  self.cn_index_fs_security = cn_index_fs_security
@@ -1,5 +1,15 @@
1
1
  """Financial statement models."""
2
2
 
3
+ from lixinger.models.cn.company.fs.bank import BankStatementSchema
4
+ from lixinger.models.cn.company.fs.insurance import InsuranceStatementSchema
3
5
  from lixinger.models.cn.company.fs.non_financial import NonFinancialStatementSchema
6
+ from lixinger.models.cn.company.fs.other_financial import OtherFinancialStatementSchema
7
+ from lixinger.models.cn.company.fs.security import SecurityStatementSchema
4
8
 
5
- __all__ = ["NonFinancialStatementSchema"]
9
+ __all__ = [
10
+ "BankStatementSchema",
11
+ "InsuranceStatementSchema",
12
+ "NonFinancialStatementSchema",
13
+ "OtherFinancialStatementSchema",
14
+ "SecurityStatementSchema",
15
+ ]
@@ -0,0 +1,20 @@
1
+ """Bank financial statement models."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class BankStatementSchema(pa.DataFrameModel):
7
+ """Bank financial statement model."""
8
+
9
+ class Config:
10
+ """Pandera configuration."""
11
+
12
+ coerce = True
13
+ strict = False # Allow extra metrics columns
14
+
15
+ date: pa.typing.Series[pa.typing.DateTime]
16
+ stock_code: pa.typing.Series[str]
17
+ currency: pa.typing.Series[str]
18
+ report_date: pa.typing.Series[pa.typing.DateTime]
19
+ report_type: pa.typing.Series[str]
20
+ standard_date: pa.typing.Series[pa.typing.DateTime]
@@ -0,0 +1,20 @@
1
+ """Insurance financial statement models."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class InsuranceStatementSchema(pa.DataFrameModel):
7
+ """Insurance financial statement model."""
8
+
9
+ class Config:
10
+ """Pandera configuration."""
11
+
12
+ coerce = True
13
+ strict = False # Allow extra metrics columns
14
+
15
+ date: pa.typing.Series[pa.typing.DateTime]
16
+ stock_code: pa.typing.Series[str]
17
+ currency: pa.typing.Series[str]
18
+ report_date: pa.typing.Series[pa.typing.DateTime]
19
+ report_type: pa.typing.Series[str]
20
+ standard_date: pa.typing.Series[pa.typing.DateTime]
@@ -0,0 +1,20 @@
1
+ """Other financial company financial statement models."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class OtherFinancialStatementSchema(pa.DataFrameModel):
7
+ """Other financial company financial statement model."""
8
+
9
+ class Config:
10
+ """Pandera configuration."""
11
+
12
+ coerce = True
13
+ strict = False # Allow extra metrics columns
14
+
15
+ date: pa.typing.Series[pa.typing.DateTime]
16
+ stock_code: pa.typing.Series[str]
17
+ currency: pa.typing.Series[str]
18
+ report_date: pa.typing.Series[pa.typing.DateTime]
19
+ report_type: pa.typing.Series[str]
20
+ standard_date: pa.typing.Series[pa.typing.DateTime]
@@ -0,0 +1,20 @@
1
+ """Security (securities firm) financial statement models."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class SecurityStatementSchema(pa.DataFrameModel):
7
+ """Security (securities firm) financial statement model."""
8
+
9
+ class Config:
10
+ """Pandera configuration."""
11
+
12
+ coerce = True
13
+ strict = False # Allow extra metrics columns
14
+
15
+ date: pa.typing.Series[pa.typing.DateTime]
16
+ stock_code: pa.typing.Series[str]
17
+ currency: pa.typing.Series[str]
18
+ report_date: pa.typing.Series[pa.typing.DateTime]
19
+ report_type: pa.typing.Series[str]
20
+ standard_date: pa.typing.Series[pa.typing.DateTime]
@@ -12,6 +12,7 @@ from lixinger.models.cn.index.fs import (
12
12
  )
13
13
  from lixinger.models.cn.index.fundamental import IndexFundamentalData
14
14
  from lixinger.models.cn.index.index import Index
15
+ from lixinger.models.cn.index.margin_trading import IndexMarginTrading
15
16
  from lixinger.models.cn.index.tracking_fund import TrackingFund
16
17
 
17
18
  __all__ = [
@@ -21,6 +22,7 @@ __all__ = [
21
22
  "IndexCandlestick",
22
23
  "IndexDrawdown",
23
24
  "IndexFundamentalData",
25
+ "IndexMarginTrading",
24
26
  "TrackingFund",
25
27
  # Index financial statements
26
28
  "IndexBankStatementSchema",
@@ -0,0 +1,30 @@
1
+ """Index margin trading and securities lending models."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class IndexMarginTrading(pa.DataFrameModel):
7
+ """Index margin trading and securities lending model.
8
+
9
+ Represents the daily margin trading (融资) and securities lending (融券)
10
+ metrics for an index.
11
+ """
12
+
13
+ class Config:
14
+ """Pandera configuration."""
15
+
16
+ coerce = True
17
+ strict = False
18
+
19
+ date: pa.typing.Series[pa.typing.DateTime]
20
+ stock_code: pa.typing.Series[str]
21
+ financing_purchase_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
22
+ financing_repayment_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
23
+ financing_net_purchase_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
24
+ financing_balance: pa.typing.Series[float] | None = pa.Field(nullable=True)
25
+ securities_sell_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
26
+ securities_repayment_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
27
+ securities_net_sell_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
28
+ securities_balance: pa.typing.Series[float] | None = pa.Field(nullable=True)
29
+ financing_balance_to_market_cap: pa.typing.Series[float] | None = pa.Field(nullable=True)
30
+ securities_balance_to_market_cap: pa.typing.Series[float] | None = pa.Field(nullable=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lixinger-python
3
- Version: 0.3.7
3
+ Version: 0.3.9
4
4
  Summary: Python SDK for Lixinger Financial Data API
5
5
  Project-URL: Homepage, https://www.lixinger.com
6
6
  Project-URL: Documentation, https://www.lixinger.com/open/api/doc
@@ -1,5 +1,5 @@
1
- lixinger/__init__.py,sha256=WhuTjjENkj2h5Qr66PNfv41AGV6hKNdGi87borIqeBw,2445
2
- lixinger/client.py,sha256=djI2Lf4a09Vkdm7ManJs4WVP_cDS-_coqT3h2Eg4UHc,11296
1
+ lixinger/__init__.py,sha256=q-HBT1HyVJ6NKlsP_T6T5WCq_bYn330wAo9bsfD-lNQ,2750
2
+ lixinger/client.py,sha256=8_V2T4e0_4D1UVN_1lBpg4YKYhdV4c_OTWnhy_wpx18,12712
3
3
  lixinger/config.py,sha256=JPz8EOrf1kP4Do-Z5-MsnOM0pMrNE1ZsP-Qoarh9y4c,2008
4
4
  lixinger/exceptions.py,sha256=eWSDO-3CRESPsfzomzMc-9NYPBQ1EEPJ_CPSIo-UlDM,508
5
5
  lixinger/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,10 +13,14 @@ lixinger/api/cn/company/company.py,sha256=D6yhmFPzhdWadBsNka-8h4mkbKjD4HoBFQCw72
13
13
  lixinger/api/cn/company/dividend.py,sha256=21AWQbi56G7wVf8sv_YSy-Qy36OFKSvB9L2M3cbslGc,2658
14
14
  lixinger/api/cn/company/equity_change.py,sha256=hf2SZhvCcYvu1lRhEz-b61yo9D7mDckKJSerAxGvsXI,2356
15
15
  lixinger/api/cn/company/indices.py,sha256=GFoCf58DDh1a4Fx4lGaqPmk9NBW0hlRbnaIYoXBtFXI,1161
16
- lixinger/api/cn/company/namespace.py,sha256=qNyzM0qHwf9sJUTSZpb-_gaJYpT62oTUJinJzYpC7RE,5117
16
+ lixinger/api/cn/company/namespace.py,sha256=gb50qxxtgGcFycHLrW05hCEnz31KA32Ey8ljo2rCoDw,6854
17
17
  lixinger/api/cn/company/profile.py,sha256=iMwR5REcJNhKvS3hpWg6bCD1DOH-7fSN21zoIeRIh3k,1691
18
- lixinger/api/cn/company/fs/__init__.py,sha256=1UCVekvwGy7quda_gJoVH5BjttJqA7Yeo0HZ_tn1RWQ,159
19
- lixinger/api/cn/company/fs/non_financial.py,sha256=Gm9S5LMvlGCEEUz7PgnwabSN86A-1I_VU7WARGaW-UI,2330
18
+ lixinger/api/cn/company/fs/__init__.py,sha256=B21nlQ_kwTvtwGbRovbsPQfDuj5rf3YqNp03orgpV0g,1281
19
+ lixinger/api/cn/company/fs/bank.py,sha256=rdUvFNVWwF1ZCMzy_a6Sc7e-NUykb8OfU4MnAL-EUI4,4514
20
+ lixinger/api/cn/company/fs/insurance.py,sha256=s94yd80Yl6N3RI30Bz2062MbKOmiDcg6VUW_uuNztx8,4629
21
+ lixinger/api/cn/company/fs/non_financial.py,sha256=gMyco2L4OARQoL_EQuTQHKXCES1PjvL45kSFTLZUFSU,2599
22
+ lixinger/api/cn/company/fs/other_financial.py,sha256=yRycb5LgacdgGQ1jBidaMCDvc4PysYHoMUwshMLUzUU,4722
23
+ lixinger/api/cn/company/fs/security.py,sha256=AW6x--bA2dgNj5SL17f0lHg1XM76BNOlGXxqYlo_rZw,4645
20
24
  lixinger/api/cn/company/fundamental/__init__.py,sha256=7UQG9tNv-RBELrUnN1OV218jcaT2Auf5oNIXxvLNo8s,1357
21
25
  lixinger/api/cn/company/fundamental/bank.py,sha256=bvLh7XovjaCWC2k3MKucVr57S0EgK1flqv08zuPERCM,3386
22
26
  lixinger/api/cn/company/fundamental/insurance.py,sha256=INs9UaqaRCTdv8yz09SdSZzWbUUXQRGQ39ndIBiVkm8,3497
@@ -31,14 +35,15 @@ lixinger/api/cn/fund/candlestick.py,sha256=XdkxjtjIT1ixNzOArJRKBvlabTHz3PA9w2zsG
31
35
  lixinger/api/cn/fund/fund.py,sha256=Y1ysdyl1zpu71iiFR4G6ixqBT4Kb9PxSWk_oFpFVeMI,1624
32
36
  lixinger/api/cn/fund/profile.py,sha256=kTbqmz3obYRNjFjkD74I-R3x0SBsZCqI0KPjiWe84QI,1347
33
37
  lixinger/api/cn/fund/shareholdings.py,sha256=aGFsyBiIW-wsbpAnwnAnRY6duiBKeYbQVKfpdQXs3tY,2358
34
- lixinger/api/cn/index/__init__.py,sha256=IylYWSnDd5KD5HbTAoiJRgBkasYf53YurKxf5pFwdgc,1594
38
+ lixinger/api/cn/index/__init__.py,sha256=WH01vjbnqWE5gAxU7R8l8NQmfjGacmWgbFiVSBCF7-8,1765
35
39
  lixinger/api/cn/index/candlestick.py,sha256=MdFGWf3pSoqPtzkCQJbSY1b6vw1nmZ6lKmgxdFMIMlo,2356
36
40
  lixinger/api/cn/index/constituent_weightings.py,sha256=UuAmqhgapMAMW6qZge3yKb9E9h7WNuZZ83sLkZIq-rA,3352
37
41
  lixinger/api/cn/index/constituents.py,sha256=8kQjTJER8PqpZMTQWusDK9mbQ27YLYgYxw8u_vHqsy4,3372
38
42
  lixinger/api/cn/index/drawdown.py,sha256=D-fhA-Sv2-gf6VzX0zG1dm7Tn5Wy7NK1IB-f5kFXi7w,2450
39
43
  lixinger/api/cn/index/fundamental.py,sha256=MyhGmMk7GkOZflpT0JMoiLsCs3DLMLLkopyUsD94Y4Q,2474
40
44
  lixinger/api/cn/index/index.py,sha256=5gDwE5K3tYNlCrV-EsSC4HXhfIi58uqWpHQxTt9LJMk,4177
41
- lixinger/api/cn/index/namespace.py,sha256=pzYkQzYqu5TASTZxk5IQJDqt2U7oTbTzwBErfp2aKxE,5559
45
+ lixinger/api/cn/index/margin_trading.py,sha256=Tr5nXXC5H38FoAB5RoiTysr2wQEB0K4i4eKcEZnV4dw,4161
46
+ lixinger/api/cn/index/namespace.py,sha256=QBEZRoLfMnQI6NABBXpuEwIqgv0p1TxllCBUwQwd3HM,6048
42
47
  lixinger/api/cn/index/tracking_fund.py,sha256=su0zJRROKuTZlHe0XkIQz8kJOyPZmyg7HxZIbmpM_YM,1960
43
48
  lixinger/api/cn/index/fs/__init__.py,sha256=eQTxjzZfiqxDU8WdLA-deAtus-nYEiO2mLq2gOkFTts,1060
44
49
  lixinger/api/cn/index/fs/bank.py,sha256=zjDB_d06E_gxAvVNyk9Byoa5ShlevNoc75z5gVBH6aY,4416
@@ -54,8 +59,12 @@ lixinger/models/cn/company/company.py,sha256=BJRUWLifoxMVN3umOw99t8thaFcuwK244Hv
54
59
  lixinger/models/cn/company/dividend.py,sha256=yvIEHtNbj22eZOG_XPCLL-zCJLefe6DjomDiRpNwqU4,2044
55
60
  lixinger/models/cn/company/equity_change.py,sha256=8I0u8Jkfj-bnIpQi_0YHpYhrPK-1X0BON_9YcIbLVzk,860
56
61
  lixinger/models/cn/company/indices.py,sha256=Dxi_lAZPEWy3evcUHArsST0oTmJHyYAcT2Y8suqZQdc,349
57
- lixinger/models/cn/company/fs/__init__.py,sha256=qYUQzRdsr7vvyczQ-79ntZvRkHQWSnkQxIXWA81-nqA,162
62
+ lixinger/models/cn/company/fs/__init__.py,sha256=LPqxRhIlzOrV_c9RUFDxIVP25N1QtyQnDvBCAqKdn1s,603
63
+ lixinger/models/cn/company/fs/bank.py,sha256=y5F-RdMoHzOMXc0ZF9_bpqHn3eKSoyAh1tsxPrZdbgk,562
64
+ lixinger/models/cn/company/fs/insurance.py,sha256=XCr1DU2r474cctVpz5VETuNQEWyGZMXQ_NqDCvg78kM,577
58
65
  lixinger/models/cn/company/fs/non_financial.py,sha256=t2C5_dqvX1DUF_iR54UiCxis4O84YU1bUTZRdYCiaT8,568
66
+ lixinger/models/cn/company/fs/other_financial.py,sha256=gEE1axWGFcyT6JW5jtkKzbaCg2NpnPTiyfkR84Doy7w,610
67
+ lixinger/models/cn/company/fs/security.py,sha256=PdG6_w96h55ppEQMiI-j5FQS4U4bRukMG9EQHKWIImM,610
59
68
  lixinger/models/cn/company/fundamental/__init__.py,sha256=tZ-Byn1jlkN9du6s9hzcSojUGDTQ1kDJ_QqTRnnqUik,665
60
69
  lixinger/models/cn/company/fundamental/bank.py,sha256=CvqEfU3btDWlphJTDWMxlUyTiAPU80a4zzpeFueZAWU,373
61
70
  lixinger/models/cn/company/fundamental/insurance.py,sha256=-bP3VeKr-0yYvGuZnolCxvoU9R4Yg3-w8czskWUpK1g,404
@@ -70,13 +79,14 @@ lixinger/models/cn/fund/candlestick.py,sha256=JSmEPTIB992Mujb6qBBX3NUTq9tafoJdNh
70
79
  lixinger/models/cn/fund/fund.py,sha256=IQQJic7dL58eM00E6DDY9beePpqJSqxu6E1DW0-X3iY,762
71
80
  lixinger/models/cn/fund/profile.py,sha256=j02zgDXdFC9zLPcEgNKpoxIeHLac27ySngU6Vikh_V4,1202
72
81
  lixinger/models/cn/fund/shareholdings.py,sha256=67cJfRGBjMRwI6f1RQbg-Hnb-SK620gKIphvCdjNzOk,611
73
- lixinger/models/cn/index/__init__.py,sha256=NxxKPPv3qg-nVA3UHmWIbKLaMKTKHBcc01PyWcq7P7s,1002
82
+ lixinger/models/cn/index/__init__.py,sha256=Q2dtEiJmZzPt7w47nxIXmfm_A_87OPM0IT-IbadD02k,1099
74
83
  lixinger/models/cn/index/candlestick.py,sha256=So3ArqKge-reoeAn5E26I1fQusPks6jtvfHVNKF_yY0,560
75
84
  lixinger/models/cn/index/constituent_weightings.py,sha256=Vr68TyJ6mjXtKMUD-d_daG2CR1GJ60ipAfK-HhdXZVo,370
76
85
  lixinger/models/cn/index/constituents.py,sha256=UDVCoQsKahMhlF9Os-Xgo0XRg6dfH5WBBiOuQMlPqz8,371
77
86
  lixinger/models/cn/index/drawdown.py,sha256=kvrhy7_fIjvUHXFTUn3TXqSNip7vZXpfWjlypmXxvLw,332
78
87
  lixinger/models/cn/index/fundamental.py,sha256=4gBOFADCq1C0pcSa9JfxDkH-3spRErkg3LwVJyYrGvU,374
79
88
  lixinger/models/cn/index/index.py,sha256=M_ZYGGfcpWXrmwhz58HfojInsmAUQeZSNJ74sAqTbqA,842
89
+ lixinger/models/cn/index/margin_trading.py,sha256=NLPZ0BrPLNyaSunw0LiCKKd5Ys-DMLHMhw3ezS_40rM,1379
80
90
  lixinger/models/cn/index/tracking_fund.py,sha256=qbsdMlD0FBpWDBWS8smOeqK_hJOp8OzkT2NA0Zn_k-s,424
81
91
  lixinger/models/cn/index/fs/__init__.py,sha256=CMHJ7UaslJYuUkynpd_yADsP8gsNFEOS67kng5Ryvok,507
82
92
  lixinger/models/cn/index/fs/bank.py,sha256=DA_sRFSsK5IE0JQtp3pHdvPJQxbipHsSyKahcBbaZ-U,559
@@ -89,7 +99,7 @@ lixinger/utils/dataframe.py,sha256=tYBrNdmJ4poyuwD-9XgzHt3A_A8bBo0cdHiu8Yy9e9A,2
89
99
  lixinger/utils/dict.py,sha256=yvbUtv8QpRmy0d_o_7gCuEwwiEfBji5_xB490ANxilw,589
90
100
  lixinger/utils/rate_limiter.py,sha256=DCaG87kIjDU5triYHU33-FW7h6KsbELBnU9f6mCQKCU,1133
91
101
  lixinger/utils/retry.py,sha256=sXtb0ESp12_JedjzDxoeIH48TlOrbxtIA0j1V33DW7M,1026
92
- lixinger_python-0.3.7.dist-info/METADATA,sha256=Kom1Z2xPM3d87I39ccLzH4zTSz_Vwc-UZohr9DZqAhQ,9206
93
- lixinger_python-0.3.7.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
94
- lixinger_python-0.3.7.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
95
- lixinger_python-0.3.7.dist-info/RECORD,,
102
+ lixinger_python-0.3.9.dist-info/METADATA,sha256=-8w_eCbpNhcG4vO_pGo4st1wPJ1Xozb7Je-tC8ETYu4,9206
103
+ lixinger_python-0.3.9.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
104
+ lixinger_python-0.3.9.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
105
+ lixinger_python-0.3.9.dist-info/RECORD,,