Skip to main content

Get Fee

Retrieves trading fee information for a specific currency pair on Gate.io. Essential for calculating total trading costs and optimizing trading strategies.

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 to get fee information for (e.g., BTC_USDT, ETH_USDT).

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 fee object containing:
    • user_id - Your user ID
    • taker_fee - Taker fee rate (when taking liquidity from order book)
    • maker_fee - Maker fee rate (when adding liquidity to order book)
    • gt_discount - Whether GT (GateToken) fee discount is enabled
    • gt_taker_fee - Taker fee rate with GT discount
    • gt_maker_fee - Maker fee rate with GT discount
    • loan_fee - Margin loan fee rate (if applicable)
    • point_type - Point/discount type

How It Works

The Get Fee node executes the following steps:

  1. Authenticates using either Client Id or direct credentials
  2. Validates that Currency Pair is not empty
  3. Queries Gate.io API for fee information for the specified pair
  4. Returns the complete fee structure including discounts

Requirements

  • Either a valid Client Id from Connect node OR API credentials
  • Valid trading pair that exists on Gate.io
  • Read permissions on your API key

Error Handling

The node will return specific errors in the following cases:

  • ErrInternal - Failed to retrieve input parameters
  • ErrInvalidArg - Currency Pair is empty
  • ErrGetFee - Failed to retrieve fee information from Gate.io

Usage Notes

  • Fee rates are returned as percentages (e.g., "0.2" means 0.2%)
  • Taker fees apply when you take liquidity (market orders or limit orders that execute immediately)
  • Maker fees apply when you add liquidity (limit orders that don't execute immediately)
  • GT discount requires holding GateToken and enabling the discount feature
  • Fee rates may vary based on your trading volume and VIP level
  • Fees are charged in the currency you receive (buy: charged in base, sell: charged in quote)

Best Practices

  • Calculate total trading costs before placing orders
  • Factor in fees when determining profit targets
  • Consider maker vs taker fees in your strategy
  • Use GT discount if available to reduce fees
  • Cache fee information as it doesn't change frequently for the same account
  • Check fees periodically as they may change with VIP level
  • Account for fees in backtesting and strategy simulation

Example Usage Scenarios

Get Fee for BTC Trading

Inputs:
- Client Id: (from Connect node)
- Currency Pair: BTC_USDT

Output:
{
user_id: 123456,
taker_fee: "0.2", // 0.2% taker fee
maker_fee: "0.2", // 0.2% maker fee
gt_discount: true,
gt_taker_fee: "0.15", // 0.15% with GT discount
gt_maker_fee: "0.15", // 0.15% with GT discount
...
}

With Direct Credentials

Inputs:
- Client Id: (empty)
- Currency Pair: ETH_USDT

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

Output: Fee structure for ETH/USDT

Example Flow: Calculate Total Trading Cost

[Connect]
|
+-> [Get Fee: BTC_USDT]
| |
| +-> [Store: fee_rate = result.taker_fee]
|
+-> [Get Price: BTC_USDT]
| |
| +-> [Store: price = price.last]
|
+-> [Set: order_amount = 0.1]
|
+-> [Calculate]
|
+-> order_value = order_amount * price
+-> fee = order_value * (fee_rate / 100)
+-> total_cost = order_value + fee
|
[Log: Total cost including fees: total_cost]
|
[Disconnect]

Example Flow: Fee-Optimized Order Placement

[Connect]
|
+-> [Get Fee: BTC_USDT]
|
+-> [Get Price: BTC_USDT]
|
+-> [Calculate]
|
+-> maker_fee = parseFloat(fee.maker_fee) / 100
+-> taker_fee = parseFloat(fee.taker_fee) / 100
+-> fee_difference = (taker_fee - maker_fee) * order_value
|
[If: fee_difference > threshold]
|
+-> [Use limit order with price below market]
| (Wait to be maker and save on fees)
|
[Else]
|
+-> [Use market order]
(Speed more important than fee savings)
|
[Disconnect]

Example Flow: Profit Calculation with Fees

[Connect]
|
+-> [Get Fee: BTC_USDT]
|
+-> [Set Trading Parameters]
|
+-> buy_price = 50000
+-> sell_price = 52000
+-> amount = 0.1
|
[Calculate]
|
+-> buy_cost = amount * buy_price
+-> buy_fee = buy_cost * (taker_fee / 100)
+-> total_buy_cost = buy_cost + buy_fee
|
+-> sell_proceeds = amount * sell_price
+-> sell_fee = sell_proceeds * (taker_fee / 100)
+-> net_sell_proceeds = sell_proceeds - sell_fee
|
+-> net_profit = net_sell_proceeds - total_buy_cost
+-> profit_percent = (net_profit / total_buy_cost) * 100
|
[Log: Net profit: net_profit (profit_percent%)]
|
[Disconnect]

Understanding Fee Types

Maker Fees

  • Applied when you add liquidity to the order book
  • Your order sits in the order book waiting to be filled
  • Limit orders that don't execute immediately
  • Generally lower than taker fees
  • Example: Placing buy order below current price

Taker Fees

  • Applied when you take liquidity from the order book
  • Your order executes against existing orders
  • Market orders always incur taker fees
  • Limit orders that execute immediately
  • Example: Market buy order at current ask price

Fee Calculation Examples

Buying with Taker Fee

Order: Buy 0.1 BTC at $50,000
Taker Fee: 0.2%

Cost = 0.1 * 50,000 = $5,000
Fee = 5,000 * 0.002 = $10
Total Cost = $5,010

Received: 0.1 BTC (fee charged in USDT)

Selling with Maker Fee

Order: Sell 0.1 BTC at $50,000 (limit order)
Maker Fee: 0.2%

Proceeds = 0.1 * 50,000 = $5,000
Fee = 5,000 * 0.002 = $10
Net Proceeds = $4,990

Received: $4,990 USDT (fee deducted from proceeds)

Using GT Discount

If you hold GateToken (GT) and enable fee discount:

[Get Fee]
|
[If: result.gt_discount = true]
|
+-> Use: gt_taker_fee and gt_maker_fee
+-> Savings: (taker_fee - gt_taker_fee) per trade
|
[Calculate Annual Savings]
|
+-> fee_savings_per_trade * trades_per_year
+-> Compare with: cost of holding GT

Example: Round-Trip Trading Cost

[Get Fee: BTC_USDT]
|
[Calculate Round-Trip Cost]
|
+-> buy_fee_percent = taker_fee
+-> sell_fee_percent = taker_fee
+-> round_trip_fee = buy_fee_percent + sell_fee_percent
|
+-> For 0.2% each way: 0.4% total
+-> Minimum profit needed: > 0.4% to break even
|
[Set: minimum_profit_target = round_trip_fee * 1.5]
(Target 1.5x fees to account for slippage)

Example: Fee Comparison Across Pairs

[Connect]
|
+-> [Set: pairs = ["BTC_USDT", "ETH_USDT", "GT_USDT"]]
|
+-> [For Each: pair in pairs]
| |
| +-> [Get Fee: pair]
| +-> [Store: fees[pair] = {
| taker: result.taker_fee,
| maker: result.maker_fee,
| gt_taker: result.gt_taker_fee
| }]
|
+-> [Compare and log fees across pairs]
|
+-> [Disconnect]

Common Calculations

Total Cost with Fees (Buy)

const orderValue = amount * price;
const feeRate = parseFloat(fee.taker_fee) / 100;
const feeAmount = orderValue * feeRate;
const totalCost = orderValue + feeAmount;

Net Proceeds with Fees (Sell)

const orderValue = amount * price;
const feeRate = parseFloat(fee.taker_fee) / 100;
const feeAmount = orderValue * feeRate;
const netProceeds = orderValue - feeAmount;

Break-Even Price

const buyFeeRate = parseFloat(fee.taker_fee) / 100;
const sellFeeRate = parseFloat(fee.taker_fee) / 100;
const totalFeeRate = buyFeeRate + sellFeeRate;

// Price must increase by at least this much to break even
const breakEvenIncrease = totalFeeRate / (1 - sellFeeRate);
const breakEvenPrice = buyPrice * (1 + breakEvenIncrease);
  • Connect - Establishes the client session needed for this node
  • Buy Order - Use fee info to calculate total order cost
  • Sell Order - Use fee info to calculate net proceeds
  • Get Price - Combine with fees for total cost calculation
  • List Pairs - Some pairs may have different fee structures