use of com.hederahashgraph.api.proto.java.ExchangeRateSet in project hedera-services by hashgraph.
the class PureRatesValidationTest method isSmallChangeTest.
@Test
void isSmallChangeTest() {
ExchangeRateSet smallChangeIncrease = newRates(midnightRates, true, true, true);
Assertions.assertTrue(isNormalIntradayChange(midnightRates, smallChangeIncrease, bound));
ExchangeRateSet smallChangeDecrease = newRates(midnightRates, true, true, false);
Assertions.assertTrue(isNormalIntradayChange(midnightRates, smallChangeDecrease, bound));
ExchangeRateSet bigChangeInCurrent = newRates(midnightRates, false, true, false);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, bigChangeInCurrent, bound));
ExchangeRateSet increasingBigChangeInCurrent = newRates(midnightRates, false, true, true);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, increasingBigChangeInCurrent, bound));
ExchangeRateSet bigChangeInNext = newRates(midnightRates, true, false, true);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, bigChangeInNext, bound));
ExchangeRateSet decreasingBigChangeInCurrent = newRates(midnightRates, true, false, false);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, decreasingBigChangeInCurrent, bound));
ExchangeRateSet bigChangeInBoth = newRates(midnightRates, false, false, true);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, bigChangeInBoth, bound));
ExchangeRateSet decreasingBigChangeInBoth = newRates(midnightRates, false, false, false);
Assertions.assertFalse(isNormalIntradayChange(midnightRates, decreasingBigChangeInBoth, bound));
}
use of com.hederahashgraph.api.proto.java.ExchangeRateSet in project hedera-services by hashgraph.
the class FeesAndRatesProvider method rateSetWith.
public ExchangeRateSet rateSetWith(int curHbarEquiv, int curCentEquiv, int nextHbarEquiv, int nextCentEquiv) {
ExchangeRate.Builder curRate = rateSet.getCurrentRate().toBuilder().setHbarEquiv(curHbarEquiv).setCentEquiv(curCentEquiv);
ExchangeRate.Builder nextRate = rateSet.getCurrentRate().toBuilder().setHbarEquiv(nextHbarEquiv).setCentEquiv(nextCentEquiv);
ExchangeRateSet perturbedSet = rateSet.toBuilder().setCurrentRate(curRate).setNextRate(nextRate).build();
log.info("Computed a new rate set :: " + rateSetAsString(perturbedSet));
return perturbedSet;
}
Aggregations