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.
Overview
These four pure helper functions underpin every order placement and balance calculation in thecommit_* and fetch_* pipeline. They carry no Binance dependency and can be imported and used in isolation.
roundTicks
tickSize (for price) or stepSize (for quantity). Returns a formatted string ready to pass directly to binance.order().
Source:
Intl.NumberFormat to format tickSize to a locale-neutral decimal string, then counts the characters after the decimal point to determine the required precision. Applies that precision to the input price via Number.prototype.toFixed.
Binance rejects any order where the price or quantity does not match the
symbol’s declared
tickSize / stepSize precision exactly. roundTicks is
called internally by every commit_* function before posting an order — for
both the price (via PRICE_FILTER tickSize) and the quantity (via LOT_SIZE stepSize). Passing a raw float directly to binance.order() will typically
result in a -1111 Parameter 'quantity' has too much precision error.The price or quantity value to round. Strings are parsed to float before rounding.
The exchange filter precision value, e.g.
0.01 for 2 decimal places, 0.00001 for 5. Obtained from exchangeInfo PRICE_FILTER.tickSize or LOT_SIZE.stepSize.string — the value formatted to the correct decimal precision.
Example:
percentValue
(value × percent) / 100. A simple percentage calculation used to deduct trading fees from coin balances before placing sell orders.
Source:
In
COMMIT_CANCEL_FN and COMMIT_TRADE_FN, this function is called with the
Binance account’s makerCommission (e.g. 10 for 0.10%) to subtract the
maker fee from the coin balance before placing the exit sell — preventing
“insufficient balance” errors caused by the fee being deducted on execution.
The pattern is always: quantity − percentValue(quantity, makerCommission) − minQty.The base number to compute the percentage of.
The percentage to apply. Pass
0.1 for 0.1%, 10 for 10%, etc. Note that makerCommission from binance.account() is already expressed as basis points divided by 100 (e.g. 10 = 0.10%), so it is passed directly: makerCommission / 100 gives the decimal rate, but internally percentValue handles the /100 division itself.number — the computed percentage amount (not the reduced value — just the portion to subtract).
Example:
COMMIT_CANCEL_FN:
usdToCoins
quantity / price.
Source:
The raw result from
usdToCoins is always passed through roundTicks (via
formatQuantity) before being used in an order. The raw float has more
decimal places than Binance accepts for the symbol’s LOT_SIZE stepSize.The USDT amount to convert (the “cost” of the trade).
The current price of the coin in USDT. Typically
averagePrice from the caller.number — the coin quantity corresponding to spending quantity USDT at price.
Example:
COMMIT_BUY_FN:
getCoinName
"USDT" suffix from a trading pair symbol to extract the base coin name.
Source:
After
COMMIT_BUY_FN executes a purchase, COMMIT_TRADE_FN needs to measure
the quantity delta by looking up the coin in the balance map returned by
FETCH_BALANCE_FN. That map is keyed by coin name (e.g. "SOL", "BTC"),
not by symbol — so getCoinName is the bridge between the two naming
conventions used throughout the codebase.A Binance spot trading pair symbol with a USDT quote, e.g.
"SOLUSDT", "BTCUSDT", "ETHUSDT".string — the base coin name with "USDT" removed.
Example:
COMMIT_CANCEL_FN and COMMIT_TRADE_FN: