# Refresh Quotes

After you calculated a rebalancing it might be that you have to refresh quotes. For example if you have a user interface and user don't directly execute received rebalancings.&#x20;

Currently we consider rebalancings to be valid for 5 minutes however quotes should be refresed more often. A good starting point would be 20 or 30 seconds. (Make sure to not fire refresh calls to our API every second or you might get blocked.)

## GET /1.3/rebalancing/refresh-expired-quotes

> Refresh the quotes of a previously calculated rebalancing

```json
{"openapi":"3.0.0","info":{"title":"31Third Trading API","version":"1.3"},"tags":[{"name":"rebalancing (common)","description":"Execute common rebalancing actions"}],"paths":{"/1.3/rebalancing/refresh-expired-quotes":{"get":{"operationId":"RefreshExpiredQuotesController_refreshExpiredQuotes","summary":"Refresh the quotes of a previously calculated rebalancing","parameters":[{"name":"x-api-key","in":"header","description":"31Third API key (Request via dev@31third.com)","schema":{"type":"string"}},{"name":"chain-id","in":"header","description":"Chain ID as hex string. (e.g.: 0x1 for Ethereum mainnet)","schema":{"type":"string"}},{"name":"rebalancingId","required":true,"in":"query","description":"ID of a previously calculated rebalancing","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RebalancingResponseDto"}}}}},"tags":["rebalancing (common)"]}}},"components":{"schemas":{"RebalancingResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the calculated rebalancing."},"creationDate":{"format":"date-time","type":"string","description":"Rebalancing creation timestamp"},"baseValueInUsd":{"type":"number","description":"Total value of assets in the rebalancing base allocation. (in USD)"},"sellValueInUsd":{"type":"number","description":"The proportion of value that is taken out for trades, meaning sold. (in USD)"},"estimatedValueLossInUsd":{"type":"number","description":"Estimated loss of total portfolio value. (in USD; fees are already included in this value)"},"estimatedTargetValueInUsd":{"type":"number","description":"Estimated total value of the rebalancing target allocation. (in USD; fees are already included in this value)"},"estimatedReceiveValueInUsd":{"type":"number","description":"Estimated value of assets received after all trades. (in USD; fees are already included in this value)"},"minReceiveValueInUsd":{"type":"number","description":"Minimal total portfolio value after the rebalancing. (in USD; slippage and fees are included in this value)"},"estimatedImpact":{"type":"number","description":"Estimated impact. (0.01 = 1%; fees are already included in this value)"},"maxImpact":{"type":"number","description":"Maximal impact. (0.01 = 1%; slippage and fees are included in this value)"},"estimatedGasUnits":{"format":"int64","type":"integer","description":"Estimated gas units for this trade. (in WEI)"},"suggestedGasPrice":{"format":"int64","type":"integer","description":"Suggested gas price [LOW/MARKET/AGGRESSIVE] fetched from a block explorer (e.g. Etherscan). (in WEI)"},"estimatedGasFees":{"format":"int64","type":"integer","description":"Estimated gas fees for the rebalancing. (in WEI)"},"estimatedGasFeesInUsd":{"type":"number","description":"Estimated gas fees for the rebalancing. (in USD)"},"estimatedProtocolFeesInUsd":{"type":"number","description":"Estimated protocol fees for the rebalancing. (in USD)"},"requiredAllowances":{"description":"List of tokens for which the allowance has to be increased before executing the rebalancing. (List based on the wallet passed in the rebalancing request.)","type":"array","items":{"$ref":"#/components/schemas/AllowanceDto"}},"trades":{"description":"List of trades which will be executed to fulfill the rebalancing.","type":"array","items":{"$ref":"#/components/schemas/TradeDto"}},"txHandler":{"type":"string","description":"[Just if a batch trade is requested, otherwise use txHandler per trade] Address of the contract to send the txData to. It will be our <b>batch trade</b> contract if it is a rebalancing transaction. However, in some special cases, it may also be a different contract, for example, in the case of wrapping ETH into WETH."},"txData":{"type":"object","description":"[Just if a batch trade is requested, otherwise use txData per trade] Call data to execute the rebalancing. (Must be sent to the <code>txHandler</code> contract address.)"},"txValue":{"format":"int64","type":"integer","description":"Call value to execute the rebalancing. (Must be sent to the <code>txHandler</code> contract address.)"},"tokensWithoutPricePair":{"type":"string","description":"List of tokens for which no price pair could be found."},"executable":{"type":"boolean","description":"Is executable based on wallet permissions for smart contracts"},"expirationTimestamp":{"format":"date-time","type":"string","description":"If the rebalancing contains RFQ/OTC trades this is a hard deadline.If not this can be considered as soft deadline. A new rebalancing should be calculated since after some time market prices might have changed in a way that another composition of trades might be better."},"earliestRefreshQuotesTimestamp":{"format":"date-time","type":"string","description":"Earliest timestamp when quotes for this rebalancing can be refreshed"},"suggestedRefreshQuotesTimestamp":{"format":"date-time","type":"string"},"tenderlySimulation":{"description":"Tenderly simulation result.","allOf":[{"$ref":"#/components/schemas/TenderlySimulationDto"}]}},"required":["id","creationDate","baseValueInUsd","sellValueInUsd","estimatedValueLossInUsd","estimatedTargetValueInUsd","estimatedReceiveValueInUsd","minReceiveValueInUsd","estimatedImpact","maxImpact","estimatedGasUnits","suggestedGasPrice","estimatedGasFees","estimatedGasFeesInUsd","estimatedProtocolFeesInUsd","requiredAllowances","trades","txHandler","txData","txValue","tokensWithoutPricePair","executable","expirationTimestamp","earliestRefreshQuotesTimestamp","suggestedRefreshQuotesTimestamp","tenderlySimulation"]},"AllowanceDto":{"type":"object","properties":{"token":{"description":"Token address that needs allowance","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"allowanceTarget":{"type":"string","description":"Exchange proxy to set the allowance on"},"neededAllowance":{"format":"int64","type":"integer","description":"Allowance needed to execute rebalancing"},"currentAllowance":{"format":"int64","type":"integer","description":"Current allowance set on target"},"resetNeeded":{"type":"boolean","description":"Reset allowance to 0 before setting new one"}},"required":["token","allowanceTarget","neededAllowance","currentAllowance","resetNeeded"]},"SimpleTokenDto":{"type":"object","properties":{"address":{"type":"string","description":"Address of the token"},"name":{"type":"string","description":"Name of the token"},"symbol":{"type":"string","description":"Symbol of the token"},"imageUrl":{"type":"string","description":"Url of the token icon"},"decimals":{"type":"number","description":"Decimals of the token"},"sliderColor":{"type":"string","description":"Color based on the icon that can be used for elements in the frontend"},"chain":{"description":"Chain on which the token is deployed","allOf":[{"$ref":"#/components/schemas/ChainDto"}]},"tags":{"description":"Tags categorizing the token","type":"array","items":{"type":"string"}},"deflationary":{"type":"boolean","description":"Describes if this token is deflationary (e.g.: transfer fees)"}},"required":["address","name","symbol","imageUrl","decimals","sliderColor","chain","tags","deflationary"]},"ChainDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the chain"},"identifier":{"type":"string","description":"ID of the EVM base chain as hex value"},"enabled":{"type":"boolean","description":"Describes if rebalancings are enabled"},"batchTradeSupported":{"type":"boolean","description":"Describes if batch trade is supported"},"batchTradeAddress":{"type":"string","description":"Address of the deployed 31third-protocol BatchTrade contract"},"blockExplorerLink":{"type":"string","description":"Link of the most common block explorer"},"nativeTokenAddress":{"type":"string","description":"(Pseudo)-address of the chains native token"},"wrappedNativeTokenAddress":{"type":"string","description":"Address of the chains wrapped native token"},"tokenHelperAddress":{"type":"string","description":"Address of a helper contract capable of doing batch reads"},"portfolioEnabled":{"type":"boolean","description":"Describes if portfolio feature is enabled"}},"required":["name","identifier","enabled","batchTradeSupported","batchTradeAddress","blockExplorerLink","nativeTokenAddress","wrappedNativeTokenAddress","tokenHelperAddress","portfolioEnabled"]},"TradeDto":{"type":"object","properties":{"from":{"description":"Sell token.","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"to":{"description":"Receive token.","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"fromAmount":{"format":"int64","type":"integer","description":"Amount of the <code>from</code> token to sell. (In from token units)"},"toAmount":{"format":"int64","type":"integer","description":"Amount of the <code>to</code> token to receive. (In to token units; liquidity source fees are already included in this value)"},"minToReceiveBeforeFees":{"format":"int64","type":"integer","description":"Minimal amount of the <code>to</code> token to receive excluding fees. (In to token units; slippage and liquidity source fees are included in this value; protocol fees are excluded)"},"minToReceive":{"format":"int64","type":"integer","description":"Minimal amount of the <code>to</code> token to receive. (In to token units; slippage, liquidity source fees and protocol fees are included in this value)"},"fromValueInUsd":{"type":"number","description":"Value of the <code>from</code> token to sell. (in USD)"},"toValueInUsd":{"type":"number","description":"Value of the <code>to</code> token to receive. (in USD; liquidity source fees are already included in this value)"},"minToReceiveBeforeFeesInUsd":{"type":"number","description":"Minimal amount of the <code>to</code> token to receive excluding fees. (In USD; slippage and liquidity source fees are included in this value; protocol fees are excluded)"},"minToReceiveInUsd":{"type":"number","description":"Minimal value of the <code>to</code> token to receive. (in USD; slippage, liquidity source fees and protocol fees are included in this value)"},"estimatedPriceImpact":{"type":"number","description":"Estimated price impact in percent. [-1;1]. > 0 = value loss. < 0 = value gain","minimum":-1,"maximum":1},"maxSlippage":{"type":"number","description":"Maximum allowed slippage used for the calculation of this trade. (0.01 = 1%)","minimum":0,"default":0.005,"maximum":1},"price":{"type":"number","description":"Price of the <code>to</code> token in <code>from</code> token. Does not included slippage."},"guaranteedPrice":{"type":"number","description":"Guaranteed price of the <code>to</code> token in <code>from</code> token including slippage."},"previouslyRequiredTrades":{"description":"List of IDs of the trades that have to be executed before this trade.","type":"array","items":{"type":"string"}},"allowanceTarget":{"type":"string","description":"Allowance target to set the allowance to if <code>allowanceNeeded</code> is <code>true</code>"},"estimatedGasUnits":{"format":"int64","type":"integer","description":"Estimated gas units for this trade. (in WEI)"},"suggestedGasPrice":{"format":"int64","type":"integer","description":"Suggested gas price [LOW/MARKET/AGGRESSIVE] fetched from a block explorer (e.g. Etherscan). (in WEI)"},"estimatedGasFees":{"format":"int64","type":"integer","description":"Estimated gas fees for this trade [estimatedGasUnits * suggestedGasPrice]. (in WEI)"},"estimatedFees":{"format":"int64","type":"integer","deprecated":true,"description":"[USE estimatedGasFees INSTEAD] Estimated gas fees for this trade [estimatedGasUnits * suggestedGasPrice]. (in WEI)"},"expirationTimestamp":{"format":"date-time","type":"string","description":"Shows an approximate expiration estimation for this trade. When a trade is expired, <code>/rebalancing/refresh-expired-quotes</code> can be used to refresh the quote for this trade. Alternatively, a new rebalancing can be calculated."},"transactions":{"type":"array","items":{"type":"string"}},"fill":{"$ref":"#/components/schemas/FillDto"}},"required":["from","to","fromAmount","toAmount","minToReceiveBeforeFees","minToReceive","fromValueInUsd","toValueInUsd","minToReceiveBeforeFeesInUsd","minToReceiveInUsd","estimatedPriceImpact","maxSlippage","price","guaranteedPrice","previouslyRequiredTrades","allowanceTarget","estimatedGasUnits","suggestedGasPrice","estimatedGasFees","estimatedFees","expirationTimestamp","transactions","fill"]},"FillDto":{"type":"object","properties":{"liquiditySource":{"$ref":"#/components/schemas/SimpleLiquiditySourceDto"},"proportionInBps":{"type":"number"},"from":{"$ref":"#/components/schemas/SimpleTokenDto"},"to":{"$ref":"#/components/schemas/SimpleTokenDto"},"subFills":{"type":"array","items":{"type":"string"}}},"required":["liquiditySource","proportionInBps","from","to","subFills"]},"SimpleLiquiditySourceDto":{"type":"object","properties":{"identifier":{"type":"string"},"readableName":{"type":"string"},"iconUrl":{"type":"string"},"enabled":{"type":"boolean"}},"required":["identifier","readableName","iconUrl","enabled"]},"TenderlySimulationDto":{"type":"object","properties":{"status":{"type":"boolean","description":"Simulation status. True if tx simulation succeeded, false otherwise."},"errorMessage":{"type":"string","description":"Error message. Just present if <code>status</code> is <code>false</code>."},"blockNumber":{"type":"number","description":"Block number used for the simulation."},"gas":{"format":"int64","type":"integer","description":"Amount of gas provided for the simulation."},"gasUsed":{"format":"int64","type":"integer","description":"Amount of gas used for the simulation."}},"required":["status","errorMessage","blockNumber","gas","gasUsed"]}}}}
```
