deltadefi 0.0.7__tar.gz → 0.0.8__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.
- {deltadefi-0.0.7 → deltadefi-0.0.8}/PKG-INFO +3 -2
- {deltadefi-0.0.7 → deltadefi-0.0.8}/pyproject.toml +3 -2
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/clients.py +25 -9
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/order.py +5 -1
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/responses/accounts.py +9 -9
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/responses/responses.py +10 -10
- {deltadefi-0.0.7 → deltadefi-0.0.8}/README.md +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/api.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/api_resources/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/api_resources/auth.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/api_resources/validation.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/accounts.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/app.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/clients/market.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/constants/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/constants/constants.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/error.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/lib/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/lib/utils.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/models/__init__.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/models/models.py +0 -0
- {deltadefi-0.0.7 → deltadefi-0.0.8}/src/deltadefi/responses/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: deltadefi
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.8
|
|
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.
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "deltadefi"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.8"
|
|
4
4
|
classifiers = [
|
|
5
5
|
"Intended Audience :: Developers",
|
|
6
6
|
"License :: OSI Approved :: Apache Software License",
|
|
@@ -18,13 +18,14 @@ license = "Apache-2.0"
|
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
20
|
python = ">3.11,<4.0.0"
|
|
21
|
-
sidan-gin = "0.1.
|
|
21
|
+
sidan-gin = "0.1.6"
|
|
22
22
|
requests = "^2.25"
|
|
23
23
|
certifi = "2024.8.30"
|
|
24
24
|
charset-normalizer = "3.4.0"
|
|
25
25
|
idna = "3.10"
|
|
26
26
|
urllib3 = "2.2.3"
|
|
27
27
|
pycardano = "^0.12.3"
|
|
28
|
+
dotenv = "^0.9.9"
|
|
28
29
|
|
|
29
30
|
[tool.poetry.group.dev.dependencies]
|
|
30
31
|
pytest = "^8.2.0"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# flake8: noqa: E501
|
|
2
|
-
from sidan_gin import
|
|
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:
|
|
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
|
|
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-
|
|
37
|
+
self.base_url = "https://api-staging.deltadefi.io"
|
|
37
38
|
|
|
38
39
|
if base_url:
|
|
39
40
|
self.base_url = base_url
|
|
@@ -46,12 +47,18 @@ class ApiClient:
|
|
|
46
47
|
self.order = Order(base_url=base_url, api_key=api_key)
|
|
47
48
|
self.market = Market(base_url=base_url, api_key=api_key)
|
|
48
49
|
|
|
49
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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
|