bw-essentials-core 0.1.11__py3-none-any.whl → 0.1.13__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.
Potentially problematic release.
This version of bw-essentials-core might be problematic. Click here for more details.
- bw_essentials/constants/services.py +1 -0
- bw_essentials/services/job_scheduler.py +60 -0
- bw_essentials/services/user_portfolio.py +2 -2
- {bw_essentials_core-0.1.11.dist-info → bw_essentials_core-0.1.13.dist-info}/METADATA +1 -1
- {bw_essentials_core-0.1.11.dist-info → bw_essentials_core-0.1.13.dist-info}/RECORD +7 -6
- {bw_essentials_core-0.1.11.dist-info → bw_essentials_core-0.1.13.dist-info}/WHEEL +0 -0
- {bw_essentials_core-0.1.11.dist-info → bw_essentials_core-0.1.13.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from bw_essentials.constants.services import Services
|
|
3
|
+
from bw_essentials.services.api_client import ApiClient
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class JobScheduler(ApiClient):
|
|
9
|
+
"""
|
|
10
|
+
Class for making API calls to the Job Scheduler Service.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
user (str): The user for whom the API calls are being made.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, user):
|
|
17
|
+
"""
|
|
18
|
+
Initialize the Job Scheduler object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
user (str): The user for whom the API calls are being made.
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(user)
|
|
24
|
+
self.base_url = self.get_base_url(Services.JOB_SCHEDULER.value)
|
|
25
|
+
self.api_key = self.get_api_key(Services.JOB_SCHEDULER.value)
|
|
26
|
+
self.name = Services.JOB_SCHEDULER.value
|
|
27
|
+
self.urls = {
|
|
28
|
+
"process_user_profile": "taskmanager/process/user-portfolios/"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def _headers(self):
|
|
32
|
+
"""
|
|
33
|
+
Prepares headers for API calls.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
dict: Headers
|
|
37
|
+
"""
|
|
38
|
+
return {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
'x-api-key': self.api_key
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def process_user_profile(self, data):
|
|
44
|
+
"""
|
|
45
|
+
Send a request to process a user profile.
|
|
46
|
+
|
|
47
|
+
This method prepares the required headers and sends a POST request
|
|
48
|
+
to the `process_user_profile` endpoint with the provided user data.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
data (dict): A dictionary containing user profile information
|
|
52
|
+
to be sent in the request body.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
None: The method does not return a value.
|
|
56
|
+
"""
|
|
57
|
+
logger.info(f"In - process_user_profile {self.user =}")
|
|
58
|
+
self.headers = self._headers()
|
|
59
|
+
self._post(url=self.base_url, endpoint=self.urls.get('process_user_profile'), json=data)
|
|
60
|
+
logger.info(f"Out - process_user_profile")
|
|
@@ -440,7 +440,7 @@ class UserPortfolio(ApiClient):
|
|
|
440
440
|
logger.info(f"In create_user_portfolio_threshold {payload =}")
|
|
441
441
|
data = self._post(url=self.base_url,
|
|
442
442
|
endpoint=self.urls.get("user_portfolio_thresholds"),
|
|
443
|
-
|
|
443
|
+
json=payload)
|
|
444
444
|
logger.info(f"{data =}")
|
|
445
445
|
return data.get("data")
|
|
446
446
|
|
|
@@ -522,7 +522,7 @@ class UserPortfolio(ApiClient):
|
|
|
522
522
|
logger.info(f"In create_holding_threshold {payload =}")
|
|
523
523
|
data = self._post(url=self.base_url,
|
|
524
524
|
endpoint=self.urls.get("holding_thresholds"),
|
|
525
|
-
|
|
525
|
+
json=payload)
|
|
526
526
|
logger.info(f"{data =}")
|
|
527
527
|
return data.get("data")
|
|
528
528
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
bw_essentials/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
bw_essentials/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
bw_essentials/constants/services.py,sha256=
|
|
3
|
+
bw_essentials/constants/services.py,sha256=HxeM05zJP1oCqwLRLb9wLxAOCmbdu-jWgtlmnPE4KFU,900
|
|
4
4
|
bw_essentials/data_loch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
bw_essentials/data_loch/data_loch.py,sha256=iJO0oPhZyQjoUZOaeBP1nsbuc5iR9ZNWoAXj2pGEpT8,11716
|
|
6
6
|
bw_essentials/email_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -13,6 +13,7 @@ bw_essentials/s3_utils/s3_utils.py,sha256=wzjVrTX22_8PMX86svKFYGMZwgjBHbOaeEsxO-
|
|
|
13
13
|
bw_essentials/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
bw_essentials/services/api_client.py,sha256=5XFbdw5gfxXz7mQlLWNC8efDrvZgAztM-Oo0Dp1jDF8,8215
|
|
15
15
|
bw_essentials/services/broker.py,sha256=W4y31K7dF4LHfQSvnAwVWfGoYKkdz-W2TXqTLhkUxn8,9348
|
|
16
|
+
bw_essentials/services/job_scheduler.py,sha256=AmlaYJsCCjHxTg9MQ58dMuiZOUDfxmbd43jzN4L-lNU,1834
|
|
16
17
|
bw_essentials/services/market_pricer.py,sha256=Qc9lxzAjhefAvjyEKsBPDu60bF6_61cnSpZNfjGMyDg,11755
|
|
17
18
|
bw_essentials/services/master_data.py,sha256=2o_r2gdhIKBeTFgn5IIY-becgCEpYBymO4BKmixdV1g,11987
|
|
18
19
|
bw_essentials/services/model_portfolio_reporting.py,sha256=iOtm4gyfU8P7C0R1gp6gUJI4ZRxJD5K2GLOalI_gToM,3249
|
|
@@ -22,9 +23,9 @@ bw_essentials/services/portfolio_catalogue.py,sha256=F4ne1eF6Koj0CCV1j07ebIgIlRC
|
|
|
22
23
|
bw_essentials/services/portfolio_content.py,sha256=rdFTTsUUIt-AgFfA1SAItqg2njakVOm4dUKU0FHZQ2E,2148
|
|
23
24
|
bw_essentials/services/trade_placement.py,sha256=PrzeU2XXC9HF1IQ1dMDM_ZHxmC491sOl-JbA6GWPwII,20772
|
|
24
25
|
bw_essentials/services/user_app.py,sha256=jEpdT2W0Bj65xwQG2X1wnsQQEvjMHMbtjuvuYlzhJ6Q,11773
|
|
25
|
-
bw_essentials/services/user_portfolio.py,sha256=
|
|
26
|
+
bw_essentials/services/user_portfolio.py,sha256=uUQUCG8Av8eKBIw-TlNtOPpQluO9HjAkxMzzO5jfzbo,22179
|
|
26
27
|
bw_essentials/services/user_portfolio_reporting.py,sha256=pwqfW95LTiGOGufcTphljFxPlOd-G4Q263UtoQURPxM,6772
|
|
27
|
-
bw_essentials_core-0.1.
|
|
28
|
-
bw_essentials_core-0.1.
|
|
29
|
-
bw_essentials_core-0.1.
|
|
30
|
-
bw_essentials_core-0.1.
|
|
28
|
+
bw_essentials_core-0.1.13.dist-info/METADATA,sha256=DTCc-XwQdanVEFfUW9HP4I30NGEEaFvlifdkmDudjDg,7502
|
|
29
|
+
bw_essentials_core-0.1.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
bw_essentials_core-0.1.13.dist-info/top_level.txt,sha256=gDc5T_y5snwKGXDQUusEus-FEt0RFwG644Yn_58wQOQ,14
|
|
31
|
+
bw_essentials_core-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|