You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently exploring the Hyperliquid Python SDK but struggled to create a grouped order consisting of:
A buy or sell order,
A take profit order, and
A stop market order.
The available API documentation lacks sufficient details to help implement this functionality effectively. Could you kindly provide an example script in the examples directory to demonstrate how to achieve this?
Specifically, it would be immensely helpful if the example could showcase the necessary steps to group these orders together and manage their relationships as expected within the Hyperliquid system.
Thank you in advance for your support!
Best regards,
PowerGrb
The text was updated successfully, but these errors were encountered:
This is the best I could achieve in terms of scripting without successfully grouping and linking the orders. The buy order and the take profit order are sent correctly, but they are not grouped or linked together.
`import argparse
import json
import example_utils
from hyperliquid.utils import constants
# Setup the connection
address, info, exchange = example_utils.setup(base_url=constants.TESTNET_API_URL, skip_ws=True)
# Prepare the orders
orders = [
{
"coin": "ETH", # Coin symbol
"is_buy": True, # Buy order
"sz": 0.01, # Size
"limit_px": 2500, # Price
"order_type": {"limit": {"tif": "Gtc"}}, # Limit order with time in force
"reduce_only": False, # Explicitly set reduce_only to False
"grouping": "normalTpsl" # Grouping for the orders
},
{
"coin": "ETH", # Coin symbol
"is_buy": args.is_buy, # Take profit order, depends on is_buy flag
"sz": 0.01, # Size
"limit_px": 4500, # Take profit price
"order_type": {
"trigger": {"triggerPx": 4000, "isMarket": True, "tpsl": "tp"}
},
"reduce_only": True, # Reduce-only order
"grouping": "normalTpsl" # Grouping for the orders
}
]
# Send both orders in a single request
order_result = exchange.bulk_orders(orders)
print(order_result)
Hello,
I am currently exploring the Hyperliquid Python SDK but struggled to create a grouped order consisting of:
A buy or sell order,
A take profit order, and
A stop market order.
The available API documentation lacks sufficient details to help implement this functionality effectively. Could you kindly provide an example script in the examples directory to demonstrate how to achieve this?
Specifically, it would be immensely helpful if the example could showcase the necessary steps to group these orders together and manage their relationships as expected within the Hyperliquid system.
Thank you in advance for your support!
Best regards,
PowerGrb
The text was updated successfully, but these errors were encountered: