The client provides convenient constants for order types:
Copy
from polyhush import PolyhushClientclient = PolyhushClient(api_key="your-api-key")client.GTC # "GTC" - Good Till Cancelledclient.FOK # "FOK" - Fill Or Kill client.FAK # "FAK" - Fill And Kill
A FOK order must be filled completely and immediately, or it’s cancelled entirely. There’s no partial fill.
Copy
# Place a FOK order - must fill 100 shares or nothing at current market priceresult = client.buy( token_id="your-token-id", shares=100, order_type="FOK")# Note: FOK/FAK are market orders - 'price' parameter is ignored if provided
Market order behavior - Use buy() or sell() with order_type="FAK"
A FAK order fills as much as possible immediately at the best available prices, then cancels any unfilled remainder.
Minimum Order Size: Market orders (FAK) have minimum size requirements that vary by market. Very small orders may be rejected by the exchange.
Copy
# Market buy - spend $50 at best available priceresult = client.buy( token_id="your-token-id", usdc_amount=50, order_type="FAK")# Market sell - sell 100 shares at best available priceresult = client.sell( token_id="your-token-id", shares=100, order_type="FAK")
# Patient entry - wait for price to come to youresult = client.buy( token_id=token_id, shares=50, price=0.40, # Below current market order_type="GTC")print(f"Order {result['orderID']} placed on book")
# Need exactly 100 shares or nothing at current market priceresult = client.buy( token_id=token_id, shares=100, order_type="FOK")if result['status'] == 'matched': print("Got all 100 shares!")else: print("Couldn't fill - no position taken")