DYAMS 0.8__py3-none-any.whl → 0.11__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.
DYAMS/__init__.py CHANGED
@@ -11,6 +11,10 @@ def get_post_investment_product_holdings(*args, **kwargs):
11
11
  return Client.get_instance().get_post_investment_product_holdings(*args, **kwargs)
12
12
 
13
13
 
14
+ def get_post_investment_product_holdings_hierarchy(*args, **kwargs):
15
+ return Client.get_instance().get_post_investment_product_holdings_hierarchy(*args, **kwargs)
16
+
17
+
14
18
  def get_post_investment_product_performance_indicators(*args, **kwargs):
15
19
  return Client.get_instance().get_post_investment_product_performance_indicators(*args, **kwargs)
16
20
 
@@ -28,15 +28,33 @@ def get_post_investment_product_asset_allocation(client,
28
28
  elif not start_date or not end_date:
29
29
  raise ValueError("start_date and end_date are required")
30
30
 
31
+ if isinstance(penetrate_type, PenetrateType):
32
+ penetrate_type_value = penetrate_type.name
33
+ elif isinstance(penetrate_type, str):
34
+ if penetrate_type not in PenetrateType._member_names_:
35
+ raise ValueError("不支持的穿透方式")
36
+ penetrate_type_value = penetrate_type
37
+ else:
38
+ penetrate_type_value = PenetrateType.NO_PENETRATE.name
39
+
40
+ if isinstance(weight_types, WeightType):
41
+ weight_types_value = weight_types.name
42
+ elif isinstance(weight_types, str):
43
+ if weight_types not in WeightType._member_names_:
44
+ raise ValueError("不支持的权重类型")
45
+ weight_types_value = weight_types
46
+ else:
47
+ weight_types_value = WeightType.TOTAL_FILTERED.name
48
+
31
49
  url = f"{client.base_url}/lib/portfolio/v1/positionDistribution"
32
50
  data = {
33
51
  'accountCode': post_investment_product_id,
34
52
  'startDate': start_date,
35
53
  'endDate': end_date,
36
- 'penetrateWay': penetrate_type.name if penetrate_type else PenetrateType.NO_PENETRATE,
54
+ 'penetrateWay': penetrate_type_value,
37
55
  'level': level,
38
56
  'assetCategoryName': asset_class,
39
- 'ratioAssetType': weight_types.name if weight_types else WeightType.TOTAL_FILTERED,
57
+ 'ratioAssetType': weight_types_value,
40
58
  'securityTypes': [security_type.name for security_type in asset_sceening]
41
59
  }
42
60
  headers = client.get_headers()
@@ -109,18 +109,6 @@ field_mapping = {
109
109
  'fxRate': 'valuation_exchange_rate',
110
110
  'positionTime': 'market_quotation_time',
111
111
  'holdDate': 'position_building_date',
112
- 'partyFullName': 'issuing_entity',
113
- 'yearToMaturity': 'remaining_maturity',
114
- 'nominalRatingInst': 'bond_rating_agency',
115
- 'nominalRating': 'bond_rating',
116
- 'margin': 'margin_requirement',
117
- 'city': 'city',
118
- 'province': 'province',
119
- 'instRatingYY': 'issuer_rating_(YY)',
120
- 'instRatingDate': 'issuer_rating_date',
121
- 'instRating': 'issuer_rating',
122
- 'nominalRatingDate': 'bond_rating_date',
123
- 'instRatingInst': 'issuer_rating_agency'
124
112
  }
125
113
 
126
114
 
@@ -140,12 +128,21 @@ def get_post_investment_product_holdings(client,
140
128
  elif not start_date or not end_date:
141
129
  raise ValueError("start_date and end_date are required")
142
130
 
131
+ if isinstance(penetrate_type, PenetrateType):
132
+ penetrate_type_value = penetrate_type.name
133
+ elif isinstance(penetrate_type, str):
134
+ if penetrate_type not in PenetrateType._member_names_:
135
+ raise ValueError("不支持的穿透方式")
136
+ penetrate_type_value = penetrate_type
137
+ else:
138
+ penetrate_type_value = PenetrateType.NO_PENETRATE.name
139
+
143
140
  url = f"{client.base_url}/lib/portfolio/v1/position"
144
141
  data = {
145
142
  'accountCode': post_investment_product_id,
146
143
  'startDate': start_date,
147
144
  'endDate': end_date,
148
- 'penetrateWay': penetrate_type.name if penetrate_type else PenetrateType.NO_PENETRATE,
145
+ 'penetrateWay': penetrate_type_value,
149
146
  'level': level,
150
147
  'assetCategoryName': asset_class
151
148
  }
@@ -0,0 +1,21 @@
1
+ import requests
2
+ from .util import get_response_json_with_check
3
+
4
+
5
+ def get_post_investment_product_holdings_hierarchy(client,
6
+ post_investment_product_id,
7
+ date):
8
+
9
+ url = f"{client.base_url}/lib/portfolio/v1/positionHierarchy"
10
+ data = {
11
+ 'accountCode': post_investment_product_id,
12
+ 'date': date
13
+ }
14
+ headers = client.get_headers()
15
+ try:
16
+ response = requests.post(url, headers=headers, json=data)
17
+ r = get_response_json_with_check(response)
18
+
19
+ return r
20
+ except Exception as e:
21
+ raise e
DYAMS/api/util.py CHANGED
@@ -6,5 +6,5 @@ def get_response_json_with_check(response):
6
6
  if r.get('code') == -403:
7
7
  raise Exception("token认证失败")
8
8
  if r.get('code') != 'S00000':
9
- raise Exception(r.get('message'))
9
+ raise Exception(r.get('msg'))
10
10
  return r
DYAMS/client.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from .api.heartbeat import heartbeat
2
2
  from .api.get_post_investment_product_list import get_post_investment_product_list
3
3
  from .api.get_post_investment_product_holdings import get_post_investment_product_holdings
4
+ from .api.get_post_investment_product_holdings_hierarchy import get_post_investment_product_holdings_hierarchy
4
5
  from .api.get_post_investment_product_performance_indicators import get_post_investment_product_performance_indicators
5
6
  from .api.get_post_investment_product_net import get_post_investment_product_net
6
7
  from .api.get_post_investment_product_asset_allocation import get_post_investment_product_asset_allocation
@@ -39,6 +40,7 @@ class Client:
39
40
 
40
41
  Client.get_post_investment_product_list = get_post_investment_product_list
41
42
  Client.get_post_investment_product_holdings = get_post_investment_product_holdings
43
+ Client.get_post_investment_product_holdings_hierarchy = get_post_investment_product_holdings_hierarchy
42
44
  Client.get_post_investment_product_performance_indicators = get_post_investment_product_performance_indicators
43
45
  Client.get_post_investment_product_net = get_post_investment_product_net
44
46
  Client.get_post_investment_product_asset_allocation = get_post_investment_product_asset_allocation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DYAMS
3
- Version: 0.8
3
+ Version: 0.11
4
4
  Summary: 通联数据AMS系统数据SDK
5
5
  Author-email: songjiangduo <jiangduo.song@datayes.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,18 @@
1
+ DYAMS/__init__.py,sha256=fXAonP2oCy8DRX9uuOtrLAQCxzPthNmxEzuaGX_Hzz0,1101
2
+ DYAMS/client.py,sha256=ftFBaLlq7d-61ZiCA1BbOKvR3-FpycSdnMz02fequNY,2144
3
+ DYAMS/enums.py,sha256=rW9y7n1G_eYvPyokSN5OrPAp4-raQWB-hTWH4NIFrC8,2490
4
+ DYAMS/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ DYAMS/api/get_post_investment_product_asset_allocation.py,sha256=CaUJFkhnuKqm6mEOCMksa4Eoj7y4cnFle8Xf613p-9s,2819
6
+ DYAMS/api/get_post_investment_product_holdings.py,sha256=j_b2i4M5UxyBXhMkOaMsN92ol7fumUXi7Xovyk__zjY,6518
7
+ DYAMS/api/get_post_investment_product_holdings_hierarchy.py,sha256=QL_iJ4LYOBN_wtHc-9TeqFOX9caBPlhBnOfVxwU6JCs,641
8
+ DYAMS/api/get_post_investment_product_list.py,sha256=lomv2qu04AFQivS2NvenYaLBYn53_P1hyxlBA2m0eJM,1515
9
+ DYAMS/api/get_post_investment_product_net.py,sha256=TWrnKKTp8AGS0Mwe-Wo2t64fXGcVhoFi7ujNjvqPhRo,1103
10
+ DYAMS/api/get_post_investment_product_performance_indicators.py,sha256=EDLz5xswVoBuDETEOXYeUxYu19USZH21rFpMUXaUs6s,1486
11
+ DYAMS/api/get_private_asset_net.py,sha256=os5BzEwpXtQr4_GFJj9-oLmVc6WqxW1IIzJAOzXYrUI,1128
12
+ DYAMS/api/heartbeat.py,sha256=jDjiXRqee4QtGKR7nEoo4VhnlG_wvjT3aMXYizTNt1M,333
13
+ DYAMS/api/util.py,sha256=m8e139aQZs6IwsjstAnZdCuAqTdVheQ74NixtwLTgKg,301
14
+ dyams-0.11.dist-info/licenses/LICENSE,sha256=WOCX9n2629PC9kRp-MvyMGR4DrNHG7_Q1Woo6QotwZ4,1130
15
+ dyams-0.11.dist-info/METADATA,sha256=_LsPrkS6sRkSC0caDdlT6_AaxURpjNT50iZp3MZUl58,438
16
+ dyams-0.11.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
17
+ dyams-0.11.dist-info/top_level.txt,sha256=7vYrzyi90ywuwd-c24CKytuWbuILmzcU7kQYCuBu7No,6
18
+ dyams-0.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,17 +0,0 @@
1
- DYAMS/__init__.py,sha256=vS1EplSNSpQk9ecUZbKlnkgTurMmZj2exA9OOActxY4,933
2
- DYAMS/client.py,sha256=x-s7htAgveg8uiI8T8bRGk9xh_56admnjN61AZHUCnA,1930
3
- DYAMS/enums.py,sha256=rW9y7n1G_eYvPyokSN5OrPAp4-raQWB-hTWH4NIFrC8,2490
4
- DYAMS/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- DYAMS/api/get_post_investment_product_asset_allocation.py,sha256=LbUDdQdcoE0zBS6c7rhFZqdC_qEJhg23PQsacBrmLLA,2171
6
- DYAMS/api/get_post_investment_product_holdings.py,sha256=RWt8ci7ypHs_zyz0LwO8O__sVH63ADUWRaJYcPCJNpg,6645
7
- DYAMS/api/get_post_investment_product_list.py,sha256=lomv2qu04AFQivS2NvenYaLBYn53_P1hyxlBA2m0eJM,1515
8
- DYAMS/api/get_post_investment_product_net.py,sha256=TWrnKKTp8AGS0Mwe-Wo2t64fXGcVhoFi7ujNjvqPhRo,1103
9
- DYAMS/api/get_post_investment_product_performance_indicators.py,sha256=EDLz5xswVoBuDETEOXYeUxYu19USZH21rFpMUXaUs6s,1486
10
- DYAMS/api/get_private_asset_net.py,sha256=os5BzEwpXtQr4_GFJj9-oLmVc6WqxW1IIzJAOzXYrUI,1128
11
- DYAMS/api/heartbeat.py,sha256=jDjiXRqee4QtGKR7nEoo4VhnlG_wvjT3aMXYizTNt1M,333
12
- DYAMS/api/util.py,sha256=VVoNbaPTyySwyrGJ60pdUPja2gWUyNBJBxY4l_xRSr8,305
13
- dyams-0.8.dist-info/licenses/LICENSE,sha256=WOCX9n2629PC9kRp-MvyMGR4DrNHG7_Q1Woo6QotwZ4,1130
14
- dyams-0.8.dist-info/METADATA,sha256=tVutXd6FREZ2ZFQ8gAU7XJW88PLu47A6P-xnmk7Goxo,437
15
- dyams-0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- dyams-0.8.dist-info/top_level.txt,sha256=7vYrzyi90ywuwd-c24CKytuWbuILmzcU7kQYCuBu7No,6
17
- dyams-0.8.dist-info/RECORD,,