deltadefi 0.0.7__py3-none-any.whl → 0.0.9__py3-none-any.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.

Potentially problematic release.


This version of deltadefi might be problematic. Click here for more details.

@@ -1,10 +1,11 @@
1
1
  # flake8: noqa: E501
2
- from sidan_gin import HDWallet
2
+ from sidan_gin import Wallet
3
3
 
4
4
  from deltadefi.clients.accounts import Accounts
5
5
  from deltadefi.clients.app import App
6
6
  from deltadefi.clients.market import Market
7
7
  from deltadefi.clients.order import Order
8
+ from deltadefi.models.models import OrderSide, OrderType
8
9
  from deltadefi.responses import PostOrderResponse
9
10
 
10
11
 
@@ -17,7 +18,7 @@ class ApiClient:
17
18
  self,
18
19
  network: str = "preprod",
19
20
  api_key: str = None,
20
- wallet: HDWallet = None,
21
+ wallet: Wallet = None,
21
22
  base_url: str = None,
22
23
  ):
23
24
  """
@@ -25,7 +26,7 @@ class ApiClient:
25
26
 
26
27
  Args:
27
28
  config: An instance of ApiConfig containing the API configuration.
28
- wallet: An instance of HDWallet for signing transactions.
29
+ wallet: An instance of Wallet for signing transactions.
29
30
  base_url: Optional; The base URL for the API. Defaults to "https://api-dev.deltadefi.io".
30
31
  """
31
32
  if network == "mainnet":
@@ -33,7 +34,7 @@ class ApiClient:
33
34
  self.base_url = "https://api-dev.deltadefi.io" # TODO: input production link once available
34
35
  else:
35
36
  self.network_id = 0
36
- self.base_url = "https://api-dev.deltadefi.io"
37
+ self.base_url = "https://api-staging.deltadefi.io"
37
38
 
38
39
  if base_url:
39
40
  self.base_url = base_url
@@ -41,17 +42,23 @@ class ApiClient:
41
42
  self.api_key = api_key
42
43
  self.wallet = wallet
43
44
 
44
- self.accounts = Accounts(base_url=base_url, api_key=api_key)
45
- self.app = App(base_url=base_url, api_key=api_key)
46
- self.order = Order(base_url=base_url, api_key=api_key)
47
- self.market = Market(base_url=base_url, api_key=api_key)
45
+ self.accounts = Accounts(base_url=self.base_url, api_key=api_key)
46
+ self.app = App(base_url=self.base_url, api_key=api_key)
47
+ self.order = Order(base_url=self.base_url, api_key=api_key)
48
+ self.market = Market(base_url=self.base_url, api_key=api_key)
48
49
 
49
- async def post_order(self, **kwargs) -> PostOrderResponse:
50
+ def post_order(
51
+ self, symbol: str, side: OrderSide, type: OrderType, quantity: int, **kwargs
52
+ ) -> PostOrderResponse:
50
53
  """
51
- Post an order to the DeltaDeFi API.
54
+ Post an order to the DeltaDeFi API. It includes building the transaction, signing it with the wallet, and submitting it.
52
55
 
53
56
  Args:
54
- data: A PostOrderRequest object containing the order details.
57
+ symbol: The trading pair symbol (e.g., "BTC-USD").
58
+ side: The side of the order (e.g., "buy" or "sell").
59
+ type: The type of the order (e.g., "limit" or "market").
60
+ quantity: The quantity of the asset to be traded.
61
+ **kwargs: Additional parameters for the order, such as price, limit_slippage, etc.
55
62
 
56
63
  Returns:
57
64
  A PostOrderResponse object containing the response from the API.
@@ -59,10 +66,19 @@ class ApiClient:
59
66
  Raises:
60
67
  ValueError: If the wallet is not initialized.
61
68
  """
69
+ print(
70
+ f"post_order: symbol={symbol}, side={side}, type={type}, quantity={quantity}, kwargs={kwargs}"
71
+ )
62
72
  if not hasattr(self, "wallet") or self.wallet is None:
63
73
  raise ValueError("Wallet is not initialized")
64
74
 
65
- build_res = "" # TODO: import wallet build order
75
+ build_res = self.order.build_place_order_transaction(
76
+ symbol, side, type, quantity, **kwargs
77
+ )
78
+ print(f"build_res: {build_res}")
66
79
  signed_tx = self.wallet.sign_tx(build_res["tx_hex"])
67
- submit_res = signed_tx + "" # TODO: import wallet submit tx
80
+ submit_res = self.order.submit_place_order_transaction(
81
+ build_res["order_id"], signed_tx, **kwargs
82
+ )
83
+ print(f"submit_res: {submit_res}")
68
84
  return submit_res
@@ -31,7 +31,11 @@ class Order(API):
31
31
  Build a place order transaction.
32
32
 
33
33
  Args:
34
- data: A BuildPlaceOrderTransactionRequest object containing the order details.
34
+ symbol: The trading pair symbol (e.g., "BTC-USD").
35
+ side: The side of the order (e.g., "buy" or "sell").
36
+ type: The type of the order (e.g., "limit" or "market").
37
+ quantity: The quantity of the asset to be traded.
38
+ **kwargs: Additional parameters for the order, such as price, limit_slippage, etc.
35
39
 
36
40
  Returns:
37
41
  A BuildPlaceOrderTransactionResponse object containing the built order transaction.
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass
2
- from typing import List
2
+ from typing import List, TypedDict
3
3
 
4
4
  from deltadefi.models.models import (
5
5
  AssetBalance,
@@ -10,23 +10,23 @@ from deltadefi.models.models import (
10
10
 
11
11
 
12
12
  @dataclass
13
- class CreateNewAPIKeyResponse:
13
+ class CreateNewAPIKeyResponse(TypedDict):
14
14
  api_key: str
15
15
 
16
16
 
17
17
  @dataclass
18
- class GetOperationKeyResponse:
18
+ class GetOperationKeyResponse(TypedDict):
19
19
  encrypted_operation_key: str
20
20
  operation_key_hash: str
21
21
 
22
22
 
23
23
  @dataclass
24
- class BuildDepositTransactionResponse:
24
+ class BuildDepositTransactionResponse(TypedDict):
25
25
  tx_hex: str
26
26
 
27
27
 
28
28
  @dataclass
29
- class SubmitDepositTransactionResponse:
29
+ class SubmitDepositTransactionResponse(TypedDict):
30
30
  tx_hash: str
31
31
 
32
32
 
@@ -41,22 +41,22 @@ class GetWithdrawalRecordsResponse(List[WithdrawalRecord]):
41
41
 
42
42
 
43
43
  @dataclass
44
- class GetOrderRecordResponse:
44
+ class GetOrderRecordResponse(TypedDict):
45
45
  orders: List[OrderJSON]
46
46
 
47
47
 
48
48
  @dataclass
49
- class BuildWithdrawalTransactionResponse:
49
+ class BuildWithdrawalTransactionResponse(TypedDict):
50
50
  tx_hex: str
51
51
 
52
52
 
53
53
  @dataclass
54
- class SubmitWithdrawalTransactionResponse:
54
+ class SubmitWithdrawalTransactionResponse(TypedDict):
55
55
  tx_hash: str
56
56
 
57
57
 
58
58
  @dataclass
59
- class GetAccountInfoResponse:
59
+ class GetAccountInfoResponse(TypedDict):
60
60
  api_key: str
61
61
  api_limit: int
62
62
  created_at: str
@@ -1,33 +1,33 @@
1
1
  from dataclasses import dataclass
2
- from typing import List
2
+ from typing import List, TypedDict
3
3
 
4
4
  from deltadefi.models import OrderJSON
5
5
 
6
6
 
7
7
  @dataclass
8
- class GetTermsAndConditionResponse:
8
+ class GetTermsAndConditionResponse(TypedDict):
9
9
  value: str
10
10
 
11
11
 
12
12
  @dataclass
13
- class MarketDepth:
13
+ class MarketDepth(TypedDict):
14
14
  price: float
15
15
  quantity: float
16
16
 
17
17
 
18
18
  @dataclass
19
- class GetMarketDepthResponse:
19
+ class GetMarketDepthResponse(TypedDict):
20
20
  bids: List[MarketDepth]
21
21
  asks: List[MarketDepth]
22
22
 
23
23
 
24
24
  @dataclass
25
- class GetMarketPriceResponse:
25
+ class GetMarketPriceResponse(TypedDict):
26
26
  price: float
27
27
 
28
28
 
29
29
  @dataclass
30
- class Trade:
30
+ class Trade(TypedDict):
31
31
  time: str
32
32
  symbol: str
33
33
  open: float
@@ -43,13 +43,13 @@ class GetAggregatedPriceResponse(List[Trade]):
43
43
 
44
44
 
45
45
  @dataclass
46
- class BuildPlaceOrderTransactionResponse:
46
+ class BuildPlaceOrderTransactionResponse(TypedDict):
47
47
  order_id: str
48
48
  tx_hex: str
49
49
 
50
50
 
51
51
  @dataclass
52
- class SubmitPlaceOrderTransactionResponse:
52
+ class SubmitPlaceOrderTransactionResponse(TypedDict):
53
53
  order: OrderJSON
54
54
 
55
55
 
@@ -59,10 +59,10 @@ class PostOrderResponse(SubmitPlaceOrderTransactionResponse):
59
59
 
60
60
 
61
61
  @dataclass
62
- class BuildCancelOrderTransactionResponse:
62
+ class BuildCancelOrderTransactionResponse(TypedDict):
63
63
  tx_hex: str
64
64
 
65
65
 
66
66
  @dataclass
67
- class SubmitCancelOrderTransactionResponse:
67
+ class SubmitCancelOrderTransactionResponse(TypedDict):
68
68
  tx_hash: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: deltadefi
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Python SDK for DeltaDeFi protocol.
5
5
  License: Apache-2.0
6
6
  Keywords: cardano
@@ -16,10 +16,11 @@ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Requires-Dist: certifi (==2024.8.30)
18
18
  Requires-Dist: charset-normalizer (==3.4.0)
19
+ Requires-Dist: dotenv (>=0.9.9,<0.10.0)
19
20
  Requires-Dist: idna (==3.10)
20
21
  Requires-Dist: pycardano (>=0.12.3,<0.13.0)
21
22
  Requires-Dist: requests (>=2.25,<3.0)
22
- Requires-Dist: sidan-gin (==0.1.1)
23
+ Requires-Dist: sidan-gin (==0.1.6)
23
24
  Requires-Dist: urllib3 (==2.2.3)
24
25
  Project-URL: Documentation, https://github.com/deltadefi-protocol/python-sdk
25
26
  Project-URL: Homepage, https://github.com/deltadefi-protocol/python-sdk
@@ -6,9 +6,9 @@ deltadefi/api_resources/validation.py,sha256=vz-hovpLy9SMOIFGcBHC8vWZH8CJRlQP8rc
6
6
  deltadefi/clients/__init__.py,sha256=AoK_kj_UKpxtCa3_if3yeHFAzHli9Mg-tsrUKOX7eH8,38
7
7
  deltadefi/clients/accounts.py,sha256=i4Xjfb4KQH3VqrBbjZ4ovKJSf2nO2VzZm1KptHM5B4M,5781
8
8
  deltadefi/clients/app.py,sha256=TOgRlP83p91r7oS4ez8Gfm8soQzFHrJAmOHZJoGZ4SM,712
9
- deltadefi/clients/clients.py,sha256=Upr2twP4i_j507TijUzmQMx8ZVhuiwoEYWjg_L484qs,2233
9
+ deltadefi/clients/clients.py,sha256=wuQ8XgvU3gscjYEwSMITB31bHsbb6eniNpHO70V7IhU,3084
10
10
  deltadefi/clients/market.py,sha256=v8hK06oXC73qS3IjvWDempHq_-9T6OW2pckIcDR7P2M,2580
11
- deltadefi/clients/order.py,sha256=kuv2mPnQeE-P66fylZEp9vXuqyhM26_MxKreY-VkoWo,3850
11
+ deltadefi/clients/order.py,sha256=grOcB_2Lr4yI3lrsctlGQd1JZwk_bV0K43jE3e2IRC4,4113
12
12
  deltadefi/constants/__init__.py,sha256=7LkrzfLTJsCCUl5IgZYrl-AbY_cf1fftcLklgnBYDTs,40
13
13
  deltadefi/constants/constants.py,sha256=9Ksb8_4t78KJpHVUnRArKlvgQk-CzcYsLRmA5qUnMwc,168
14
14
  deltadefi/error.py,sha256=Pq55p7FQbVn1GTih7NQBI7ZcVUUrlkaFKn-SwZUxBA8,1650
@@ -17,8 +17,8 @@ deltadefi/lib/utils.py,sha256=zuQFAKQphbGxDdPzBURw4A2n3AkRSbzmjMLHPLm9Ed4,1035
17
17
  deltadefi/models/__init__.py,sha256=oDJj6Y4gXN6C7Oz_t2fq8hej-D0G9OqfXjL4Jaeq8z8,37
18
18
  deltadefi/models/models.py,sha256=vnNFFPMQcOOSKhONHNHXJIx4wddV4IKeBszykiqWCwk,1182
19
19
  deltadefi/responses/__init__.py,sha256=JKSIUQu6qI_XhbAR2mVMCKNvR6x_vFZdyLGOuQTVrVY,64
20
- deltadefi/responses/accounts.py,sha256=tw88KfALO3hifBaXcPYh4ZtPASLjXIz20HH96SZ96LQ,1044
21
- deltadefi/responses/responses.py,sha256=etlx83GgZC2noLKo8GKrmDo3Xhwup-g8Ob29f0WYA4I,993
22
- deltadefi-0.0.7.dist-info/METADATA,sha256=LH-955ot3NUYxeELlRk566aj-yGlvtfh3P9KmP7Z0po,3194
23
- deltadefi-0.0.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
24
- deltadefi-0.0.7.dist-info/RECORD,,
20
+ deltadefi/responses/accounts.py,sha256=At-feMwjxHBM4vVdQMY1m_rrdCTtOTRLVc-c0-1I5Hg,1143
21
+ deltadefi/responses/responses.py,sha256=8vzUbgrW6jQjGH4Hkd9iIT0PyaeADQpPW3EBT-DxRjs,1103
22
+ deltadefi-0.0.9.dist-info/METADATA,sha256=n-XmZCn61KVEdC57tHFQLIEUXz5w8mqcocGCRmcZLuQ,3234
23
+ deltadefi-0.0.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
24
+ deltadefi-0.0.9.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any