deltadefi 0.0.1__tar.gz → 0.0.2__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 (34) hide show
  1. {deltadefi-0.0.1 → deltadefi-0.0.2}/PKG-INFO +13 -38
  2. deltadefi-0.0.2/README.md +79 -0
  3. {deltadefi-0.0.1 → deltadefi-0.0.2}/pyproject.toml +1 -1
  4. deltadefi-0.0.2/src/deltadefi/api.py +77 -0
  5. deltadefi-0.0.2/src/deltadefi/clients/__init__.py +2 -0
  6. deltadefi-0.0.2/src/deltadefi/clients/accounts.py +162 -0
  7. deltadefi-0.0.2/src/deltadefi/clients/app.py +23 -0
  8. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/clients/clients.py +10 -20
  9. deltadefi-0.0.2/src/deltadefi/clients/markets.py +90 -0
  10. deltadefi-0.0.2/src/deltadefi/clients/order.py +122 -0
  11. deltadefi-0.0.2/src/deltadefi/error.py +62 -0
  12. deltadefi-0.0.2/src/deltadefi/lib/__init__.py +0 -0
  13. deltadefi-0.0.2/src/deltadefi/lib/utils.py +46 -0
  14. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/models/models.py +1 -3
  15. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/responses/accounts.py +0 -6
  16. deltadefi-0.0.1/README.md +0 -104
  17. deltadefi-0.0.1/src/deltadefi/clients/__init__.py +0 -6
  18. deltadefi-0.0.1/src/deltadefi/clients/accounts.py +0 -225
  19. deltadefi-0.0.1/src/deltadefi/clients/app.py +0 -32
  20. deltadefi-0.0.1/src/deltadefi/clients/markets.py +0 -82
  21. deltadefi-0.0.1/src/deltadefi/clients/orders.py +0 -107
  22. deltadefi-0.0.1/src/deltadefi/error.py +0 -63
  23. deltadefi-0.0.1/src/deltadefi/requests/__init__.py +0 -3
  24. deltadefi-0.0.1/src/deltadefi/requests/accounts.py +0 -31
  25. deltadefi-0.0.1/src/deltadefi/requests/requests.py +0 -67
  26. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/__init__.py +0 -0
  27. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/api_resources/__init__.py +0 -0
  28. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/api_resources/auth.py +0 -0
  29. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/api_resources/validation.py +0 -0
  30. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/constants/__init__.py +0 -0
  31. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/constants/constants.py +0 -0
  32. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/models/__init__.py +0 -0
  33. {deltadefi-0.0.1 → deltadefi-0.0.2}/src/deltadefi/responses/__init__.py +0 -0
  34. {deltadefi-0.0.1 → deltadefi-0.0.2}/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.1
3
+ Version: 0.0.2
4
4
  Summary: Python SDK for DeltaDeFi protocol.
5
5
  License: Apache-2.0
6
6
  Keywords: cardano
@@ -34,7 +34,7 @@ The DeltaDeFi Python SDK provides a convenient way to interact with the DeltaDeF
34
34
  To install the SDK, use `pip`:
35
35
 
36
36
  ```sh
37
- pip install deltadefi-python-sdk
37
+ pip install deltadefi
38
38
  ```
39
39
 
40
40
  ## Requirements
@@ -48,19 +48,18 @@ pip install deltadefi-python-sdk
48
48
  To use the SDK, you need to initialize the ApiClient with your API configuration and wallet.
49
49
 
50
50
  ```python
51
- from deltadefi.api_resources.api_config import ApiConfig
52
- from deltadefi.clients.clients import ApiClient
51
+ from deltadefi.clients import ApiClient
53
52
  from sidan_gin import HDWallet
54
53
 
55
54
  # Initialize API configuration
56
- network="mainnet",
55
+ network="preprod",
57
56
  api_key="your_api_key",
58
57
 
59
58
  # Initialize HDWallet
60
59
  wallet = HDWallet("your_wallet_mnemonic")
61
60
 
62
61
  # Initialize ApiClient
63
- api_client = ApiClient(network=network, api_key=api_key, wallet=wallet)
62
+ api = ApiClient(network=network, api_key=api_key, wallet=wallet)
64
63
  ```
65
64
 
66
65
  ### Accounts
@@ -68,17 +67,8 @@ api_client = ApiClient(network=network, api_key=api_key, wallet=wallet)
68
67
  The Accounts client allows you to interact with account-related endpoints.
69
68
 
70
69
  ```python
71
- from deltadefi.clients.accounts import Accounts
72
-
73
- accounts_client = api_client.accounts
74
-
75
- # Sign in
76
- sign_in_request = SignInRequest(auth_key="your_auth_key", wallet_address="your_wallet_address")
77
- sign_in_response = accounts_client.sign_in(sign_in_request)
78
- print(sign_in_response)
79
-
80
70
  # Get account balance
81
- account_balance = accounts_client.get_account_balance()
71
+ account_balance = api.accounts.get_account_balance()
82
72
  print(account_balance)
83
73
  ```
84
74
 
@@ -87,46 +77,31 @@ print(account_balance)
87
77
  The Markets client allows you to interact with market-related endpoints.
88
78
 
89
79
  ```python
90
- from deltadefi.clients.markets import Markets
91
-
92
- markets_client = api_client.markets
93
-
94
80
  # Get market depth
95
- market_depth_request = GetMarketDepthRequest(pair="BTC/USD")
96
- market_depth_response = markets_client.getDepth(market_depth_request)
81
+ market_depth = api.markets.get_depth("ADAUSDX")
97
82
  print(market_depth_response)
98
83
 
99
84
  # Get market price
100
- market_price_request = GetMarketPriceRequest(pair="BTC/USD")
101
- market_price_response = markets_client.getMarketPrice(market_price_request)
85
+ market_price_response = api.markets.get_market_price("ADAUSDX")
102
86
  print(market_price_response)
103
87
  ```
104
88
 
105
- ### Orders
89
+ ### Order
106
90
 
107
- The Orders client allows you to interact with order-related endpoints.
91
+ The Order client allows you to interact with order-related endpoints.
108
92
 
109
93
  ```python
110
- from deltadefi.clients.orders import Orders
111
-
112
- orders_client = api_client.orders
113
-
114
94
  # Build place order transaction
115
95
  place_order_request = BuildPlaceOrderTransactionRequest(pair="BTC/USD", amount=1, price=50000)
116
- place_order_response = orders_client.build_place_order_transaction(place_order_request)
96
+ place_order_response = api.order.build_place_order_transaction(symbol="ADAUSDX", amount=50, price=0.75, type="limit")
117
97
  print(place_order_response)
118
98
 
119
99
  # Submit place order transaction
120
- submit_order_request = SubmitPlaceOrderTransactionRequest(order_id="order_id")
121
- submit_order_response = orders_client.submit_place_order_transaction(submit_order_request)
100
+ submit_order_response = api.order.submit_place_order_transaction(signed_tx="<signed_tx>", order_id="<order_id>")
122
101
  print(submit_order_response)
123
102
  ```
124
103
 
125
104
  ## License
126
105
 
127
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
128
-
129
- ```
130
- http://www.apache.org/licenses/LICENSE-2.0
131
- ```
106
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
132
107
 
@@ -0,0 +1,79 @@
1
+ # DeltaDeFi Python SDK
2
+
3
+ The DeltaDeFi Python SDK provides a convenient way to interact with the DeltaDeFi API. This SDK allows developers to easily integrate DeltaDeFi's features into their Python applications.
4
+
5
+ ## Installation
6
+
7
+ To install the SDK, use `pip`:
8
+
9
+ ```sh
10
+ pip install deltadefi
11
+ ```
12
+
13
+ ## Requirements
14
+
15
+ - Python 3.11 or higher
16
+
17
+ ## Usage
18
+
19
+ ### Initialization
20
+
21
+ To use the SDK, you need to initialize the ApiClient with your API configuration and wallet.
22
+
23
+ ```python
24
+ from deltadefi.clients import ApiClient
25
+ from sidan_gin import HDWallet
26
+
27
+ # Initialize API configuration
28
+ network="preprod",
29
+ api_key="your_api_key",
30
+
31
+ # Initialize HDWallet
32
+ wallet = HDWallet("your_wallet_mnemonic")
33
+
34
+ # Initialize ApiClient
35
+ api = ApiClient(network=network, api_key=api_key, wallet=wallet)
36
+ ```
37
+
38
+ ### Accounts
39
+
40
+ The Accounts client allows you to interact with account-related endpoints.
41
+
42
+ ```python
43
+ # Get account balance
44
+ account_balance = api.accounts.get_account_balance()
45
+ print(account_balance)
46
+ ```
47
+
48
+ ### Markets
49
+
50
+ The Markets client allows you to interact with market-related endpoints.
51
+
52
+ ```python
53
+ # Get market depth
54
+ market_depth = api.markets.get_depth("ADAUSDX")
55
+ print(market_depth_response)
56
+
57
+ # Get market price
58
+ market_price_response = api.markets.get_market_price("ADAUSDX")
59
+ print(market_price_response)
60
+ ```
61
+
62
+ ### Order
63
+
64
+ The Order client allows you to interact with order-related endpoints.
65
+
66
+ ```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="ADAUSDX", 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)
75
+ ```
76
+
77
+ ## License
78
+
79
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "deltadefi"
3
- version = "0.0.1"
3
+ version = "0.0.2"
4
4
  classifiers = [
5
5
  "Intended Audience :: Developers",
6
6
  "License :: OSI Approved :: Apache Software License",
@@ -0,0 +1,77 @@
1
+ import json
2
+
3
+ import requests
4
+
5
+ from deltadefi.error import ClientError, ServerError
6
+ from deltadefi.lib.utils import clean_none_value, encoded_string
7
+
8
+
9
+ class API(object):
10
+ def __init__(self, base_url=None, api_key=None, timeout=None, **kwargs):
11
+ self.base_url = base_url
12
+ self.api_key = api_key
13
+ self.timeout = timeout
14
+ self.session = requests.Session()
15
+ self.session.headers.update(
16
+ {
17
+ "Content-Type": "application/json;charset=utf-8",
18
+ "X-API-KEY": api_key if api_key is not None else "",
19
+ }
20
+ )
21
+
22
+ def send_request(self, http_method, url_path, payload=None):
23
+ if payload is None:
24
+ payload = {}
25
+ url = self.base_url + url_path
26
+ params = clean_none_value(
27
+ {
28
+ "url": url,
29
+ "params": self._prepare_params(payload),
30
+ "timeout": self.timeout,
31
+ }
32
+ )
33
+ response = self._dispatch_request(http_method)(**params)
34
+ self._handle_exception(response)
35
+
36
+ try:
37
+ data = response.json()
38
+ except ValueError:
39
+ data = response.text
40
+ result = {}
41
+
42
+ if len(result) != 0:
43
+ result["data"] = data
44
+ return result
45
+
46
+ return data
47
+
48
+ def _dispatch_request(self, http_method):
49
+ return {
50
+ "GET": self.session.get,
51
+ "DELETE": self.session.delete,
52
+ "PUT": self.session.put,
53
+ "POST": self.session.post,
54
+ }.get(http_method, "GET")
55
+
56
+ def _prepare_params(self, params):
57
+ return encoded_string(clean_none_value(params))
58
+
59
+ def _handle_exception(self, response):
60
+ status_code = response.status_code
61
+ if status_code < 400:
62
+ return
63
+ if 400 <= status_code < 500:
64
+ try:
65
+ err = json.loads(response.text)
66
+ except json.JSONDecodeError:
67
+ raise ClientError(
68
+ status_code, None, response.text, response.headers, None
69
+ )
70
+ error_data = None
71
+ if "data" in err:
72
+ error_data = err["data"]
73
+ print("Error?", err)
74
+ raise ClientError(
75
+ status_code, err["code"], err["msg"], response.headers, error_data
76
+ )
77
+ raise ServerError(status_code, response.text)
@@ -0,0 +1,2 @@
1
+ # flake8: noqa
2
+ from .clients import *
@@ -0,0 +1,162 @@
1
+ #
2
+ from typing import List
3
+
4
+ from sidan_gin import Asset, UTxO
5
+
6
+ from deltadefi.api import API
7
+ from deltadefi.lib.utils import check_required_parameter, check_required_parameters
8
+ from deltadefi.responses import (
9
+ BuildDepositTransactionResponse,
10
+ BuildWithdrawalTransactionResponse,
11
+ CreateNewAPIKeyResponse,
12
+ GetAccountBalanceResponse,
13
+ GetDepositRecordsResponse,
14
+ GetOrderRecordResponse,
15
+ GetWithdrawalRecordsResponse,
16
+ SubmitDepositTransactionResponse,
17
+ SubmitWithdrawalTransactionResponse,
18
+ )
19
+
20
+
21
+ class Accounts(API):
22
+ """
23
+ Accounts client for interacting with the DeltaDeFi API.
24
+ """
25
+
26
+ group_url_path = "/accounts"
27
+
28
+ def __init__(self, api_key=None, base_url=None, **kwargs):
29
+ super().__init__(api_key=api_key, base_url=base_url, **kwargs)
30
+
31
+ def create_new_api_key(self, **kwargs) -> CreateNewAPIKeyResponse:
32
+ """
33
+ Create a new API key.
34
+
35
+ Returns:
36
+ A CreateNewAPIKeyResponse object containing the new API key.
37
+ """
38
+
39
+ url_path = "/new-api-key"
40
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
41
+
42
+ def get_deposit_records(self, **kwargs) -> GetDepositRecordsResponse:
43
+ """
44
+ Get deposit records.
45
+
46
+ Returns:
47
+ A GetDepositRecordsResponse object containing the deposit records.
48
+ """
49
+ url_path = "/deposit-records"
50
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
51
+
52
+ def get_withdrawal_records(self, **kwargs) -> GetWithdrawalRecordsResponse:
53
+ """
54
+ Get withdrawal records.
55
+
56
+ Returns:
57
+ A GetWithdrawalRecordsResponse object containing the withdrawal records.
58
+ """
59
+ url_path = "/withdrawal-records"
60
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
61
+
62
+ def get_order_records(self, **kwargs) -> GetOrderRecordResponse:
63
+ """
64
+ Get order records.
65
+
66
+ Returns:
67
+ A GetOrderRecordResponse object containing the order records.
68
+ """
69
+ url_path = "/order-records"
70
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
71
+
72
+ def get_account_balance(self, **kwargs) -> GetAccountBalanceResponse:
73
+ """
74
+ Get account balance.
75
+
76
+ Returns:
77
+ A GetAccountBalanceResponse object containing the account balance.
78
+ """
79
+ url_path = "/balance"
80
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
81
+
82
+ def build_deposit_transaction(
83
+ self, deposit_amount: List[Asset], input_utxos: List[UTxO], **kwargs
84
+ ) -> BuildDepositTransactionResponse:
85
+ """
86
+ Build a deposit transaction.
87
+
88
+ Args:
89
+ data: A BuildDepositTransactionRequest object containing the deposit transaction details.
90
+
91
+ Returns:
92
+ A BuildDepositTransactionResponse object containing the built deposit transaction.
93
+ """
94
+
95
+ check_required_parameters(
96
+ [[deposit_amount, "deposit_amount"], [input_utxos, "input_utxos"]]
97
+ )
98
+ payload = {
99
+ "deposit_amount": deposit_amount,
100
+ "input_utxos": input_utxos,
101
+ **kwargs,
102
+ }
103
+
104
+ url_path = "/deposit/build"
105
+ return self.send_request("POST", self.group_url_path + url_path, payload)
106
+
107
+ def build_withdrawal_transaction(
108
+ self, withdrawal_amount: List[Asset], **kwargs
109
+ ) -> BuildWithdrawalTransactionResponse:
110
+ """
111
+ Build a withdrawal transaction.
112
+
113
+ Args:
114
+ data: A BuildWithdrawalTransactionRequest object containing the withdrawal transaction details.
115
+
116
+ Returns:
117
+ A BuildWithdrawalTransactionResponse object containing the built withdrawal transaction.
118
+ """
119
+
120
+ check_required_parameter(withdrawal_amount, "withdrawal_amount")
121
+ payload = {"withdrawal_amount": withdrawal_amount, **kwargs}
122
+
123
+ url_path = "/withdrawal/build"
124
+ return self.send_request("POST", self.group_url_path + url_path, payload)
125
+
126
+ def submit_deposit_transaction(
127
+ self, signed_tx: str, **kwargs
128
+ ) -> SubmitDepositTransactionResponse:
129
+ """
130
+ Submit a deposit transaction.
131
+
132
+ Args:
133
+ data: A SubmitDepositTransactionRequest object containing the deposit transaction details.
134
+
135
+ Returns:
136
+ A SubmitDepositTransactionResponse object containing the submitted deposit transaction.
137
+ """
138
+
139
+ check_required_parameter(signed_tx, "signed_tx")
140
+ payload = {"signed_tx": signed_tx, **kwargs}
141
+
142
+ url_path = "/deposit/submit"
143
+ return self.send_request("POST", self.group_url_path + url_path, payload)
144
+
145
+ def submit_withdrawal_transaction(
146
+ self, signed_tx: str, **kwargs
147
+ ) -> SubmitWithdrawalTransactionResponse:
148
+ """
149
+ Submit a withdrawal transaction.
150
+
151
+ Args:
152
+ data: A SubmitWithdrawalTransactionRequest object containing the withdrawal transaction details.
153
+
154
+ Returns:
155
+ A SubmitWithdrawalTransactionResponse object containing the submitted withdrawal transaction.
156
+ """
157
+
158
+ check_required_parameter(signed_tx, "signed_tx")
159
+ payload = {"signed_tx": signed_tx, **kwargs}
160
+
161
+ url_path = "/withdrawal/submit"
162
+ return self.send_request("POST", self.group_url_path + url_path, payload)
@@ -0,0 +1,23 @@
1
+ from deltadefi.api import API
2
+ from deltadefi.responses import GetTermsAndConditionResponse
3
+
4
+
5
+ class App(API):
6
+ """
7
+ App client for interacting with the DeltaDeFi API.
8
+ """
9
+
10
+ group_url_path = "/app"
11
+
12
+ def __init__(self, api_key=None, base_url=None, **kwargs):
13
+ super().__init__(api_key=api_key, base_url=base_url, **kwargs)
14
+
15
+ def get_terms_and_condition(self, **kwargs) -> GetTermsAndConditionResponse:
16
+ """
17
+ Get terms and conditions.
18
+
19
+ Returns:
20
+ A GetTermsAndConditionResponse object containing the terms and conditions.
21
+ """
22
+ url_path = "/terms-and-conditions"
23
+ return self.send_request("GET", self.group_url_path + url_path, kwargs)
@@ -3,9 +3,9 @@ from sidan_gin import HDWallet
3
3
 
4
4
  from deltadefi.api_resources.auth import ApiHeaders
5
5
  from deltadefi.clients.accounts import Accounts
6
+ from deltadefi.clients.app import App
6
7
  from deltadefi.clients.markets import Markets
7
- from deltadefi.clients.orders import Orders
8
- from deltadefi.requests import PostOrderRequest
8
+ from deltadefi.clients.order import Order
9
9
  from deltadefi.responses import PostOrderResponse
10
10
 
11
11
 
@@ -17,7 +17,6 @@ class ApiClient:
17
17
  def __init__(
18
18
  self,
19
19
  network: str = "preprod",
20
- jwt: str = None,
21
20
  api_key: str = None,
22
21
  wallet: HDWallet = None,
23
22
  base_url: str = None,
@@ -30,11 +29,6 @@ class ApiClient:
30
29
  wallet: An instance of HDWallet for signing transactions.
31
30
  base_url: Optional; The base URL for the API. Defaults to "https://api-dev.deltadefi.io".
32
31
  """
33
- self.base_url = base_url or "https://api-dev.deltadefi.io"
34
- headers: ApiHeaders = {
35
- "Content-Type": "application/json",
36
- }
37
-
38
32
  if network == "mainnet":
39
33
  self.network_id = 1
40
34
  base_url = "https://api-dev.deltadefi.io" # TODO: input production link once available
@@ -42,20 +36,16 @@ class ApiClient:
42
36
  self.network_id = 0
43
37
  base_url = "https://api-dev.deltadefi.io"
44
38
 
45
- if jwt is not None:
46
- headers["Authorization"] = jwt
47
-
48
- if api_key is not None:
49
- headers["X-API-KEY"] = api_key
50
-
51
- if wallet is not None:
52
- self.wallet = wallet.signing_key
39
+ self.api_key = api_key
40
+ self.wallet = wallet
41
+ self.base_url = base_url
53
42
 
54
- self.accounts = Accounts(self)
55
- self.orders = Orders(self)
56
- self.markets = Markets(self)
43
+ self.accounts = Accounts(base_url=base_url, api_key=api_key)
44
+ self.app = App(base_url=base_url, api_key=api_key)
45
+ self.order = Order(base_url=base_url, api_key=api_key)
46
+ self.markets = Markets(base_url=base_url, api_key=api_key)
57
47
 
58
- async def post_order(self, data: PostOrderRequest) -> PostOrderResponse:
48
+ async def post_order(self, **kwargs) -> PostOrderResponse:
59
49
  """
60
50
  Post an order to the DeltaDeFi API.
61
51
 
@@ -0,0 +1,90 @@
1
+ # flake8: noqa: E501
2
+
3
+ from typing import Literal
4
+
5
+ from deltadefi.api import API
6
+ from deltadefi.lib.utils import check_required_parameter, check_required_parameters
7
+ from deltadefi.responses import (
8
+ GetAggregatedPriceResponse,
9
+ GetMarketDepthResponse,
10
+ GetMarketPriceResponse,
11
+ )
12
+
13
+
14
+ class Markets(API):
15
+ """
16
+ Markets client for interacting with the DeltaDeFi API.
17
+ """
18
+
19
+ group_url_path = "/market"
20
+
21
+ def __init__(self, api_key=None, base_url=None, **kwargs):
22
+ super().__init__(api_key=api_key, base_url=base_url, **kwargs)
23
+
24
+ def get_depth(self, symbol: str, **kwargs) -> GetMarketDepthResponse:
25
+ """
26
+ Get market depth.
27
+
28
+ Args:
29
+ data: A GetMarketDepthRequest object containing the market pair.
30
+
31
+ Returns:
32
+ A GetMarketDepthResponse object containing the market depth.
33
+ """
34
+
35
+ check_required_parameter(symbol, "symbol")
36
+ payload = {"symbol": symbol, **kwargs}
37
+ url_path = "/depth"
38
+
39
+ return self.send_request("GET", self.group_url_path + url_path, payload)
40
+
41
+ def get_market_price(self, symbol: str, **kwargs) -> GetMarketPriceResponse:
42
+ """
43
+ Get market price.
44
+
45
+ Args:
46
+ data: A GetMarketPriceRequest object containing the market pair.
47
+
48
+ Returns:
49
+ A GetMarketPriceResponse object containing the market price.
50
+ """
51
+ check_required_parameter(symbol, "symbol")
52
+ payload = {"symbol": symbol, **kwargs}
53
+ url_path = "/market-price"
54
+ return self.send_request("GET", self.group_url_path + url_path, payload)
55
+
56
+ def get_aggregated_price(
57
+ self,
58
+ symbol: str,
59
+ interval: Literal["15m", "30m", "1h", "1d", "1w", "1M"],
60
+ start: int,
61
+ end: int,
62
+ ) -> GetAggregatedPriceResponse:
63
+ """
64
+ Get aggregated price.
65
+
66
+ Args:
67
+ data: A GetAggregatedPriceRequest object containing the market pair, interval, start, and end time.
68
+
69
+ Returns:
70
+ A GetAggregatedPriceResponse object containing the aggregated price.
71
+ """
72
+
73
+ check_required_parameters(
74
+ [
75
+ [symbol, "symbol"],
76
+ [interval, "interval"],
77
+ [start, "start"],
78
+ [end, "end"],
79
+ ]
80
+ )
81
+ url_path = f"/aggregated-trade/{symbol}"
82
+ return self.send_request(
83
+ "GET",
84
+ self.group_url_path + url_path,
85
+ {
86
+ "interval": interval,
87
+ "start": start,
88
+ "end": end,
89
+ },
90
+ )