from polyhush import PolyhushClient, PolyhushAPIErrorclient = PolyhushClient(api_key="your-api-key")# First check your positionpositions = client.get_position_details()position = next((p for p in positions if p['token_id'] == "12345678901234567890"), None)if position and position['available_to_sell'] >= 50: try: result = client.sell( token_id="12345678901234567890", shares=50, price=0.70, order_type="GTC" ) print(f"Sell order placed: {result['order_id']}") print(f"Status: {result['status']}") except PolyhushAPIError as e: print(f"Order failed: {e.message}")else: print("Insufficient shares to sell")
You can only sell shares you own. The available_to_sell field in position details shows how many shares you can sell (total shares minus those reserved for other sell orders).