everysk-lib 1.10.2__cp312-cp312-win_amd64.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.
- everysk/__init__.py +30 -0
- everysk/_version.py +683 -0
- everysk/api/__init__.py +61 -0
- everysk/api/api_requestor.py +167 -0
- everysk/api/api_resources/__init__.py +23 -0
- everysk/api/api_resources/api_resource.py +371 -0
- everysk/api/api_resources/calculation.py +779 -0
- everysk/api/api_resources/custom_index.py +42 -0
- everysk/api/api_resources/datastore.py +81 -0
- everysk/api/api_resources/file.py +42 -0
- everysk/api/api_resources/market_data.py +223 -0
- everysk/api/api_resources/parser.py +66 -0
- everysk/api/api_resources/portfolio.py +43 -0
- everysk/api/api_resources/private_security.py +42 -0
- everysk/api/api_resources/report.py +65 -0
- everysk/api/api_resources/report_template.py +39 -0
- everysk/api/api_resources/tests.py +115 -0
- everysk/api/api_resources/worker_execution.py +64 -0
- everysk/api/api_resources/workflow.py +65 -0
- everysk/api/api_resources/workflow_execution.py +93 -0
- everysk/api/api_resources/workspace.py +42 -0
- everysk/api/http_client.py +63 -0
- everysk/api/tests.py +32 -0
- everysk/api/utils.py +262 -0
- everysk/config.py +451 -0
- everysk/core/_tests/serialize/test_json.py +336 -0
- everysk/core/_tests/serialize/test_orjson.py +295 -0
- everysk/core/_tests/serialize/test_pickle.py +48 -0
- everysk/core/cloud_function/main.py +78 -0
- everysk/core/cloud_function/tests.py +86 -0
- everysk/core/compress.py +245 -0
- everysk/core/datetime/__init__.py +12 -0
- everysk/core/datetime/calendar.py +144 -0
- everysk/core/datetime/date.py +424 -0
- everysk/core/datetime/date_expression.py +299 -0
- everysk/core/datetime/date_mixin.py +1475 -0
- everysk/core/datetime/date_settings.py +30 -0
- everysk/core/datetime/datetime.py +713 -0
- everysk/core/exceptions.py +435 -0
- everysk/core/fields.py +1176 -0
- everysk/core/firestore.py +555 -0
- everysk/core/fixtures/_settings.py +29 -0
- everysk/core/fixtures/other/_settings.py +18 -0
- everysk/core/fixtures/user_agents.json +88 -0
- everysk/core/http.py +691 -0
- everysk/core/lists.py +92 -0
- everysk/core/log.py +709 -0
- everysk/core/number.py +37 -0
- everysk/core/object.py +1469 -0
- everysk/core/redis.py +1021 -0
- everysk/core/retry.py +51 -0
- everysk/core/serialize.py +674 -0
- everysk/core/sftp.py +414 -0
- everysk/core/signing.py +53 -0
- everysk/core/slack.py +127 -0
- everysk/core/string.py +199 -0
- everysk/core/tests.py +240 -0
- everysk/core/threads.py +199 -0
- everysk/core/undefined.py +70 -0
- everysk/core/unittests.py +73 -0
- everysk/core/workers.py +241 -0
- everysk/sdk/__init__.py +23 -0
- everysk/sdk/base.py +98 -0
- everysk/sdk/brutils/cnpj.py +391 -0
- everysk/sdk/brutils/cnpj_pd.py +129 -0
- everysk/sdk/engines/__init__.py +26 -0
- everysk/sdk/engines/cache.py +185 -0
- everysk/sdk/engines/compliance.py +37 -0
- everysk/sdk/engines/cryptography.py +69 -0
- everysk/sdk/engines/expression.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/expression.pyi +55 -0
- everysk/sdk/engines/helpers.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/helpers.pyi +26 -0
- everysk/sdk/engines/lock.py +120 -0
- everysk/sdk/engines/market_data.py +244 -0
- everysk/sdk/engines/settings.py +19 -0
- everysk/sdk/entities/__init__.py +23 -0
- everysk/sdk/entities/base.py +784 -0
- everysk/sdk/entities/base_list.py +131 -0
- everysk/sdk/entities/custom_index/base.py +209 -0
- everysk/sdk/entities/custom_index/settings.py +29 -0
- everysk/sdk/entities/datastore/base.py +160 -0
- everysk/sdk/entities/datastore/settings.py +17 -0
- everysk/sdk/entities/fields.py +375 -0
- everysk/sdk/entities/file/base.py +215 -0
- everysk/sdk/entities/file/settings.py +63 -0
- everysk/sdk/entities/portfolio/base.py +248 -0
- everysk/sdk/entities/portfolio/securities.py +241 -0
- everysk/sdk/entities/portfolio/security.py +580 -0
- everysk/sdk/entities/portfolio/settings.py +97 -0
- everysk/sdk/entities/private_security/base.py +226 -0
- everysk/sdk/entities/private_security/settings.py +17 -0
- everysk/sdk/entities/query.py +603 -0
- everysk/sdk/entities/report/base.py +214 -0
- everysk/sdk/entities/report/settings.py +23 -0
- everysk/sdk/entities/script.py +310 -0
- everysk/sdk/entities/secrets/base.py +128 -0
- everysk/sdk/entities/secrets/script.py +119 -0
- everysk/sdk/entities/secrets/settings.py +17 -0
- everysk/sdk/entities/settings.py +48 -0
- everysk/sdk/entities/tags.py +174 -0
- everysk/sdk/entities/worker_execution/base.py +307 -0
- everysk/sdk/entities/worker_execution/settings.py +63 -0
- everysk/sdk/entities/workflow_execution/base.py +113 -0
- everysk/sdk/entities/workflow_execution/settings.py +32 -0
- everysk/sdk/entities/workspace/base.py +99 -0
- everysk/sdk/entities/workspace/settings.py +27 -0
- everysk/sdk/settings.py +67 -0
- everysk/sdk/tests.py +105 -0
- everysk/sdk/worker_base.py +47 -0
- everysk/server/__init__.py +9 -0
- everysk/server/applications.py +63 -0
- everysk/server/endpoints.py +516 -0
- everysk/server/example_api.py +69 -0
- everysk/server/middlewares.py +80 -0
- everysk/server/requests.py +62 -0
- everysk/server/responses.py +119 -0
- everysk/server/routing.py +64 -0
- everysk/server/settings.py +36 -0
- everysk/server/tests.py +36 -0
- everysk/settings.py +98 -0
- everysk/sql/__init__.py +9 -0
- everysk/sql/connection.py +232 -0
- everysk/sql/model.py +376 -0
- everysk/sql/query.py +417 -0
- everysk/sql/row_factory.py +63 -0
- everysk/sql/settings.py +49 -0
- everysk/sql/utils.py +129 -0
- everysk/tests.py +23 -0
- everysk/utils.py +81 -0
- everysk/version.py +15 -0
- everysk_lib-1.10.2.dist-info/.gitignore +5 -0
- everysk_lib-1.10.2.dist-info/METADATA +326 -0
- everysk_lib-1.10.2.dist-info/RECORD +137 -0
- everysk_lib-1.10.2.dist-info/WHEEL +5 -0
- everysk_lib-1.10.2.dist-info/licenses/LICENSE.txt +9 -0
- everysk_lib-1.10.2.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# (C) Copyright 2023 EVERYSK TECHNOLOGIES
|
|
4
|
+
#
|
|
5
|
+
# This is an unpublished work containing confidential and proprietary
|
|
6
|
+
# information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction
|
|
7
|
+
# without authorization of EVERYSK TECHNOLOGIES is prohibited.
|
|
8
|
+
#
|
|
9
|
+
###############################################################################
|
|
10
|
+
from everysk.config import settings
|
|
11
|
+
from everysk.core.exceptions import SDKValueError
|
|
12
|
+
from everysk.core.fields import ListField, StrField, ChoiceField, DictField
|
|
13
|
+
from everysk.sdk.entities.base import BaseEntity, ScriptMetaClass
|
|
14
|
+
from everysk.sdk.entities.fields import CurrencyField, EntityNameField, EntityDescriptionField, EntityTagsField
|
|
15
|
+
from everysk.sdk.entities.query import Query
|
|
16
|
+
from everysk.sdk.entities.script import Script
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
###############################################################################
|
|
20
|
+
# PrivateSecurity Class Implementation
|
|
21
|
+
###############################################################################
|
|
22
|
+
class PrivateSecurity(BaseEntity, metaclass=ScriptMetaClass):
|
|
23
|
+
"""
|
|
24
|
+
This class represents a private security entity object.
|
|
25
|
+
|
|
26
|
+
Attributes:
|
|
27
|
+
script (Script): The script object associated to the entity.
|
|
28
|
+
_orderable_attributes (ListField): The list of orderable attributes.
|
|
29
|
+
symbol (StrField): The symbol of the private security.
|
|
30
|
+
id (StrField): The id of the private security.
|
|
31
|
+
data (ListField): The data of the private security.
|
|
32
|
+
|
|
33
|
+
currency (CurrencyField): The currency of the private security.
|
|
34
|
+
instrument_type (ChoiceField): The instrument type of the private security.
|
|
35
|
+
|
|
36
|
+
description (EntityDescriptionField): The description of the private security.
|
|
37
|
+
name (EntityNameField): The name of the private security.
|
|
38
|
+
tags (EntityTagsField): The tags of the private security.
|
|
39
|
+
|
|
40
|
+
created_on (DateTimeField): The creation date of the private security.
|
|
41
|
+
updated_on (DateTimeField): The last update date of the private security.
|
|
42
|
+
version (IntField): The version of the private security.
|
|
43
|
+
|
|
44
|
+
Example:
|
|
45
|
+
>>> from everysk.sdk.entities.private_security.base import PrivateSecurity
|
|
46
|
+
>>> private_security = PrivateSecurity(
|
|
47
|
+
symbol='PRIVATE:SECURITY',
|
|
48
|
+
data={...},
|
|
49
|
+
currency='USD',
|
|
50
|
+
instrument_type='PrivateFixedIncome',
|
|
51
|
+
description='Private Security description',
|
|
52
|
+
name='Private Security name',
|
|
53
|
+
tags=['tag1', 'tag2']
|
|
54
|
+
)
|
|
55
|
+
>>> private_security.save()
|
|
56
|
+
"""
|
|
57
|
+
script: Script = None
|
|
58
|
+
_orderable_attributes = ListField(default=['created_on', 'updated_on', 'name'], readonly=True)
|
|
59
|
+
|
|
60
|
+
symbol = StrField(regex=settings.PRIVATE_SECURITY_SYMBOL_REGEX, min_size=settings.PRIVATE_SECURITY_SYMBOL_MIN_SIZE, max_size=settings.PRIVATE_SECURITY_SYMBOL_MAX_SIZE, required_lazy=True, empty_is_none=True)
|
|
61
|
+
|
|
62
|
+
data = DictField(required_lazy=True)
|
|
63
|
+
|
|
64
|
+
currency = CurrencyField()
|
|
65
|
+
instrument_type = ChoiceField(default=None, choices=('PrivateFixedIncome', 'PrivateCustomIndex', None), required_lazy=True)
|
|
66
|
+
|
|
67
|
+
description = EntityDescriptionField()
|
|
68
|
+
name = EntityNameField()
|
|
69
|
+
tags = EntityTagsField()
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def id(self) -> str:
|
|
73
|
+
"""
|
|
74
|
+
Returns the id of the private security. The id is a alias for the symbol.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
str: The id of the private security.
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
>>> private_security = PrivateSecurity(symbol='PRIVATE:SECURITY')
|
|
81
|
+
>>> private_security.id
|
|
82
|
+
'PRIVATE:SECURITY'
|
|
83
|
+
"""
|
|
84
|
+
return self.symbol
|
|
85
|
+
|
|
86
|
+
@id.setter
|
|
87
|
+
def id(self, value: str) -> None:
|
|
88
|
+
"""
|
|
89
|
+
Sets the id of the private security. The id is a alias for the symbol.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
value (str): The id of the private security.
|
|
93
|
+
|
|
94
|
+
Example:
|
|
95
|
+
>>> private_security = PrivateSecurity()
|
|
96
|
+
>>> private_security.id = 'PRIVATE:SECURITY'
|
|
97
|
+
>>> private_security.symbol
|
|
98
|
+
'PRIVATE:SECURITY'
|
|
99
|
+
>>> private_security.id
|
|
100
|
+
'PRIVATE:SECURITY'
|
|
101
|
+
"""
|
|
102
|
+
self.symbol = value
|
|
103
|
+
|
|
104
|
+
def validate(self) -> bool:
|
|
105
|
+
"""
|
|
106
|
+
This method validates the entity object and raises an exception if it is not
|
|
107
|
+
valid. The validation is performed by calling the `validate` method of each field
|
|
108
|
+
of the entity.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
self (Self): The entity object to be validated.
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
FieldValueError: If the entity object is not valid.
|
|
115
|
+
RequiredFieldError: If a required field is missing.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
bool: True if the entity object is valid, False otherwise.
|
|
119
|
+
|
|
120
|
+
Example:
|
|
121
|
+
>>> private_security = PrivateSecurity(symbol='PRIVATE:SECURITY', name='Private Security name', ...)
|
|
122
|
+
>>> private_security.validate()
|
|
123
|
+
True
|
|
124
|
+
"""
|
|
125
|
+
return self.get_response(self_obj=self)
|
|
126
|
+
|
|
127
|
+
def _pre_validate(self):
|
|
128
|
+
pass
|
|
129
|
+
|
|
130
|
+
def _pos_validate(self):
|
|
131
|
+
self.created_on = None
|
|
132
|
+
self.updated_on = None
|
|
133
|
+
|
|
134
|
+
def _check_query(self, query: Query) -> bool:
|
|
135
|
+
"""
|
|
136
|
+
Check the query object.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
query (Query): The query object.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Query: The query object.
|
|
143
|
+
"""
|
|
144
|
+
return True
|
|
145
|
+
|
|
146
|
+
def _check_entity_to_query(self) -> bool:
|
|
147
|
+
"""
|
|
148
|
+
Check the entity object to query.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
bool: True if the entity object is valid.
|
|
152
|
+
"""
|
|
153
|
+
if self.name and self.tags:
|
|
154
|
+
raise SDKValueError("Can't filter by Name and Tags at the same time")
|
|
155
|
+
|
|
156
|
+
return True
|
|
157
|
+
|
|
158
|
+
def _mount_query(self, query: Query) -> Query:
|
|
159
|
+
"""
|
|
160
|
+
Mount the query object.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
query (Query): The query object.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Query: The query object.
|
|
167
|
+
"""
|
|
168
|
+
if self.name is not None:
|
|
169
|
+
query = query.where('name', self.name)
|
|
170
|
+
if self.tags:
|
|
171
|
+
query = query.where('tags', self.tags)
|
|
172
|
+
|
|
173
|
+
return query
|
|
174
|
+
|
|
175
|
+
@staticmethod
|
|
176
|
+
def get_id_prefix() -> str:
|
|
177
|
+
"""
|
|
178
|
+
Returns the prefix of the private security id field value.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
str: The prefix of the private security id field value.
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
>>> PrivateSecurity.get_id_prefix()
|
|
185
|
+
'PRIVATE:'
|
|
186
|
+
"""
|
|
187
|
+
return settings.PRIVATE_SECURITY_SYMBOL_PREFIX
|
|
188
|
+
|
|
189
|
+
@classmethod
|
|
190
|
+
def modify_many(cls, entity_id_list: list[str], overwrites: dict | list[dict]) -> list:
|
|
191
|
+
"""
|
|
192
|
+
The private security does not support the modify_many method.
|
|
193
|
+
"""
|
|
194
|
+
raise NotImplementedError()
|
|
195
|
+
|
|
196
|
+
@classmethod
|
|
197
|
+
def clone_many(cls, entity_id_list: list[str], overwrites: dict | list[dict]) -> list:
|
|
198
|
+
"""
|
|
199
|
+
The private security does not support the clone_many method.
|
|
200
|
+
"""
|
|
201
|
+
raise NotImplementedError()
|
|
202
|
+
|
|
203
|
+
def to_dict(self, add_class_path: bool = False, recursion: bool = False) -> dict:
|
|
204
|
+
"""
|
|
205
|
+
Convert the entity to a JSON-serializable dictionary.
|
|
206
|
+
|
|
207
|
+
This method converts the entity object into a dictionary that can be easily
|
|
208
|
+
serialized to JSON.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
self (Self): The entity instance to convert.
|
|
212
|
+
with_internals (bool, optional): Whether to include internal parameters. Defaults to True.
|
|
213
|
+
recursion (bool, optional): Whether to include nested entities. Defaults to False.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
dict: A dictionary representation of the entity.
|
|
217
|
+
|
|
218
|
+
Raises:
|
|
219
|
+
NotImplementedError: This method should be implemented in subclasses.
|
|
220
|
+
"""
|
|
221
|
+
dct: dict = super().to_dict(add_class_path=add_class_path, recursion=recursion)
|
|
222
|
+
|
|
223
|
+
if add_class_path is False:
|
|
224
|
+
dct['type'] = dct.pop('instrument_type', None)
|
|
225
|
+
|
|
226
|
+
return dct
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# (C) Copyright 2023 EVERYSK TECHNOLOGIES
|
|
4
|
+
#
|
|
5
|
+
# This is an unpublished work containing confidential and proprietary
|
|
6
|
+
# information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction
|
|
7
|
+
# without authorization of EVERYSK TECHNOLOGIES is prohibited.
|
|
8
|
+
#
|
|
9
|
+
###############################################################################
|
|
10
|
+
from everysk.core.fields import StrField, IntField, RegexField
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
PRIVATE_SECURITY_SYMBOL_REGEX = RegexField(default=r'^PRIVATE:[A-Z0-9_]*$', readonly=True)
|
|
14
|
+
PRIVATE_SECURITY_SYMBOL_PREFIX = StrField(default='PRIVATE:', readonly=True)
|
|
15
|
+
|
|
16
|
+
PRIVATE_SECURITY_SYMBOL_MIN_SIZE = IntField(default=9, readonly=True) # len(PRIVATE_SECURITY_SYMBOL_PREFIX) + 1
|
|
17
|
+
PRIVATE_SECURITY_SYMBOL_MAX_SIZE = IntField(default=109, readonly=True) # 100 + len(PRIVATE_SECURITY_SYMBOL_PREFIX)
|