Skip to content

Commit 832b9c3

Browse files
committed
fix: fix build place order
1 parent 067f525 commit 832b9c3

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "deltadefi"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
classifiers = [
55
"Intended Audience :: Developers",
66
"License :: OSI Approved :: Apache Software License",

src/deltadefi/api.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,23 @@ def send_request(self, http_method, url_path, payload=None):
2323
if payload is None:
2424
payload = {}
2525
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-
)
26+
if http_method.upper() == "GET":
27+
params = clean_none_value(
28+
{
29+
"url": url,
30+
"params": self._prepare_params(payload), # Query parameters
31+
"timeout": self.timeout,
32+
}
33+
)
34+
else:
35+
params = clean_none_value(
36+
{
37+
"url": url,
38+
"json": payload, # Use 'json' to send payload in the body
39+
"timeout": self.timeout,
40+
}
41+
)
42+
3343
response = self._dispatch_request(http_method)(**params)
3444
self._handle_exception(response)
3545

src/deltadefi/clients/order.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,18 @@ def build_place_order_transaction(
5050
)
5151

5252
if type == "limit":
53-
check_required_parameter(price, "price")
53+
check_required_parameter(kwargs.get("price"), "price")
5454

55-
if type == "market" and limit_slippage:
55+
if type == "market" and kwargs.get("limit_slippage"):
5656
check_required_parameter(
57-
max_slippage_basis_point, "max_slippage_basis_point"
57+
kwargs.get("max_slippage_basis_point"), "max_slippage_basis_point"
5858
)
5959

6060
payload = {
6161
"symbol": symbol,
6262
"side": side,
6363
"type": type,
6464
"quantity": quantity,
65-
"max_slippage_basis_point": max_slippage_basis_point,
66-
"limit_slippage": limit_slippage,
6765
**kwargs,
6866
}
6967

0 commit comments

Comments
 (0)