hashgraph / hedera-exchange-rate-tool

Hedera Exchange Rate Tool to send median of HBAR/USD exchange rate from various Exchanges to Hedera Network
Apache License 2.0
3 stars 4 forks source link

Change ERT behaviour when FileUpdate returns `EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED` #153

Closed anighanta closed 2 years ago

anighanta commented 3 years ago

Summary On lemons Suggestion, follow the below described steps:


**
 * This Class represents the whole Exchange Rate Tool application. This is main entry point for the application.
 *
 * The {@code main} method is triggered by an AWS Lambda every hour. It then,
 * <ol>
 *     <li>Queries the configured exchanges for their ℏ-USD exchange rates.</li>
 *     <li>Computes the weighted median of these rates.</li>
 *     <li>Performs a {@code FileUpdate} to system file 0.0.112 with this weighted median.</li>
 * </ol>
 *
 * TODO
 * ----
 * If the network returns {@code EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED}, then the ERT tool should
 * make a best-effort attempt to push the rates toward the desired values. Suppose the desired
 * rates are <tt>[ (curGoal-ℏ <-> curGoal-USD), (nxtGoal-ℏ <-> nxtGoal-USD) ]</tt>
 * <ol>
 *     <li>First, recover the <B>active rates</B> from the receipt of the failed update txn. 
 *     Call these rates <tt>[ (curActive-ℏ <-> curActive-USD), (nxtActive-ℏ <-> nxtActive-USD) ]</tt>.</li>
 *     <li>Second, adjust the goal rates set by []</li>
 * </ol>
 *
 * @author Anirudh, Cesar
 */```