Skip to main content

Sell Order

Places a limit sell order on Gate.io exchange to sell cryptocurrency at a specified price. The node automatically checks balance and validates the order before submission.

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.
  • Currency Pair - The trading pair for the order (e.g., BTC_USDT, ETH_USDT). Must use underscore separator.
  • Order Amount - The amount of base currency to sell (e.g., 0.001 for BTC in BTC_USDT pair).
  • Order Price - The price per unit in quote currency. Leave empty to use current market price (last price).

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 - An object containing order details:
    • id - The unique order identifier assigned by Gate.io
    • fee - The trading fee charged for the order
    • create_time - Unix timestamp when the order was created

How It Works

The Sell Order node executes the following steps:

  1. Authenticates using either Client Id or direct credentials
  2. Validates and parses the Currency Pair (e.g., BTC_USDT splits into base=BTC, quote=USDT)
  3. Fetches current ticker data to get the last price
  4. Retrieves your account balance for the base currency (e.g., BTC)
  5. Uses the provided Order Price, or defaults to last market price if empty
  6. Verifies you have sufficient balance of the cryptocurrency to sell
  7. Creates a limit sell order on Gate.io spot market
  8. Returns the order details including order ID and fees

Requirements

  • Either a valid Client Id from Connect node OR API credentials
  • Sufficient balance in the base currency (e.g., BTC for BTC_USDT)
  • Valid trading pair that exists on Gate.io
  • Order amount must meet minimum trading requirements for the pair
  • Trading pair must be active and not suspended

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 (must be BASE_QUOTE)
  • ErrGetCurrencyPair - Trading pair doesn't exist or is invalid
  • ErrListTickers - Failed to fetch current price data
  • ErrListSpotAccounts - Failed to retrieve account balance or currency not found
  • ErrCheckBalance - Insufficient balance to complete the order
  • ErrCreateOrder - Failed to place the order (may be due to API limits, invalid parameters, etc.)

Usage Notes

  • This node places a limit order that will only execute at the specified price or better
  • The order is placed on the spot market (not margin or futures)
  • Time in force is set to gtc (Good Till Cancelled) - order stays active until filled or cancelled
  • Order amount must be specified in the base currency (first part of the pair)
  • The node automatically fetches and validates the current market price
  • Balance check verifies you have enough of the cryptocurrency to sell
  • Fees are deducted separately and returned in the result

Best Practices

  • Always verify sufficient balance before placing orders
  • Use Get Balance node to check available cryptocurrency beforehand
  • Start with small amounts when testing
  • Store the returned order ID to track or cancel the order later
  • Validate trading pairs using List Pairs before trading
  • Check current price using Get Price before deciding on order price
  • Implement error handling for insufficient balance and order failures
  • Consider using Get Fee to calculate net proceeds after fees
  • Monitor orders using the returned order ID and Get Order node

Trading Strategy Tips

  • Market Sell: Leave Order Price empty to sell at current market price
  • Limit Sell: Set Order Price above current price to wait for a rally
  • Take Profit: Place sell orders at target profit levels
  • Resistance Level: Place sell orders at technical resistance levels
  • Percentage Above Market: Calculate price as current_price * 1.05 for 5% above market

Example Usage Scenarios

Simple Market Sell

Inputs:
- Client Id: (from Connect node)
- Currency Pair: BTC_USDT
- Order Amount: 0.001
- Order Price: (empty - uses market price)

Result: Sells 0.001 BTC at current market price

Limit Sell at Specific Price

Inputs:
- Client Id: (from Connect node)
- Currency Pair: ETH_USDT
- Order Amount: 0.5
- Order Price: 2500

Result: Places limit order to sell 0.5 ETH at $2500 USDT each

Sell with Direct Credentials

Inputs:
- Client Id: (empty)
- Currency Pair: BTC_USDT
- Order Amount: 0.001
- Order Price: 55000

Options:
- Api Key: (your credential)
- Secret Key: (your credential)

Result: Sells without Connect node using direct authentication

Example Flow: Automated Sell Strategy

[Connect]
|
+-> [Get Price: BTC_USDT]
|
+-> [Calculate: price * 1.02] (2% above market)
|
+-> [Get Balance: BTC]
|
+-> [If: balance > minimum]
| |
| +-> True: [Sell Order]
| | |
| | +-> [Store Order ID]
| | +-> [Log Success]
| |
| +-> False: [Log: Insufficient Balance]
|
+-> [Disconnect]

Example Flow: Take Profit Automation

[Connect]
|
+-> [Loop Every 5 Minutes]
| |
| +-> [Get Price: BTC_USDT]
| |
| +-> [If: price > target_profit_price]
| |
| +-> True: [Sell Order at market price]
| | |
| | +-> [Send notification]
| | +-> [Break Loop]
| |
| +-> False: [Continue Loop]
|
+-> [Disconnect]

Example Flow: Portfolio Rebalancing

[Connect]
|
+-> [Get Balance: BTC]
+-> [Get Balance: USDT]
+-> [Get Price: BTC_USDT]
|
+-> [Calculate Portfolio Value]
+-> [Calculate Target Allocation]
|
+-> [If: BTC percentage > target]
| |
| +-> [Calculate amount to sell]
| +-> [Sell Order]
|
+-> [Disconnect]

Calculating Order Proceeds

To calculate proceeds from a sell order:

Gross Proceeds = Order Amount × Order Price
Net Proceeds = Gross Proceeds - Fee

Example:

  • Order Amount: 0.1 BTC
  • Order Price: 50000 USDT
  • Gross: 5000 USDT
  • Fee: 5 USDT (0.1% of 5000)
  • Net Proceeds: 4995 USDT

Common Errors and Solutions

Insufficient Balance

Error: ErrCheckBalance - Insufficient balance for this order
Solution:
- Check balance with Get Balance node
- Reduce order amount
- Ensure you're checking the correct base currency (e.g., BTC not USDT)

Invalid Currency Pair

Error: ErrInvalidArg - Currency Pair is invalid. It should be like 'BTC_USDT' format
Solution:
- Use underscore separator: BTC_USDT (not BTCUSDT or BTC-USDT)
- Verify pair exists using List Pairs node
- Check for typos in currency symbols

Order Creation Failed

Error: ErrCreateOrder
Possible causes:
- Order amount below minimum for the pair
- Price is too far from market price
- Trading pair is suspended
- API rate limit exceeded
- Invalid order parameters

Comparing Buy vs Sell Orders

AspectBuy OrderSell Order
Balance CheckQuote currency (e.g., USDT)Base currency (e.g., BTC)
DirectionPurchase cryptocurrencySell cryptocurrency
Price StrategyBelow market for limitAbove market for limit
ResultReceive base currencyReceive quote currency
  • Connect - Establishes the client session needed for this node
  • Get Balance - Check available cryptocurrency before selling
  • Get Price - Get current market price to decide on order price
  • Get Order - Monitor the placed order using the returned order ID
  • Cancel Order - Cancel the order if not yet filled
  • List My Orders - View all your active orders
  • Buy Order - Place buy orders (opposite operation)
  • Get Fee - Check trading fees before placing orders