Get Price
Retrieves the current average price for a trading pair on Binance.
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 identifier from the Connect node (optional if using direct credentials).
- Currency - The trading pair symbol (e.g.,
BTCUSDT,ETHUSDT,BNBUSDT).
Options
- Api Key - (Optional) Binance API key credential. Use if not providing Client Id.
- Secret Key - (Optional) Binance API secret key credential. Use if not providing Client Id.
Output
- Price - The current average price as a string (e.g.,
"50000.50").
How It Works
The Get Price node queries Binance for the current average price of a trading pair.
When executed, the node:
- Retrieves the Binance client (from Client Id or creates one from credentials)
- Validates the Currency (trading pair) input
- Queries Binance's average price endpoint
- Returns the average price as a string
Requirements
- Either a Client Id from Connect node OR API credentials in options
- Valid trading pair symbol that exists on Binance
- Appropriate API permissions (reading enabled)
Error Handling
The node will return specific errors in the following cases:
- ErrInternal - Failed to retrieve input values
- ErrInvalidArg - Empty or invalid Currency Pair
- ErrNewAveragePriceService - Failed to retrieve price from Binance (e.g., invalid symbol)
- ErrSetPrice - Failed to set the output price
Usage Notes
- Returns the average price, not the last trade price
- The price is returned as a string - parse to number for calculations
- Average price is calculated over the last 5 minutes
- Price updates in real-time based on market trades
- Trading pair must be in format: BASEQUOTE (e.g., BTCUSDT)
Example: Get Bitcoin Price
Scenario: Get the current BTC price in USDT
Inputs:
- Client Id: (from Connect node)
- Currency:
BTCUSDT
Output:
Price: "50245.75"
Example: Price-Based Trading Decision
[Connect]
|
v
[Get Price: BTCUSDT]
|
v
[Convert: price = parseFloat(result)]
|
v
[If: price < 45000]
|
+---> [Buy Order: at current market]
|
+---> [Log: "Price too high, waiting"]
v
[Disconnect]
Example: Price Alert System
[Timer: Every 5 minutes]
|
v
[Connect]
|
v
[Get Price: BTCUSDT]
|
v
[Convert: price = parseFloat(result)]
|
v
[If: price >= target_price]
|
v
[Send Alert: "BTC reached $" + price]
|
v
[Disconnect]
Example: Multi-Asset Price Monitoring
[Connect]
|
v
[For Each: symbol in ["BTCUSDT", "ETHUSDT", "BNBUSDT"]]
|
v
[Get Price: symbol]
|
v
[Store: prices[symbol] = result]
|
v
[Log: symbol + " price: $" + result]
|
v
[Disconnect]
Example: Calculate Order Amount
[Get Price: BTCUSDT]
|
v
[Input: amount_to_spend = 1000 USDT]
|
v
[Calculate: btc_amount = amount_to_spend / parseFloat(price)]
|
v
[Buy Order]
| Currency Pair: BTCUSDT
| Quantity: btc_amount
v
[Log: "Bought " + btc_amount + " BTC at $" + price]
Price Conversion
// Convert string to number
const priceNumber = parseFloat(priceString);
// Format for display
const formattedPrice = "$" + parseFloat(priceString).toFixed(2);
// Calculate order value
const orderValue = quantity * parseFloat(priceString);
Use Cases
Trading Decisions:
- Check price before placing orders
- Implement price-based entry/exit strategies
- Calculate order quantities based on budget
Price Monitoring:
- Track price movements over time
- Set up price alerts
- Monitor multiple assets
Arbitrage:
- Compare prices across different pairs
- Calculate spread opportunities
- Monitor price relationships
Portfolio Valuation:
- Calculate current portfolio value
- Track profit/loss on positions
- Convert between assets
Trading Tips
- Parse to Number: Always convert the string price to a number for calculations
- Real-time Data: Prices update continuously; cache briefly if making multiple quick calculations
- Average Price: This is a 5-minute average, not the last trade price
- Order Pricing: Use this price as a reference when setting limit order prices
- Comparison: Compare with previous prices to detect trends
Best Practices
- Parse the price string to a number before mathematical operations
- Cache price data briefly to reduce API calls when checking multiple times
- Use Get Price before placing limit orders to set realistic prices
- Implement price change alerts for monitoring
- Combine with Get Price Change Info for comprehensive market data
- Handle API errors gracefully (network issues, invalid symbols)
- Consider using Get Price History for longer-term analysis
Average Price vs Last Price
Average Price (This Node):
- Calculated over last 5 minutes
- Smooths out volatility
- Better for general reference
- Less affected by single large trades
Last Trade Price (Use List Recent Trades):
- Most recent executed trade
- Real-time snapshot
- May include outliers
- Shows actual execution prices
Common Trading Pairs
Against USDT:
BTCUSDT- BitcoinETHUSDT- EthereumBNBUSDT- Binance CoinADAUSDT- CardanoSOLUSDT- Solana
Against BTC:
ETHBTC- EthereumBNBBTC- Binance CoinADABTC- Cardano
Against BUSD:
BTCBUSD- BitcoinETHBUSD- Ethereum
Price Precision
Different trading pairs have different price precisions:
- BTCUSDT: Usually 2 decimal places ($50000.50)
- ETHUSDT: Usually 2 decimal places ($3000.75)
- Smaller coins: May have more decimals ($0.00012345)
Combining with Other Nodes
Get Price
+---> Calculate position value
+---> Determine order quantity
+---> Set limit order price (price * 0.99 for buy)
+---> Compare with historical prices
+---> Trigger alerts
Performance Considerations
- Price queries are lightweight and fast
- Can be called frequently without significant overhead
- Consider caching for very high-frequency applications
- Combine multiple price checks into batches when possible