Get Order
Retrieves detailed information about a specific order on Gate.io using its order ID. Essential for monitoring order status, tracking fills, and managing individual orders.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Client Id - The unique client identifier from the Connect node. Can be left empty if using direct credentials.
- Order Id - The unique order identifier (obtained from Buy Order, Sell Order, or List My Orders nodes).
- Currency Pair - The trading pair of the order (e.g.,
BTC_USDT,ETH_USDT). Must match the original order's pair.
Options
- Api Key - Gate.io API key credential (optional if using Client Id from Connect node).
- Secret Key - Gate.io API secret key credential (optional if using Client Id from Connect node).
Output
- Result - A complete order object containing:
id- Order IDtext- Custom order identifier (if provided)create_time- When order was created (Unix timestamp)update_time- Last update time (Unix timestamp)create_time_ms- Creation time in millisecondsupdate_time_ms- Update time in millisecondsstatus- Order status (open, closed, cancelled)currency_pair- Trading pairtype- Order type (limit, market)account- Account type (spot, margin)side- buy or sellamount- Total order amountprice- Order pricetime_in_force- Time in force setting (gtc, ioc, poc)iceberg- Iceberg order amount (if applicable)left- Amount remaining to be filledfill_price- Average fill pricefilled_total- Total value filledfee- Fee paidfee_currency- Currency fee was paid inpoint_fee- Point fee (if applicable)gt_fee- GT token fee (if applicable)gt_discount- Whether GT discount was appliedrebated_fee- Rebated fee amountrebated_fee_currency- Rebate fee currency
How It Works
The Get Order node executes the following steps:
- Authenticates using either Client Id or direct credentials
- Validates that Currency Pair is not empty and in correct format
- Validates that Order ID is not empty
- Queries Gate.io API for the specific order
- Returns complete order details including current status and fills
Requirements
- Either a valid Client Id from Connect node OR API credentials
- Valid Order ID from a previously created order
- Correct Currency Pair matching the original order
- The order must have been created with your API credentials
Error Handling
The node will return specific errors in the following cases:
- ErrInternal - Failed to retrieve input parameters
- ErrInvalidArg - Currency Pair is empty or invalid format, or Order ID is empty
- ErrGetOrder - Failed to retrieve order (order may not exist, wrong pair, or wrong credentials)
Usage Notes
- You can only retrieve orders created with your API credentials
- The Currency Pair must exactly match the original order
- Order status indicates if order is open, filled, or cancelled
leftfield shows how much of the order remains unfilled- Filled orders show average execution price in
fill_price - Timestamps are in Unix format (seconds since epoch)
- Fees are charged in the currency you receive
Best Practices
- Store order IDs when creating orders for later tracking
- Poll order status to monitor execution
- Check
leftfield to determine if order is partially filled - Use
statusto determine next actions (cancel, wait, etc.) - Implement timeout logic for orders that don't fill
- Monitor
fill_pricevs originalpricefor slippage analysis - Keep track of
feefor accurate P&L calculations
Example Usage Scenarios
Check Order Status
Inputs:
- Client Id: (from Connect node)
- Order Id: 123456789
- Currency Pair: BTC_USDT
Output:
{
id: "123456789",
status: "open",
side: "buy",
amount: "0.001",
price: "50000",
left: "0.001",
filled_total: "0",
...
}
Check Filled Order
Inputs:
- Client Id: (from Connect node)
- Order Id: 987654321
- Currency Pair: ETH_USDT
Output:
{
id: "987654321",
status: "closed",
side: "sell",
amount: "1.0",
price: "2000",
left: "0",
fill_price: "2001.5",
filled_total: "2001.5",
fee: "4.003",
...
}
Example Flow: Monitor Order Until Filled
[Connect]
|
+-> [Buy Order: BTC_USDT]
| |
| +-> [Store: order_id = result.id]
|
+-> [Loop: Maximum 60 iterations]
| |
| +-> [Get Order: order_id, BTC_USDT]
| |
| +-> [Check: result.status]
| |
| +-> If "closed": [Break loop - Order filled]
| +-> If "cancelled": [Break loop - Order cancelled]
| +-> If "open": [Wait 10 seconds, Continue loop]
|
+-> [If: still open after loop]
| |
| +-> [Cancel Order]
| +-> [Log: Order timeout]
|
+-> [Disconnect]
Example Flow: Partial Fill Detection
[Connect]
|
+-> [Sell Order]
| |
| +-> [Store: order_id, original_amount]
|
+-> [Wait: 5 minutes]
|
+-> [Get Order: order_id]
|
+-> [Calculate]
|
+-> filled_amount = original_amount - result.left
+-> fill_percent = (filled_amount / original_amount) * 100
|
[If: fill_percent > 0 AND fill_percent < 100]
|
+-> [Log: Order partially filled: fill_percent%]
+-> [Decide: Cancel remaining or wait longer]
|
[Disconnect]
Example Flow: Order Verification After Placement
[Connect]
|
+-> [Buy Order: BTC at 50000]
| |
| +-> [Store: order_id]
|
+-> [Wait: 2 seconds]
|
+-> [Get Order: order_id]
|
+-> [Verify]
|
+-> Check: result.status = "open"
+-> Check: result.price = "50000"
+-> Check: result.side = "buy"
|
+-> If all correct: [Log: Order placed successfully]
+-> If mismatch: [Alert: Order verification failed]
|
[Disconnect]
Example Flow: Fill Price Analysis
[Connect]
|
+-> [Get Order: filled_order_id]
|
+-> [Calculate]
|
+-> intended_price = order.price
+-> actual_price = order.fill_price
+-> slippage = actual_price - intended_price
+-> slippage_percent = (slippage / intended_price) * 100
|
[Log Slippage Analysis]
|
+-> Intended: intended_price
+-> Actual: actual_price
+-> Slippage: slippage_percent%
|
[If: slippage_percent > threshold]
|
+-> [Alert: High slippage detected]
|
[Disconnect]
Understanding Order Status
Status Values
open
- Order is active and awaiting execution
- May be partially filled (check
leftfield) - Can be cancelled
closed
- Order is completely filled
- Cannot be cancelled
- Check
fill_pricefor execution price
cancelled
- Order was cancelled
- May have partial fills (check
filled_total) - Cannot be reactivated
Checking Fill Status
const totalAmount = parseFloat(order.amount);
const remainingAmount = parseFloat(order.left);
const filledAmount = totalAmount - remainingAmount;
const fillPercent = (filledAmount / totalAmount) * 100;
if (fillPercent === 0) {
console.log("Order not filled yet");
} else if (fillPercent < 100) {
console.log(`Order ${fillPercent}% filled`);
} else {
console.log("Order completely filled");
}
Calculating Actual Costs/Proceeds
For Buy Orders (Closed)
const totalCost = parseFloat(order.filled_total);
const fee = parseFloat(order.fee);
const amountReceived = parseFloat(order.amount) - parseFloat(order.left);
const averagePrice = parseFloat(order.fill_price);
console.log(`Bought ${amountReceived} at avg price ${averagePrice}`);
console.log(`Total cost: ${totalCost} + ${fee} fee`);
For Sell Orders (Closed)
const grossProceeds = parseFloat(order.filled_total);
const fee = parseFloat(order.fee);
const netProceeds = grossProceeds - fee;
const amountSold = parseFloat(order.amount) - parseFloat(order.left);
const averagePrice = parseFloat(order.fill_price);
console.log(`Sold ${amountSold} at avg price ${averagePrice}`);
console.log(`Net proceeds: ${netProceeds} (after ${fee} fee)`);
Example: Order Timeout Strategy
[Create Order]
|
+-> [Store: order_id, start_time]
|
[Loop Every 30 Seconds]
|
+-> [Get Order: order_id]
+-> [Current time - start_time > timeout]
|
+-> [If: timeout AND status = "open"]
| |
| +-> [Check: order.left]
| |
| +-> [If: partially filled]
| | |
| | +-> [Decide: Keep or cancel based on strategy]
| |
| +-> [Else: not filled at all]
| |
| +-> [Cancel Order]
| +-> [Adjust price and retry]
|
+-> [If: status = "closed"]
|
+-> [Success - process fill]
Common Patterns
Wait for Fill with Timeout
maxTime = 10 minutes
checkInterval = 10 seconds
while (currentTime < maxTime) {
order = GetOrder(orderId)
if (order.status === "closed") return success
wait(checkInterval)
}
// Timeout: cancel order
Progressive Fill Monitoring
previousFilled = 0
while (order.status === "open") {
order = GetOrder(orderId)
currentFilled = amount - order.left
if (currentFilled > previousFilled) {
log("Order filling: " + (currentFilled/amount * 100) + "%")
previousFilled = currentFilled
}
wait(5 seconds)
}
Related Nodes
- Connect - Establishes the client session needed for this node
- Buy Order - Creates orders that can be tracked with this node
- Sell Order - Creates orders that can be tracked with this node
- Cancel Order - Cancel orders after checking their status
- List My Orders - Get order IDs for all open orders