afp-sdk 0.5.3__tar.gz → 0.5.4__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.
Files changed (57) hide show
  1. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/CHANGELOG.md +12 -0
  2. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/PKG-INFO +1 -1
  3. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/trading.py +9 -3
  4. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/exceptions.py +4 -0
  5. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/exchange.py +3 -0
  6. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/schemas.py +3 -1
  7. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/pyproject.toml +1 -1
  8. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_base_api.py +3 -1
  9. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/uv.lock +1 -1
  10. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/.env.template +0 -0
  11. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/.envrc +0 -0
  12. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/LICENSE +0 -0
  13. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/README.md +0 -0
  14. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/__init__.py +0 -0
  15. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/afp.py +0 -0
  16. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/__init__.py +0 -0
  17. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/admin.py +0 -0
  18. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/base.py +0 -0
  19. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/margin_account.py +0 -0
  20. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/api/product.py +0 -0
  21. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/auth.py +0 -0
  22. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/__init__.py +0 -0
  23. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/auctioneer_facet.py +0 -0
  24. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/bankruptcy_facet.py +0 -0
  25. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/clearing_facet.py +0 -0
  26. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/erc20.py +0 -0
  27. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/facade.py +0 -0
  28. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/final_settlement_facet.py +0 -0
  29. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/margin_account.py +0 -0
  30. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/margin_account_registry.py +0 -0
  31. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/mark_price_tracker_facet.py +0 -0
  32. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/oracle_provider.py +0 -0
  33. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/product_registry.py +0 -0
  34. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/system_viewer.py +0 -0
  35. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/bindings/trading_protocol.py +0 -0
  36. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/config.py +0 -0
  37. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/constants.py +0 -0
  38. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/decorators.py +0 -0
  39. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/enums.py +0 -0
  40. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/hashing.py +0 -0
  41. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/py.typed +0 -0
  42. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/afp/validators.py +0 -0
  43. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/devenv.lock +0 -0
  44. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/devenv.nix +0 -0
  45. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/devenv.yaml +0 -0
  46. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/examples/cancel_order.py +0 -0
  47. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/examples/create_product.py +0 -0
  48. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/examples/execute_trade.py +0 -0
  49. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/__init__.py +0 -0
  50. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/assets/test.key +0 -0
  51. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_afp.py +0 -0
  52. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_decorators.py +0 -0
  53. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_exchange_client.py +0 -0
  54. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_hashing.py +0 -0
  55. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_schemas.py +0 -0
  56. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_signing.py +0 -0
  57. {afp_sdk-0.5.3 → afp_sdk-0.5.4}/tests/test_validators.py +0 -0
@@ -1,3 +1,14 @@
1
+ ## [v0.5.4] - 2025-11-05
2
+
3
+ ### Added
4
+
5
+ - Add `afp.exceptions.RateLimitExceeded` exception type ([#37](https://github.com/autonity/afp-sdk/pull/37))
6
+ - Add trading fee rate to `afp.schemas.OrderFill` structure ([#39](https://github.com/autonity/afp-sdk/pull/39))
7
+
8
+ ### Changed
9
+
10
+ - Update for interface changes in the AutEx exchange ([#36](https://github.com/autonity/afp-sdk/pull/36))
11
+
1
12
  ## [v0.5.3] - 2025-10-29
2
13
 
3
14
  ### Added
@@ -67,6 +78,7 @@
67
78
 
68
79
  _First public release for Forecastathon._
69
80
 
81
+ [v0.5.4]: https://github.com/autonity/afp-sdk/releases/tag/v0.5.4
70
82
  [v0.5.3]: https://github.com/autonity/afp-sdk/releases/tag/v0.5.3
71
83
  [v0.5.2]: https://github.com/autonity/afp-sdk/releases/tag/v0.5.2
72
84
  [v0.5.1]: https://github.com/autonity/afp-sdk/releases/tag/v0.5.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afp-sdk
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: Autonomous Futures Protocol Python SDK
5
5
  Keywords: autonity,web3,trading,crypto,prediction,forecast,markets
6
6
  License-Expression: MIT
@@ -124,8 +124,9 @@ class Trading(ExchangeAPI):
124
124
 
125
125
  Raises
126
126
  ------
127
- afp.exceptions.ValidationError
128
- If the exchange rejects the intent.
127
+ afp.exceptions.RateLimitExceeded
128
+ If the exchange rejects the order because of too many requests from the
129
+ authenticated account.
129
130
  """
130
131
  submission = OrderSubmission(
131
132
  type=OrderType.LIMIT_ORDER,
@@ -147,8 +148,13 @@ class Trading(ExchangeAPI):
147
148
 
148
149
  Raises
149
150
  ------
151
+ afp.exceptions.NotFoundError
152
+ If the exchange rejects the cancellation because the intent does not exist.
153
+ afp.exceptions.RateLimitExceeded
154
+ If the exchange rejects the cancellation because of too many requests from
155
+ the authenticated account.
150
156
  afp.exceptions.ValidationError
151
- If the exchange rejects the cancellation.
157
+ If the exchange rejects the cancellation because it is invalid.
152
158
  """
153
159
  nonce = self._generate_nonce()
154
160
  cancellation_hash = hashing.generate_order_cancellation_hash(nonce, intent_hash)
@@ -26,5 +26,9 @@ class NotFoundError(ExchangeError):
26
26
  pass
27
27
 
28
28
 
29
+ class RateLimitExceeded(ExchangeError):
30
+ pass
31
+
32
+
29
33
  class ValidationError(ExchangeError):
30
34
  pass
@@ -11,6 +11,7 @@ from .exceptions import (
11
11
  AuthorizationError,
12
12
  ExchangeError,
13
13
  NotFoundError,
14
+ RateLimitExceeded,
14
15
  ValidationError,
15
16
  )
16
17
  from .schemas import (
@@ -198,6 +199,8 @@ class ExchangeClient:
198
199
  raise AuthorizationError(http_error) from http_error
199
200
  if http_error.response.status_code == requests.codes.NOT_FOUND:
200
201
  raise NotFoundError(http_error) from http_error
202
+ if http_error.response.status_code == requests.codes.TOO_MANY_REQUESTS:
203
+ raise RateLimitExceeded(http_error) from http_error
201
204
  if http_error.response.status_code == requests.codes.BAD_REQUEST:
202
205
  try:
203
206
  reason = response.json()["detail"]
@@ -78,7 +78,8 @@ class LoginSubmission(Model):
78
78
 
79
79
  class ExchangeParameters(Model):
80
80
  trading_protocol_id: str
81
- trading_fee_rate: Decimal
81
+ maker_trading_fee_rate: Decimal
82
+ taker_trading_fee_rate: Decimal
82
83
 
83
84
 
84
85
  # Admin API
@@ -182,6 +183,7 @@ class OrderFill(Model):
182
183
  trade: Trade
183
184
  quantity: int
184
185
  price: Decimal
186
+ trading_fee_rate: Decimal
185
187
 
186
188
 
187
189
  class OrderFillFilter(PaginationFilter):
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "afp-sdk"
7
- version = "0.5.3"
7
+ version = "0.5.4"
8
8
  description = "Autonomous Futures Protocol Python SDK"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -81,7 +81,9 @@ def test_ClearingSystemAPI__applies_transaction_parameters(monkeypatch):
81
81
 
82
82
  def test_ExchangeAPI__applies_exchange_parameters(monkeypatch):
83
83
  fake_exchange_params = ExchangeParameters(
84
- trading_protocol_id="baz", trading_fee_rate=Decimal("0")
84
+ trading_protocol_id="baz",
85
+ maker_trading_fee_rate=Decimal("0"),
86
+ taker_trading_fee_rate=Decimal("0"),
85
87
  )
86
88
  mock_login = Mock(return_value=fake_exchange_params)
87
89
  mock_generate_login_nonce = Mock(return_value="12345678")
@@ -13,7 +13,7 @@ wheels = [
13
13
 
14
14
  [[package]]
15
15
  name = "afp-sdk"
16
- version = "0.5.3"
16
+ version = "0.5.4"
17
17
  source = { editable = "." }
18
18
  dependencies = [
19
19
  { name = "decorator" },
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes