Skip to content

Commit 42f6acb

Browse files
author
T. Ismael Verdugo
committed
feat: stop price arg in replce methods
1 parent d04f5d4 commit 42f6acb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cryptomarket/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ def replace_spot_order(
748748
new_client_order_id: str,
749749
quantity: str,
750750
price: Optional[str] = None,
751+
stop_price: Optional[str] = None,
751752
strict_validate: Optional[bool] = None
752753
) -> Order:
753754
"""Replaces a spot order
@@ -761,13 +762,14 @@ def replace_spot_order(
761762
:param client order id: client order id of the old order
762763
:param new client order id: client order id for the new order
763764
:param quantity: Order quantity
764-
:param strict validate: Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment
765765
:param price: Required if order type is 'limit', 'stopLimit', or 'takeProfitLimit'. Order price
766+
:param stop price: Required if order type is 'stopLimit', 'stopMarket', 'takeProfitLimit', or 'takeProfitMarket'. Order price
767+
:param strict validate: Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's tick_size and quantity_increment
766768
767769
:return: The new spot order
768770
"""
769771
params = args.DictBuilder().new_client_order_id(new_client_order_id).quantity(
770-
quantity).price(price).strict_validate(strict_validate).build()
772+
quantity).price(price).stop_price(stop_price).strict_validate(strict_validate).build()
771773
response = self._patch(
772774
endpoint=f'spot/order/{client_order_id}', params=params)
773775
return from_dict(data_class=Order, data=response, config=Config(cast=[Enum]))

cryptomarket/websockets/trading_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ def replace_spot_order(
335335
new_client_order_id: str,
336336
quantiy: str,
337337
price: str,
338+
stop_price: Optional[str]=None,
338339
strict_validate: Optional[bool] = None,
339340
callback: Optional[Callback[Report]] = None
340341
):
@@ -346,11 +347,12 @@ def replace_spot_order(
346347
:param new_client_order_id: the new client order id for the modified order. must be unique within the trading day
347348
:param quantity: new order quantity
348349
:param price: new order price
350+
:param stop price: Required if order type is 'stopLimit', 'stopMarket', 'takeProfitLimit', or 'takeProfitMarket'. Order price
349351
:param strict_validate: price and quantity will be checked for the incrementation with tick size and quantity step. See symbol's tick_size and quantity_increment
350352
:param callback: A callable of two arguments, takes either a CryptomarketAPIException, or a report of the new version of the order
351353
"""
352354
params = args.DictBuilder().client_order_id(client_order_id).new_client_order_id(
353-
new_client_order_id).quantity(quantiy).price(price).strict_validate(strict_validate).build()
355+
new_client_order_id).quantity(quantiy).price(price).stop_price(stop_price).strict_validate(strict_validate).build()
354356
intercept_response_callback: InterceptResponseCallback = None
355357
if callback:
356358
def intercept_result(err, response):

0 commit comments

Comments
 (0)