cURL
curl --request GET \ --url https://api.example.com/api/v1/trading/orders/history \ --header 'Content-Type: application/json' \ --data ' { "limit": 123, "offset": 123 } '
{ "orders": [ {} ], "total": 123, "limit": 123, "offset": 123 }
Get order history (filled and cancelled orders)
result = client.get_order_history(limit=50, offset=0)
from polyhush import PolyhushClient client = PolyhushClient(api_key="your-api-key") result = client.get_order_history(limit=20) print(f"Total orders: {result['total']}") print(f"Showing: {len(result['orders'])}") print() for order in result['orders']: status_icon = "✅" if order['status'] == "FILLED" else "❌" print(f"{status_icon} {order['side']} {order['shares']} @ ${order['price']:.2f}") print(f" Status: {order['status']}") print(f" Filled: {order['filled_shares']}/{order['shares']}") print(f" Date: {order['created_at']}") print()
{ "orders": [ { "order_id": "ord_xyz789", "token_id": "12345678901234567890", "side": "BUY", "shares": 50, "price": 0.60, "order_type": "GTC", "status": "FILLED", "filled_shares": 50, "average_fill_price": 0.5950, "created_at": "2024-01-14T09:00:00Z", "updated_at": "2024-01-14T09:05:00Z" }, { "order_id": "ord_def456", "token_id": "09876543210987654321", "side": "SELL", "shares": 100, "price": 0.80, "order_type": "GTC", "status": "CANCELLED", "filled_shares": 0, "created_at": "2024-01-13T14:00:00Z", "updated_at": "2024-01-13T18:00:00Z" } ], "total": 150, "limit": 50, "offset": 0 }