Balance-Aware Spot Buy
A 3-step recipe with Kraken. We can help you get access.
Recipe · 3 steps
Balance-Aware Spot Buy
with Kraken
Place a spot buy only when the account holds enough of the quote asset.
- Read all asset balances. Private Spot endpoints are signed and accept application/x-www-form-urlencoded bodies.
- Read the live ticker for the pair to price the buy against the current ask.
- Submit the buy order via AddOrder once funding has been confirmed.
What you'll need to have ready
- nonce: Ever-increasing nonce for the signed request.
- otp: One-time password if two-factor is enabled on the API key.
- pair: The asset pair to buy (e.g. XBTUSD).
- fundingAsset: The quote/funding asset whose balance must cover the buy (e.g. ZUSD).
- volume: Order volume in base-asset terms.
- price: Limit price for the buy; omit for a market order.
- ordertype: Order type (market or limit). Defaults to market when no price is supplied.
For your developer
Arazzo workflow kraken:balance-aware-buy, 3 operations: getAccountBalance → getTickerInformation → addOrder. Specs on APIs.io.