Swap API

1. Swap Info

Swap info route is vital for calculating best possible route for a trade at a particular time. It does all the work under the hood, this includes choosing best exchanges, building complex routes, weightening the fees, etc.

Query ParamDescriptionExample

assetIn (Required)

Input asset, mandatory

0xe4ca1f75eca6214393fce1c1b316c237664eaa8e

amountIn (Optional*)

Expected input amount in human-readable format

223.1

assetOut (Required)

Output asset, mandatory

0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3

amountOut (Optional*)

Expected output amount in human-readable format

120.1

Request example

curl -X 'GET' \
  'https://trade.orion.xyz/bsc-mainnet/backend/api/v1/swap?assetIn=0xe4ca1f75eca6214393fce1c1b316c237664eaa8e&amountIn=100&assetOut=0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3' \
  -H 'accept: */*'

Response Example

{
	"id": "5c114a4c-d2d2-4c45-bad6-7f67797f0b0f",
	"assetIn": "ORN",
	"amountIn": 100.0,
	"assetOut": "DAI",
	"amountOut": 85.00168645164585,
	"price": 0.85001686,
	"marketAmountOut": 85.25726630187442,
	"marketAmountIn": null,
	"marketPrice": 0.85257266,
	"minAmountIn": 1.0E-8,
	"minAmountOut": 1.0E-8,
	"availableAmountIn": 100.0,
	"availableAmountOut": null,
	"exchanges": [
		"INTERNAL_POOL_V2",
		"PANCAKESWAP_V3_0_05"
	],
	"path": [
		"ORN",
		"USDT",
		"DAI"
	],
	"exchangeContractPath": [
		{
			"pool": "0x684fd3c5cdfe279c82adc33029b095292d31ca35",
			"assetIn": "ORN",
			"assetOut": "USDT",
			"factory": "OrionV2"
		},
		{
			"pool": "0x8bc495dbeac561d5a7700e9403518d74123bd65a",
			"assetIn": "USDT",
			"assetOut": "DAI",
			"factory": "UniswapV3"
		}
	],
	"isThroughPoolOptimal": true,
	"orderInfo": {
		"assetPair": "ORN-DAI",
		"side": "SELL",
		"amount": 100.0,
		"safePrice": 0.85001,
		"pessimisticPriceBD": 0.85001
	},
	"executionInfo": "INTERNAL_POOL_V2/PANCAKESWAP_V3_0_05: ORN -> USDT -> DAI (length = 2): 100.0 ORN -> 85.00168645164585 DAI, market amount out = 85.25726630187442 DAI, price = 0.85001686 DAI/ORN (order SELL 100.0 @ 0.85001 (safe price 0.85001) on ORN-DAI), available amount in = 100.0 ORN, steps: {[1] ORN -> USDT (SELL on ORN-USDT), pair reserves: {176027.00108227 - 150735.034771068714793652, address = 0x684fd3c5cdfe279c82adc33029b095292d31ca35}, [2] USDT -> DAI (BUY on DAI-USDT), total asks amount = 29906.653120113344 DAI (29930.591308933337335089 USDT), total bids amount = 86562.51041073333 DAI (86446.280241143833327867 USDT), pair reserves: AssetPairReservesV3Uniswap{currentInfo=BriefCurrentInfoUniswap{sqrtPriceX96=1.000155588522977334, tick=3, liquidity=86865797.002148762765710859}, address=0x8bc495dbeac561d5a7700e9403518d74123bd65a, fee=0.0005, areAssetsInCanonicalOrder=true, asset0Address=0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3, asset1Address=0x55d398326f99059ff775485246999027b3197955, asset0Decimals=18, asset1Decimals=18, tickSpacing=10, amounts={[-1620]: 0.0, [-10]: 145992152.085121961019077581, [0]: -59126355.082973198253366722, [10]: -86865797.002148762765710859, [1390]: 0.0}}}",
	"alternatives": [],
	"addressToSymbols": {
		"0xe4ca1f75eca6214393fce1c1b316c237664eaa8e": "ORN",
		"0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3": "DAI"
	}
}

Last updated