Balance
The Asset represents a security that you can trade or hold in your wallet. For example, you can combine two trading assets to create a trading instrument.
useBinanceBalanceChanges
The code provided defines a function called useBinanceBalanceChanges
, which takes an asset
parameter of type AssetSelector
. It utilizes the useBinanceBalancesChanges
function and applies a series of operations on its output.
The useBinanceBalancesChanges
function likely retrieves balance changes for Binance assets. The output is an object where each asset ID maps to its corresponding balance change.
The code checks if the asset
provided exists in the balance changes object. If it doesn't, it throws a MissingAssetError
indicating the asset is missing. If the asset exists, it retrieves the balance change for that asset.
The function then applies the distinctUntilTimestampChanged
operator to ensure that only distinct balance changes are emitted based on their timestamp.
Overall, the useBinanceBalanceChanges
function is designed to provide a stream of balance changes for a specific Binance asset, ensuring that only distinct changes are emitted.
useBinanceBalances()
Retrieves the Binance account balance snapshot for the current user by combining asset information with user account requests.
useBinanceBalancesChanges
Streams the Binance account balance changes for the current user in real-time by merging snapshot data with balance socket data.
Last updated