Skip to main content

Get Price

Retrieves current price and ticker information for a specific cryptocurrency trading pair on Gate.io. Essential for price monitoring, trading decisions, and market analysis.

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 price for (e.g., BTC_USDT, ETH_USDT). Must use underscore separator.

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

  • Price - A ticker object containing comprehensive market data:
    • currency_pair - The trading pair identifier
    • last - Last traded price
    • lowest_ask - Lowest ask (sell) price in order book
    • highest_bid - Highest bid (buy) price in order book
    • change_percentage - 24-hour price change percentage
    • base_volume - 24-hour trading volume in base currency
    • quote_volume - 24-hour trading volume in quote currency
    • high_24h - Highest price in last 24 hours
    • low_24h - Lowest price in last 24 hours
    • And other ticker fields

How It Works

The Get Price 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 the currency pair details from Gate.io
  4. Retrieves the current ticker data for the trading pair
  5. Returns the complete ticker object with all market information

Requirements

  • Either a valid Client Id from Connect node OR API credentials
  • Valid trading pair that exists on Gate.io
  • Trading pair must use underscore format (e.g., BTC_USDT)

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 ticker data

Usage Notes

  • Returns real-time market data
  • The last field is the most recent traded price
  • Spread can be calculated as: lowest_ask - highest_bid
  • All prices are in the quote currency (e.g., USDT for BTC_USDT)
  • Volume data is for the last 24 hours
  • This is read-only and doesn't require trading permissions

Best Practices

  • Use the last price for market order price estimation
  • Check change_percentage to assess market volatility
  • Monitor base_volume to gauge market liquidity
  • Use spread (lowest_ask - highest_bid) to assess market depth
  • Cache price data when making multiple reads to reduce API calls
  • Implement rate limiting to avoid exceeding API limits
  • Use in loops for continuous price monitoring

Example Usage Scenarios

Get Current Bitcoin Price

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

Output:
{
currency_pair: "BTC_USDT",
last: "50000.5",
lowest_ask: "50001.2",
highest_bid: "49999.8",
change_percentage: "2.5",
base_volume: "1234.56",
...
}

Get Ethereum Price

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

Output: Complete ticker data for ETH/USDT

With Direct Credentials

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

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

Output: Ticker data without Connect node

Example Flow: Price Alert System

[Connect]
|
+-> [Loop Every 1 Minute]
| |
| +-> [Get Price: BTC_USDT]
| |
| +-> [Extract: last_price = price.last]
| |
| +-> [If: last_price > target_price]
| |
| +-> True: [Send Alert Notification]
| | |
| | +-> [Break Loop]
| |
| +-> False: [Continue Loop]
|
+-> [Disconnect]

Example Flow: Buy the Dip Strategy

[Connect]
|
+-> [Get Price: BTC_USDT]
| |
| +-> [Store: initial_price = price.last]
|
+-> [Loop Every 5 Minutes]
| |
| +-> [Get Price: BTC_USDT]
| |
| +-> [Calculate: price_drop = (initial_price - price.last) / initial_price * 100]
| |
| +-> [If: price_drop > 5%]
| |
| +-> True: [Buy Order at market price]
| | |
| | +-> [Break Loop]
| |
| +-> False: [Continue Loop]
|
+-> [Disconnect]

Example Flow: Market Analysis

[Connect]
|
+-> [Get Price: BTC_USDT]
|
+-> [Extract Data]
| |
| +-> Last Price: price.last
| +-> 24h High: price.high_24h
| +-> 24h Low: price.low_24h
| +-> Change %: price.change_percentage
| +-> Volume: price.base_volume
|
+-> [Calculate Metrics]
| |
| +-> Spread: price.lowest_ask - price.highest_bid
| +-> Spread %: (spread / price.last) * 100
| +-> Distance from high: (price.high_24h - price.last) / price.high_24h * 100
|
+-> [Store in Database]
+-> [Generate Report]
|
+-> [Disconnect]

Example Flow: Multi-Pair Price Monitoring

[Connect]
|
+-> [Set: pairs = ["BTC_USDT", "ETH_USDT", "GT_USDT"]]
|
+-> [For Each: pair in pairs]
| |
| +-> [Get Price: pair]
| +-> [Store: prices[pair] = {
| last: price.last,
| change: price.change_percentage,
| volume: price.base_volume
| }]
|
+-> [Find: pair with highest volume]
+-> [Find: pair with biggest gain]
|
+-> [Log Results]
|
+-> [Disconnect]

Understanding Ticker Fields

Price Fields

  • last - Most recent trade price (use this for "current price")
  • lowest_ask - Cheapest sell offer (you pay this to buy instantly)
  • highest_bid - Highest buy offer (you receive this to sell instantly)

Volume Fields

  • base_volume - Amount of base currency traded (e.g., BTC in BTC_USDT)
  • quote_volume - Amount of quote currency traded (e.g., USDT in BTC_USDT)

24h Statistics

  • high_24h - Highest price in last 24 hours
  • low_24h - Lowest price in last 24 hours
  • change_percentage - Percentage change from 24 hours ago

Calculating Important Metrics

Spread

const spread = price.lowest_ask - price.highest_bid;
const spreadPercent = (spread / price.last) * 100;

Market Position

const range24h = price.high_24h - price.low_24h;
const currentPosition = (price.last - price.low_24h) / range24h * 100;
// 0% = at low, 100% = at high, 50% = middle

Volume in USD

const volumeUSD = price.quote_volume; // Already in USDT/USD for USDT pairs

Using Price for Trading Decisions

Market Order Price

Use price.last for estimating market order execution price
Actual execution may vary slightly due to market movement

Limit Order Price

Buy: Use price.highest_bid or below (wait for lower price)
Sell: Use price.lowest_ask or above (wait for higher price)

Quick Buy/Sell

Quick Buy: Use price.lowest_ask (buy from sellers)
Quick Sell: Use price.highest_bid (sell to buyers)

Example: Conditional Buy Based on Price

[Connect]
|
+-> [Get Price: BTC_USDT]
|
+-> [Extract: current_price = parseFloat(price.last)]
|
+-> [If: current_price < 50000]
| |
| +-> [Get Balance: USDT]
| +-> [Buy Order at market price]
|
+-> [Else: Log: Price too high, waiting]
|
+-> [Disconnect]

Common Errors and Solutions

Invalid Currency Pair

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

Pair Not Found

Error: ErrGetCurrencyPair
Solutions:
- Trading pair doesn't exist on Gate.io
- Check spelling and format
- Use List Pairs to see available pairs
  • Connect - Establishes the client session needed for this node
  • Get Balance - Combine with price to calculate portfolio value
  • Buy Order - Use price data to determine order price
  • Sell Order - Use price data to determine order price
  • List Pairs - Find available trading pairs
  • Get Fee - Calculate total trading costs including price