Skip to main content
POST
/
api
/
v1
/
trading
/
orders
Sell
curl --request POST \
  --url https://api.example.com/api/v1/trading/orders \
  --header 'Content-Type: application/json' \
  --data '
{
  "token_id": "<string>",
  "shares": 123,
  "price": 123,
  "order_type": "<string>"
}
'
{
  "order_id": "<string>",
  "status": "<string>",
  "message": "<string>",
  "warning": "<string>",
  "latency_ms": 123
}

Usage

result = client.sell(
    token_id="your-token-id",
    shares=10,
    price=0.65,
    order_type="GTC"  # Optional, defaults to GTC
)
For market orders that execute immediately, use market_sell() instead.

Parameters

token_id
string
required
The outcome token ID to sell.
shares
number
required
Number of shares to sell.
price
number
required
Limit price per share (0.01 - 0.99).
order_type
string
default:"GTC"
Order type:
  • GTC - Good Till Cancelled (limit order, sits on book)
  • FOK - Fill Or Kill (must fully fill immediately or cancel)
  • FAK - Fill And Kill (fills immediately, cancels unfilled)

Response

order_id
string
The created order ID.
status
string
Order status after placement.
message
string
Status message.
warning
string
Warning message, if any.
latency_ms
number
Order execution latency in milliseconds.

Example

from polyhush import PolyhushClient, PolyhushAPIError

client = PolyhushClient(api_key="your-api-key")

# First check your position
positions = 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")

Response

{
  "order_id": "ord_def456",
  "status": "PLACED",
  "message": "Order placed successfully",
  "latency_ms": 38
}
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).