afp-sdk 0.1.2__tar.gz → 0.2.1__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.
- afp_sdk-0.2.1/CHANGELOG.md +42 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/PKG-INFO +1 -1
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/trading.py +13 -1
- afp_sdk-0.2.1/afp/bindings/system_viewer.py +1235 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/trading_protocol.py +24 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/schemas.py +2 -1
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/validators.py +13 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/pyproject.toml +1 -1
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/test_validators.py +24 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/uv.lock +2 -2
- afp_sdk-0.1.2/CHANGELOG.md +0 -19
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/.env.template +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/.envrc +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/LICENSE +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/README.md +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/__init__.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/__init__.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/admin.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/base.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/builder.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/clearing.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/api/liquidation.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/__init__.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/auctioneer_facet.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/bankruptcy_facet.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/clearing_facet.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/erc20.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/facade.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/final_settlement_facet.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/margin_account.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/margin_account_registry.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/mark_price_tracker_facet.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/oracle_provider.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/bindings/product_registry.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/config.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/decorators.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/enums.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/exceptions.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/exchange.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/py.typed +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/afp/signing.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/devenv.lock +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/devenv.nix +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/devenv.yaml +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/examples/cancel_order.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/examples/create_product.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/examples/execute_trade.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/__init__.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/test_decorators.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/test_hashing.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/test_login.py +0 -0
- {afp_sdk-0.1.2 → afp_sdk-0.2.1}/tests/test_schemas.py +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
## [v0.2.1] - 2025-09-02
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Add SystemViewer contract bindings ([#15](https://github.com/autonity/afp-sdk/pull/15))
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Change the data type of Trade ID from integer to string ([#14](https://github.com/autonity/afp-sdk/pull/14))
|
|
10
|
+
|
|
11
|
+
## [v0.2.0] - 2025-09-02
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Validate limit price to make sure it conforms to the product's tick size ([#12](https://github.com/autonity/afp-sdk/pull/12))
|
|
16
|
+
- Update Clearing System contract bindings for Autonity Bakerloo (Nile) Testnet deployment as of 2025-09-02 ([#13](https://github.com/autonity/afp-sdk/pull/13))
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Add optional `rounding` argument to `afp.Trading.create_intent` ([#12](https://github.com/autonity/afp-sdk/pull/12))
|
|
21
|
+
|
|
22
|
+
## [v0.1.2] - 2025-08-28
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Fix oracle specification decimal parsing in `afp.Builder.create_product` ([#9](https://github.com/autonity/afp-sdk/pull/9))
|
|
27
|
+
|
|
28
|
+
## [v0.1.1] - 2025-08-28
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- Fix incorrect parameter type in `afp.bindings.ClearingDiamond.mutializeLosses` ([#8](https://github.com/autonity/afp-sdk/pull/8))
|
|
33
|
+
|
|
34
|
+
## [v0.1.0] - 2025-08-22
|
|
35
|
+
|
|
36
|
+
_First release._
|
|
37
|
+
|
|
38
|
+
[v0.2.1]: https://github.com/autonity/afp-sdk/releases/tag/v0.2.1
|
|
39
|
+
[v0.2.0]: https://github.com/autonity/afp-sdk/releases/tag/v0.2.0
|
|
40
|
+
[v0.1.2]: https://github.com/autonity/afp-sdk/releases/tag/v0.1.2
|
|
41
|
+
[v0.1.1]: https://github.com/autonity/afp-sdk/releases/tag/v0.1.1
|
|
42
|
+
[v0.1.0]: https://github.com/autonity/afp-sdk/releases/tag/v0.1.0
|
|
@@ -54,6 +54,7 @@ class Trading(ExchangeAPI):
|
|
|
54
54
|
max_trading_fee_rate: Decimal,
|
|
55
55
|
good_until_time: datetime,
|
|
56
56
|
margin_account_id: str | None = None,
|
|
57
|
+
rounding: str | None = None,
|
|
57
58
|
) -> Intent:
|
|
58
59
|
"""Creates an intent with the given intent data, generates its hash and signs it
|
|
59
60
|
with the configured account's private key.
|
|
@@ -62,6 +63,13 @@ class Trading(ExchangeAPI):
|
|
|
62
63
|
is assumed to be the same as the margin account if the margin account ID is not
|
|
63
64
|
specified.
|
|
64
65
|
|
|
66
|
+
The limit price must have at most as many fractional digits as the product's
|
|
67
|
+
tick size, or if `rounding` is specified then the limit price is rounded to the
|
|
68
|
+
appropriate number of fractional digits. `rounding` may be one of
|
|
69
|
+
`ROUND_CEILING`, `ROUND_FLOOR`, `ROUND_UP`, `ROUND_DOWN`, `ROUND_HALF_UP`,
|
|
70
|
+
`ROUND_HALF_DOWN`, `ROUND_HALF_EVEN` and `ROUND_05UP`; see the rounding modes of
|
|
71
|
+
the `decimal` module of the Python Standard Library.
|
|
72
|
+
|
|
65
73
|
Parameters
|
|
66
74
|
----------
|
|
67
75
|
product : afp.schemas.ExchangeProduct
|
|
@@ -71,6 +79,8 @@ class Trading(ExchangeAPI):
|
|
|
71
79
|
max_trading_fee_rate : decimal.Decimal
|
|
72
80
|
good_until_time : datetime.datetime
|
|
73
81
|
margin_account_id : str, optional
|
|
82
|
+
rounding : str, optional
|
|
83
|
+
A rounding mode of the `decimal` module or `None` for no rounding.
|
|
74
84
|
|
|
75
85
|
Returns
|
|
76
86
|
-------
|
|
@@ -85,7 +95,9 @@ class Trading(ExchangeAPI):
|
|
|
85
95
|
intent_data = IntentData(
|
|
86
96
|
trading_protocol_id=self._trading_protocol_id,
|
|
87
97
|
product_id=product.id,
|
|
88
|
-
limit_price=
|
|
98
|
+
limit_price=validators.validate_limit_price(
|
|
99
|
+
Decimal(limit_price), product.tick_size, rounding
|
|
100
|
+
),
|
|
89
101
|
quantity=quantity,
|
|
90
102
|
max_trading_fee_rate=max_trading_fee_rate,
|
|
91
103
|
side=getattr(OrderSide, side.upper()),
|