How Trading Works – Part 2

Applied concepts for teams integrating stablecoin ↔ Bitcoin trading into real products.

1.

Understanding Price Formation

Bitnob’s rate field in a quote or trade response isn’t just a random number. It reflects:

Live pricing across exchanges and OTC desks

Routing logic optimized for speed, reliability, and capital efficiency

A protective margin buffer (optional based on your tier or configuration)

This is why quotes should be treated as the truth for pricing, not reconstructed or guessed.

If you're showing a price to a user, always fetch a live quote — and don’t cache it beyond the expiresAt.

2.

Market Rate vs. Locked Quotes

You can trade two ways:

TypeBehavior
Market rateYou call POST /trades/execute without a quoteId. You get the best current rate.
Locked quoteYou first fetch a quote, store quoteId, and call execute using it.
When to use locked quotes:

You’re showing a rate to a user in a UI

You need to comply with a regulated or fixed-price promise

You’re waiting on user confirmation before executing

Pro tip: lock the quote, show a “valid for 30 seconds” countdown, and auto-expire the CTA to avoid expired trades.

3.

Asset Precision and Units

Don’t confuse this. Bitnob expects:

AssetInput UnitExample
USDTCents10000 = $100.00
BitcoinSatoshis100000 = 0.001 BTC

Tips:

Always convert frontend floats to integers before sending to the API

Never let users input commas, decimals, or non-numeric characters into amount fields unless you're formatting and stripping them internally

4.

Rate = Output / Input

Bitnob returns a field like:

"rate": 2250

What does this mean?

It means: for every 1 unit of input, you get 2,250 units of output.

Example:

from = usdt, to = bitcoin

amount = 10000 (i.e., $100)

outputAmount = 225000 (i.e., 225,000 sats)

rate = 2250 (sats per cent)

This means: 1 cent = 2,250 sats Or: $100 = 225,000 sats

This helps with building analytics, charting rates over time, or explaining conversion math to your users.

5.

When to Show Fees

Bitnob charges no fees by default. But in the future or for enterprise customers, you may receive:

"fee": 80

This will always be in the same unit as the input (e.g., cents or sats).

Best practice:

You’re converting: $100

Fee: $0.80

You’ll receive: 224,200 sats

Effective rate: 2,242 sats per cent

Show this clearly when users are exposed to fees. Hide it if you absorb them.

6.

Execution Timing and Flow Guarantees

If quote is locked, execution is atomic + final

If quote is expired: API will fail cleanly — you never get an unintended trade

No partial fills, no unexpected rate drift

All trades result in immediate balance updates in the destination wallet

trade.completed webhooks confirm state — this should trigger your downstream logic

7.

What You Don’t Have to Worry About

Order books

Market slippage

Routing to Binance, Kraken, OTC desks

Gas fees for wrapping/unwrapping BTC

Reversibility, cancellations, or hold periods

Bitnob shields you from all of it.

You just:

Quote

Execute

Confirm

Settle

8.

Real-World Example: End User Sell Flow

User has 100,000 sats in their Bitnob wallet. They want to cash out into stablecoin.

You do:

1.

GET /trades/quote?from=bitcoin&to=usdt&amount=100000

2.

Display: “You’ll receive $45.12”

3.

Lock quote, wait for user approval

4.

POST /trades/execute with reference, quoteId

5.

On webhook trade.completed, show: “Success. $45.12 credited to your wallet.”

6.

Internal ledger updates balance

7.

Optionally trigger payout to bank/mobile money via stablecoin off-ramp

Did you find this page useful?