Search in sources :

Example 1 with ExchangeRateSet

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));
}
Also used : ExchangeRateSet(com.hederahashgraph.api.proto.java.ExchangeRateSet) Test(org.junit.jupiter.api.Test)

Example 2 with ExchangeRateSet

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;
}
Also used : ExchangeRate(com.hederahashgraph.api.proto.java.ExchangeRate) ExchangeRateSet(com.hederahashgraph.api.proto.java.ExchangeRateSet)

Aggregations

ExchangeRateSet (com.hederahashgraph.api.proto.java.ExchangeRateSet)2 ExchangeRate (com.hederahashgraph.api.proto.java.ExchangeRate)1 Test (org.junit.jupiter.api.Test)1