deltadefi 0.0.10__tar.gz → 0.0.11__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 deltadefi might be problematic. Click here for more details.

Files changed (24) hide show
  1. {deltadefi-0.0.10 → deltadefi-0.0.11}/PKG-INFO +21 -17
  2. {deltadefi-0.0.10 → deltadefi-0.0.11}/README.md +20 -16
  3. {deltadefi-0.0.10 → deltadefi-0.0.11}/pyproject.toml +1 -1
  4. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/accounts.py +49 -1
  5. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/responses/accounts.py +10 -0
  6. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/__init__.py +0 -0
  7. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/api.py +0 -0
  8. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/api_resources/__init__.py +0 -0
  9. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/api_resources/auth.py +0 -0
  10. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/api_resources/validation.py +0 -0
  11. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/__init__.py +0 -0
  12. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/app.py +0 -0
  13. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/client.py +0 -0
  14. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/markets.py +0 -0
  15. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/clients/orders.py +0 -0
  16. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/constants/__init__.py +0 -0
  17. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/constants/constants.py +0 -0
  18. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/error.py +0 -0
  19. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/lib/__init__.py +0 -0
  20. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/lib/utils.py +0 -0
  21. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/models/__init__.py +0 -0
  22. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/models/models.py +0 -0
  23. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/responses/__init__.py +0 -0
  24. {deltadefi-0.0.10 → deltadefi-0.0.11}/src/deltadefi/responses/responses.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: deltadefi
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: Python SDK for DeltaDeFi protocol.
5
5
  License: Apache-2.0
6
6
  Keywords: cardano
@@ -56,11 +56,8 @@ from sidan_gin import HDWallet
56
56
  network="preprod",
57
57
  api_key="your_api_key",
58
58
 
59
- # Initialize HDWallet
60
- wallet = HDWallet("your_wallet_mnemonic")
61
-
62
59
  # Initialize ApiClient
63
- api = ApiClient(network=network, api_key=api_key, wallet=wallet)
60
+ api = ApiClient(network=network, api_key=api_key)
64
61
  ```
65
62
 
66
63
  ### Accounts
@@ -73,33 +70,40 @@ account_balance = api.accounts.get_account_balance()
73
70
  print(account_balance)
74
71
  ```
75
72
 
76
- ### Market
73
+ ### Markets
77
74
 
78
75
  The Market client allows you to interact with market-related endpoints.
79
76
 
80
77
  ```python
81
78
  # Get market depth
82
- market_depth = api.market.get_depth("ADAUSDM")
79
+ market_depth = api.markets.get_depth("ADAUSDM")
83
80
  print(market_depth_response)
84
81
 
85
82
  # Get market price
86
- market_price_response = api.market.get_market_price("ADAUSDM")
83
+ market_price_response = api.markets.get_market_price("ADAUSDM")
87
84
  print(market_price_response)
88
85
  ```
89
86
 
90
- ### Order
87
+ ### Orders
91
88
 
92
89
  The Order client allows you to interact with order-related endpoints.
93
90
 
94
91
  ```python
95
- # Build place order transaction
96
- place_order_request = BuildPlaceOrderTransactionRequest(pair="BTC/USD", amount=1, price=50000)
97
- place_order_response = api.order.build_place_order_transaction(symbol="ADAUSDM", amount=50, price=0.75, type="limit")
98
- print(place_order_response)
99
-
100
- # Submit place order transaction
101
- submit_order_response = api.order.submit_place_order_transaction(signed_tx="<signed_tx>", order_id="<order_id>")
102
- print(submit_order_response)
92
+ api_key = os.environ.get("DELTADEFI_API_KEY")
93
+ password = os.environ.get("TRADING_PASSWORD")
94
+
95
+ api = ApiClient(api_key=api_key)
96
+ api.load_operation_key(password)
97
+
98
+ res = api.post_order(
99
+ symbol="ADAUSDM",
100
+ side="sell",
101
+ type="limit",
102
+ quantity=51,
103
+ price=15,
104
+ )
105
+
106
+ print("Order submitted successfully.", res)
103
107
  ```
104
108
 
105
109
  ## Development
@@ -28,11 +28,8 @@ from sidan_gin import HDWallet
28
28
  network="preprod",
29
29
  api_key="your_api_key",
30
30
 
31
- # Initialize HDWallet
32
- wallet = HDWallet("your_wallet_mnemonic")
33
-
34
31
  # Initialize ApiClient
35
- api = ApiClient(network=network, api_key=api_key, wallet=wallet)
32
+ api = ApiClient(network=network, api_key=api_key)
36
33
  ```
37
34
 
38
35
  ### Accounts
@@ -45,33 +42,40 @@ account_balance = api.accounts.get_account_balance()
45
42
  print(account_balance)
46
43
  ```
47
44
 
48
- ### Market
45
+ ### Markets
49
46
 
50
47
  The Market client allows you to interact with market-related endpoints.
51
48
 
52
49
  ```python
53
50
  # Get market depth
54
- market_depth = api.market.get_depth("ADAUSDM")
51
+ market_depth = api.markets.get_depth("ADAUSDM")
55
52
  print(market_depth_response)
56
53
 
57
54
  # Get market price
58
- market_price_response = api.market.get_market_price("ADAUSDM")
55
+ market_price_response = api.markets.get_market_price("ADAUSDM")
59
56
  print(market_price_response)
60
57
  ```
61
58
 
62
- ### Order
59
+ ### Orders
63
60
 
64
61
  The Order client allows you to interact with order-related endpoints.
65
62
 
66
63
  ```python
67
- # Build place order transaction
68
- place_order_request = BuildPlaceOrderTransactionRequest(pair="BTC/USD", amount=1, price=50000)
69
- place_order_response = api.order.build_place_order_transaction(symbol="ADAUSDM", amount=50, price=0.75, type="limit")
70
- print(place_order_response)
71
-
72
- # Submit place order transaction
73
- submit_order_response = api.order.submit_place_order_transaction(signed_tx="<signed_tx>", order_id="<order_id>")
74
- print(submit_order_response)
64
+ api_key = os.environ.get("DELTADEFI_API_KEY")
65
+ password = os.environ.get("TRADING_PASSWORD")
66
+
67
+ api = ApiClient(api_key=api_key)
68
+ api.load_operation_key(password)
69
+
70
+ res = api.post_order(
71
+ symbol="ADAUSDM",
72
+ side="sell",
73
+ type="limit",
74
+ quantity=51,
75
+ price=15,
76
+ )
77
+
78
+ print("Order submitted successfully.", res)
75
79
  ```
76
80
 
77
81
  ## Development
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "deltadefi"
3
- version = "0.0.10"
3
+ version = "0.0.11"
4
4
  classifiers = [
5
5
  "Intended Audience :: Developers",
6
6
  "License :: OSI Approved :: Apache Software License",
@@ -17,7 +17,11 @@ from deltadefi.responses import (
17
17
  SubmitDepositTransactionResponse,
18
18
  SubmitWithdrawalTransactionResponse,
19
19
  )
20
- from deltadefi.responses.accounts import GetOperationKeyResponse
20
+ from deltadefi.responses.accounts import (
21
+ BuildTransferalTransactionResponse,
22
+ GetOperationKeyResponse,
23
+ SubmitTransferalTransactionResponse,
24
+ )
21
25
 
22
26
 
23
27
  class Accounts(API):
@@ -147,6 +151,31 @@ class Accounts(API):
147
151
  url_path = "/withdrawal/build"
148
152
  return self.send_request("POST", self.group_url_path + url_path, payload)
149
153
 
154
+ def build_transferal_transaction(
155
+ self, transferal_amount: List[Asset], to_address: str, **kwargs
156
+ ) -> BuildTransferalTransactionResponse:
157
+ """
158
+ Build a transferal transaction.
159
+
160
+ Args:
161
+ data: A BuildTransferalTransactionRequest object containing the transferal transaction details.
162
+
163
+ Returns:
164
+ A BuildTransferalTransactionResponse object containing the built transferal transaction.
165
+ """
166
+
167
+ check_required_parameter(
168
+ transferal_amount, "transferal_amount", to_address, "to_address"
169
+ )
170
+ payload = {
171
+ "transferal_amount": transferal_amount,
172
+ "to_address": to_address,
173
+ **kwargs,
174
+ }
175
+
176
+ url_path = "/transferal/build"
177
+ return self.send_request("POST", self.group_url_path + url_path, payload)
178
+
150
179
  def submit_deposit_transaction(
151
180
  self, signed_tx: str, **kwargs
152
181
  ) -> SubmitDepositTransactionResponse:
@@ -184,3 +213,22 @@ class Accounts(API):
184
213
 
185
214
  url_path = "/withdrawal/submit"
186
215
  return self.send_request("POST", self.group_url_path + url_path, payload)
216
+
217
+ def submit_transferal_transaction(
218
+ self, signed_tx: str, **kwargs
219
+ ) -> SubmitTransferalTransactionResponse:
220
+ """
221
+ Submit a transferal transaction.
222
+
223
+ Args:
224
+ data: A SubmitTransferalTransactionRequest object containing the transferal transaction details.
225
+
226
+ Returns:
227
+ A SubmitTransferalTransactionResponse object containing the submitted transferal transaction.
228
+ """
229
+
230
+ check_required_parameter(signed_tx, "signed_tx")
231
+ payload = {"signed_tx": signed_tx, **kwargs}
232
+
233
+ url_path = "/transferal/submit"
234
+ return self.send_request("POST", self.group_url_path + url_path, payload)
@@ -52,11 +52,21 @@ class BuildWithdrawalTransactionResponse(TypedDict):
52
52
  tx_hex: str
53
53
 
54
54
 
55
+ @dataclass
56
+ class BuildTransferalTransactionResponse(TypedDict):
57
+ tx_hex: str
58
+
59
+
55
60
  @dataclass
56
61
  class SubmitWithdrawalTransactionResponse(TypedDict):
57
62
  tx_hash: str
58
63
 
59
64
 
65
+ @dataclass
66
+ class SubmitTransferalTransactionResponse(TypedDict):
67
+ tx_hash: str
68
+
69
+
60
70
  @dataclass
61
71
  class GetAccountInfoResponse(TypedDict):
62
72
  api_key: str