meshtrade 0.0.4__tar.gz → 0.0.5__tar.gz
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 meshtrade might be problematic. Click here for more details.
- {meshtrade-0.0.4/src/meshtrade.egg-info → meshtrade-0.0.5}/PKG-INFO +2 -2
- {meshtrade-0.0.4 → meshtrade-0.0.5}/pyproject.toml +2 -2
- meshtrade-0.0.5/src/meshtrade/type/v1/__init__.py +7 -0
- meshtrade-0.0.5/src/meshtrade/type/v1/amount.py +84 -0
- meshtrade-0.0.5/src/meshtrade/type/v1/decimal_built_in_conversions.py +29 -0
- meshtrade-0.0.5/src/meshtrade/type/v1/ledger.py +26 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5/src/meshtrade.egg-info}/PKG-INFO +2 -2
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade.egg-info/SOURCES.txt +3 -0
- meshtrade-0.0.4/src/meshtrade/wallet/account/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/LICENSE +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/README.md +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/setup.cfg +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/client_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/client_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_representative_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_representative_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_representative_role_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_representative_role_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/fund_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/fund_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/identification_document_type_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/identification_document_type_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/industry_classification_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/industry_classification_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_connection_type_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_connection_type_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/pep_status_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/pep_status_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/tax_residency_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/tax_residency_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/trust_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/trust_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/verification_status_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/verification_status_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/v1/group_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/v1/group_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/group/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/permission_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/permission_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/role_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/role_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/iam/role/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/option/v1/auth_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/option/v1/auth_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/option/v1/service_type_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/option/v1/service_type_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/limit_order_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/limit_order_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/v1/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/v1/spot_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/spot/v1/spot_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/address_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/address_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/amount_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/amount_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/contact_details_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/contact_details_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/decimal_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/decimal_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/ledger_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/ledger_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/token_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/type/v1/token_pb2.pyi +0 -0
- {meshtrade-0.0.4/src/meshtrade/type/v1 → meshtrade-0.0.5/src/meshtrade/wallet}/__init__.py +0 -0
- {meshtrade-0.0.4/src/meshtrade/wallet → meshtrade-0.0.5/src/meshtrade/wallet/account/v1}/__init__.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/wallet/account/v1/account_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/wallet/account/v1/account_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/wallet/account/v1/service_pb2.py +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/wallet/account/v1/service_pb2.pyi +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade.egg-info/dependency_links.txt +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade.egg-info/requires.txt +0 -0
- {meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshtrade
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Integration SDK for Mesh API Services
|
|
5
5
|
Author-email: Bernard Bussy <bernard@meshtrade.co>
|
|
6
6
|
License-Expression: LicenseRef-My-Custom-License
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: grpcio<2.0,>=1.73.0
|
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "meshtrade"
|
|
7
|
-
version = "v0.0.
|
|
7
|
+
version = "v0.0.5"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "Bernard Bussy", email = "bernard@meshtrade.co" },
|
|
10
10
|
]
|
|
11
11
|
description = "Integration SDK for Mesh API Services"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
13
|
keywords = ["meshtrade", "mesh", "mesh-sdk", "grpc", "betterproto", "grpclib"]
|
|
14
14
|
license = "LicenseRef-My-Custom-License"
|
|
15
15
|
license-files = ["LICENSE"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from .amount import new_amount
|
|
2
|
+
from .decimal_built_in_conversions import built_in_to_decimal, decimal_to_built_in
|
|
3
|
+
from .decimal_pb2 import Decimal
|
|
4
|
+
from .ledger_pb2 import Ledger
|
|
5
|
+
from .ledger import get_ledger_no_decimal_places
|
|
6
|
+
from .token_pb2 import Token
|
|
7
|
+
from .amount_pb2 import Amount
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a factory function for creating Amount protobuf messages.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from decimal import ROUND_DOWN, Decimal
|
|
6
|
+
|
|
7
|
+
from .amount_pb2 import Amount
|
|
8
|
+
from .decimal_built_in_conversions import built_in_to_decimal, decimal_to_built_in
|
|
9
|
+
from .ledger import get_ledger_no_decimal_places
|
|
10
|
+
from .token_pb2 import Token
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def new_amount(
|
|
14
|
+
value: Decimal,
|
|
15
|
+
token: Token,
|
|
16
|
+
precision_loss_tolerance: Decimal = Decimal("0.00000001")
|
|
17
|
+
) -> Amount:
|
|
18
|
+
"""Creates a new Amount, ensuring the value conforms to system-wide limits.
|
|
19
|
+
|
|
20
|
+
This function is the safe constructor for creating Amount protobuf messages.
|
|
21
|
+
While the underlying conversion from a Python `Decimal` to the protobuf's
|
|
22
|
+
`string` field is lossless, this function provides critical validation
|
|
23
|
+
to ensure the value adheres to constraints imposed by other downstream
|
|
24
|
+
systems (e.g., databases, other microservices with fixed-precision types).
|
|
25
|
+
|
|
26
|
+
Its primary operations are:
|
|
27
|
+
|
|
28
|
+
1. **Validation:** It performs a serialization round-trip
|
|
29
|
+
(Python Decimal -> Protobuf Decimal -> Python Decimal) to simulate
|
|
30
|
+
how the value is stored and retrieved across the system. It then asserts
|
|
31
|
+
the value remains unchanged, guaranteeing it doesn't exceed the
|
|
32
|
+
precision limits of any consuming service.
|
|
33
|
+
|
|
34
|
+
2. **Truncation:** It truncates the validated value to the exact number of
|
|
35
|
+
decimal places defined for the token's ledger, always rounding down to
|
|
36
|
+
prevent any inflation of values.
|
|
37
|
+
|
|
38
|
+
3. **Construction:** It constructs and returns the final `Amount` message.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
value: The numerical value of the amount as a Python `Decimal` object.
|
|
42
|
+
token: The `Token` protobuf message that defines the asset type
|
|
43
|
+
and its associated ledger.
|
|
44
|
+
precision_loss_tolerance: The maximum acceptable difference after the
|
|
45
|
+
validation round-trip. Since the string-based conversion is
|
|
46
|
+
lossless, any difference indicates a failure to conform to an
|
|
47
|
+
external system's parsing rules. Defaults to a small tolerance
|
|
48
|
+
for robustness.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
An `Amount` protobuf message containing the ledger-compliant, truncated
|
|
52
|
+
value and the specified token.
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
AssertionError: If the input `value` changes during the validation
|
|
56
|
+
round-trip, indicating it exceeds the system's
|
|
57
|
+
representational limits and would be corrupted
|
|
58
|
+
downstream.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
# Perform a serialization round-trip to validate the value against
|
|
62
|
+
# system-wide architectural constraints. This is a lossless operation
|
|
63
|
+
# in isolation, so any change reveals an incompatibility.
|
|
64
|
+
value_after_roundtrip = decimal_to_built_in(built_in_to_decimal(value))
|
|
65
|
+
|
|
66
|
+
# Confirm the value is perfectly representable within the system's limits.
|
|
67
|
+
# If the original value had too much precision for a downstream service to
|
|
68
|
+
# parse, it would change during the round-trip, and this would fail.
|
|
69
|
+
assert abs(value_after_roundtrip - value) \
|
|
70
|
+
<= precision_loss_tolerance, \
|
|
71
|
+
"value exceeds system's precision limits and would be corrupted"
|
|
72
|
+
|
|
73
|
+
# Truncate the validated value to the number of decimal places specified by the
|
|
74
|
+
# token's ledger. ROUND_DOWN ensures the value is never inflated.
|
|
75
|
+
truncated_value = value_after_roundtrip.quantize(
|
|
76
|
+
Decimal(10) ** -get_ledger_no_decimal_places(token.ledger),
|
|
77
|
+
rounding=ROUND_DOWN,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Construct and return the final Amount protobuf message using the sanitized value.
|
|
81
|
+
return Amount(
|
|
82
|
+
token=token,
|
|
83
|
+
value=built_in_to_decimal(truncated_value),
|
|
84
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import decimal
|
|
2
|
+
|
|
3
|
+
from .decimal_pb2 import Decimal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def built_in_to_decimal(decimal_value: decimal.Decimal) -> Decimal:
|
|
7
|
+
"""
|
|
8
|
+
Converts an instance of the built-in decimal.Decimal type to an instance of the
|
|
9
|
+
financial Decimal protobuf type.
|
|
10
|
+
|
|
11
|
+
:param decimal_value: The decimal.Decimal object to convert.
|
|
12
|
+
:return: The converted financial Decimal protobuf object.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
# Contruct and return resultant decimal object
|
|
16
|
+
return Decimal(
|
|
17
|
+
value=str(decimal_value),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def decimal_to_built_in(decimal_value: Decimal) -> decimal.Decimal:
|
|
22
|
+
"""
|
|
23
|
+
Converts an instance of the financial Decimal protobuf type to an instance of the
|
|
24
|
+
built-in decimal.Decimal type.
|
|
25
|
+
|
|
26
|
+
:param decimal_value: The decimal_pb2.Decimal object to convert.
|
|
27
|
+
:return: The converted decimal.Decimal object.
|
|
28
|
+
"""
|
|
29
|
+
return decimal.Decimal( decimal_value.value if decimal_value.value != "" else "0" )
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
|
|
3
|
+
from .ledger_pb2 import Ledger
|
|
4
|
+
|
|
5
|
+
_ledger_decimal_places: Dict[Ledger, int] = {
|
|
6
|
+
Ledger.LEDGER_STELLAR: 7,
|
|
7
|
+
Ledger.LEDGER_SA_STOCK_BROKERS: 2,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class UnsupportedLedgerError(Exception):
|
|
11
|
+
"""Exception raised for unsupported Ledger values."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, ledger: Ledger):
|
|
14
|
+
self.financial_business_day_convention = ledger
|
|
15
|
+
message = f"Unsupported Ledger: {ledger}"
|
|
16
|
+
super().__init__(message)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_ledger_no_decimal_places(ledger: Ledger) -> int:
|
|
20
|
+
"""
|
|
21
|
+
Returns the number of decimal places supported by the given Ledger
|
|
22
|
+
"""
|
|
23
|
+
if ledger in _ledger_decimal_places:
|
|
24
|
+
return _ledger_decimal_places[ledger]
|
|
25
|
+
else:
|
|
26
|
+
raise UnsupportedLedgerError(ledger)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshtrade
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Integration SDK for Mesh API Services
|
|
5
5
|
Author-email: Bernard Bussy <bernard@meshtrade.co>
|
|
6
6
|
License-Expression: LicenseRef-My-Custom-License
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: grpcio<2.0,>=1.73.0
|
|
@@ -90,12 +90,15 @@ src/meshtrade/type/__init__.py
|
|
|
90
90
|
src/meshtrade/type/v1/__init__.py
|
|
91
91
|
src/meshtrade/type/v1/address_pb2.py
|
|
92
92
|
src/meshtrade/type/v1/address_pb2.pyi
|
|
93
|
+
src/meshtrade/type/v1/amount.py
|
|
93
94
|
src/meshtrade/type/v1/amount_pb2.py
|
|
94
95
|
src/meshtrade/type/v1/amount_pb2.pyi
|
|
95
96
|
src/meshtrade/type/v1/contact_details_pb2.py
|
|
96
97
|
src/meshtrade/type/v1/contact_details_pb2.pyi
|
|
98
|
+
src/meshtrade/type/v1/decimal_built_in_conversions.py
|
|
97
99
|
src/meshtrade/type/v1/decimal_pb2.py
|
|
98
100
|
src/meshtrade/type/v1/decimal_pb2.pyi
|
|
101
|
+
src/meshtrade/type/v1/ledger.py
|
|
99
102
|
src/meshtrade/type/v1/ledger_pb2.py
|
|
100
103
|
src/meshtrade/type/v1/ledger_pb2.pyi
|
|
101
104
|
src/meshtrade/type/v1/token_pb2.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/company_representative_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/natural_person_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/tax_residency_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/verification_status_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/compliance/client/v1/verification_status_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/instrument_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/issuance_hub/instrument/v1/service_pb2.pyi
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_action_pb2.pyi
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/ledger/transaction/v1/transaction_state_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.py
RENAMED
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/direct_order/v1/direct_order_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4 → meshtrade-0.0.5}/src/meshtrade/trading/limit_order/v1/limit_order_pb2.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshtrade-0.0.4/src/meshtrade/wallet → meshtrade-0.0.5/src/meshtrade/wallet/account/v1}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|