Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tripolskypetr/wallet-manager/llms.txt
Use this file to discover all available pages before exploring further.
fetchPrice returns the current 5-minute weighted average price for a Binance spot symbol, rounded to the symbol’s exchange-defined tickSize. It is used internally by all commit* methods in WalletPublicService to obtain the reference price before placing or pricing orders. When called directly, it gives a fast, tick-aligned snapshot of the current market price.
Signature
Parameters
Binance trading pair symbol, e.g.
"SOLUSDT". Must be a valid spot symbol recognized by Binance.Return value
Promise<number> — the current 5-minute average price, formatted (truncated) to the symbol’s PRICE_FILTER tickSize and returned as a JavaScript number.
Data source and formatting
The price is obtained frombinance.avgPrice(symbol), which returns Binance’s 5-minute weighted average price. The raw float is then passed through formatPrice():
roundTicks truncates the value to the number of decimal places implied by tickSize (e.g. tickSize = "0.01" → 2 decimal places), ensuring the price is always valid for order placement on that symbol.
Caching notes
FETCH_PRICE_FN itself does not cache — each call hits binance.avgPrice() directly. However, WalletPrivateService uses a shared getTickerInfo helper (30-second TTL via ttl from functools-kit) for bulk price lookups. The fetchOrders and fetchPnl caches are separate (10-minute TTL) and are not affected by price calls.
Because WalletPublicService fetches the price before enqueuing a commit operation, the price snapshot is taken at the moment the caller invokes the method, not at the moment the queued runner begins execution.
Internal usage
Everycommit* method in WalletPublicService calls walletPrivateService.fetchPrice(symbol) as its first step:
commitBuy— uses the returned price to compute the limit order price (× 1.001) and the USDT-to-coin quantity conversion.commitSell— uses it to compute× 0.999andusdToCoins.commitTrade— validatestakeProfitPrice > fetchPrice > stopLossPricebefore enqueuing.commitCancel— uses it to price the exit limit sell at× 0.999.