SELL
orders) involve specifying the inputAmount
and receiving a calculated outputAmount
, the Buy Order functionality allows users to define their desired outputAmount
of tokens, with the router calculating the required inputAmount
to achieve that target. This provides greater flexibility for users focused on acquiring a specific amount of an asset
BUY
, the GlueX Router fundamentally reverses its calculation logic:
inputAmount
(and thus inputToken
) necessary to acquire the outputAmount
specified by the user, taking into account current market rates, fees and slippageinputAmount
possibleSELL
order behavior, where inputAmount
is predefined, and the outputAmount
is the calculated variable
orderType
and outputAmount
parameters in your /v1/price
or /v1/quote
request payload:
orderType | Required Field | Description |
---|---|---|
BUY | outputAmount | Amount of output token to receive |
SELL | inputAmount | Amount of input token to swap |
orderType
is not specified, it defaults to SELL
. In this case,
inputAmount
parameter becomes mandatory and outputAmount
will be computed
by the APIoutputAmount