What you’ll need
- Your secret key.
- A currency pair in mind.
Listings live on the exchange service, rates on the main service:
https://api.hyperrails.io/exchange/api/v1— marketplace listingshttps://api.hyperrails.io/api/v1— rates
The shape of the flow
1
List who is offering
See every live listing, its pair, its rate, and how much it can fill.
2
Check the published rate
The reference rate for the pair.
3
Reconcile the two
They will differ. Work out which one you actually get.
4
Price a quote against it
Turn a listing into a real trade.
Step 1: List who is offering
The whole marketplace was two listings. There is no guarantee any given
pair has a provider at all — if your pair is absent here, no rate will save
you.
Step 2: Check the published rate
timestamp can be months old — the GHS/NGN rate above was set in April and
read in September. These are administered reference rates, not a live market
feed. Do not treat the rate as fresh, and do not poll it expecting movement.Step 3: Reconcile the two
This is the step that surprises people. The published rate and the rate you actually trade at are different numbers, and the published rate is not even symmetric:
Three numbers for one pair. What each is for:
- The listing
rateis what you get. It is the provider’s own price. A real quote for 5 GHS → NGN allocated against theNGN/GHSlisting at exactly115.60, and settled 578.00 NGN. - The published rate is a reference. Use it to sanity-check and to display an indicative price before you quote.
- Direction changes the published rate, because each direction is
administered separately.
inverseRateis the true inverse of the rate you asked for —1 / 128.77 = 0.0077657840. It is not the rate for the reverse pair. Never invert a rate yourself to price the other direction; ask for it.
allocationResult.weightedAverageRate. When liquidity spans several listings
you get a blend, so read it from the quote rather than computing it.
Step 4: Price a quote against it
You now have a pair with a real provider and a size that fits insideavailableBalance. Create the quote:
payment block is needed to price a quote — you can get a real,
allocated price before you have any payment details from the customer.
poolId and clientId match the listing from Step 1 exactly — that is how you
confirm you got the provider you priced against.
allocations is an array because a large trade can be split across several
providers at different rates. weightedAverageRate is the blend. A
single-provider fill, as above, has one entry and the rate matches the listing.When things go wrong
What to do next
- Take a Quote in One Call — quote and settle in one flow
- Let a Buyer Pay for a Trade — the full intent flow
- Read Your Balances — get the
accountIda quote needs