CurrencyBuy
Buys currency units using Shamwari coin (FXT). The transaction attempts to match existing sell offers at the best available price.
Request
POST /nxt?requestType=currencyBuy
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
secretPhrase | string | Buyer's secret passphrase | Yes |
currency | long | Currency ID to buy | Yes |
baseCurrency | long | Base currency ID (coin) used for payment | Yes |
rateQNTPerUnit | long | Exchange rate (QNT per unit) | Yes |
unitsQNT | long | Number of units to buy | Yes |
feeRateQNTPerFXT | long | Transaction fee rate | Optional |
deadline | int | Transaction deadline in minutes | Optional |
How Currency Buy Works
- The transaction attempts to match existing sell offers on the exchange
- When a match is found, the minimum units between the sell offer and the buy order are exchanged at the rate matching the lowest sell offer
- A single transaction can match multiple sell offers or none
- Currency buy orders are NOT saved — they execute immediately (fully or partially) or not at all
- For each match, an exchange record is created (retrievable via GetExchanges)
Response
{
"transaction": "1234567890123456789",
"fullHash": "abc123...",
"errorCode": 0,
"errorDescription": ""
}
Error Handling
| Error | Condition |
|---|---|
NO_COST_ORDER | Calculated cost is zero |
NOT_ENOUGH_FUNDS | Insufficient coin balance |
UNKNOWN_CURRENCY | Currency does not exist |
Example
curl -X POST http://localhost:22024/nxt \
-d "requestType=currencyBuy" \
-d "secretPhrase=your_phrase" \
-d "currency=987654321" \
-d "baseCurrency=1" \
-d "rateQNTPerUnit=500" \
-d "unitsQNT=1000000000"