-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate on-chain NAV data into historical hash price calculations (#…
…555) * seperate processing logic into tokenservice * refactor processing functions * use flow api source in calculating historical data, remove legacy osmosis only fetchers * fix lints * fix test to not use legacy fetcher call, remove protected * remove old test, add source checks * reorder asserts in test * fix percent change to return predicable decimal places, add tests * fix lints * add test, fix query to limit 1 * add change log entry * change changelog entry description
- Loading branch information
1 parent
db73ab3
commit 7f16bcb
Showing
14 changed files
with
285 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
service/src/test/kotlin/io/provenance/explorer/domain/extensions/CoinExtensionsKtTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.provenance.explorer.domain.extensions | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
import java.math.BigDecimal | ||
|
||
class CoinExtensionsKtTest { | ||
|
||
@Test | ||
fun `test percentChange extension`() { | ||
val increaseFrom100To120 = BigDecimal("120").percentChange(BigDecimal("100")) | ||
assertEquals(BigDecimal("20.0"), increaseFrom100To120, "Percent change calculation is incorrect") | ||
|
||
val decreaseFrom100To80 = BigDecimal("80").percentChange(BigDecimal("100")) | ||
assertEquals(BigDecimal("-20.0"), decreaseFrom100To80, "Percent change calculation is incorrect") | ||
|
||
val noChangeAt100 = BigDecimal("100").percentChange(BigDecimal("100")) | ||
assertEquals(BigDecimal("0.0"), noChangeAt100, "Percent change calculation is incorrect") | ||
|
||
val smallIncreaseFrom100To100_01 = BigDecimal("100.01").percentChange(BigDecimal("100")) | ||
assertEquals(BigDecimal("0.0"), smallIncreaseFrom100To100_01, "Percent change calculation is incorrect") | ||
|
||
val rounding = BigDecimal("1.600").percentChange(BigDecimal("1.4")) | ||
assertEquals(BigDecimal("14.3"), rounding, "Percent change calculation is incorrect") | ||
|
||
val divisionByZero = BigDecimal("100").percentChange(BigDecimal("0")) | ||
assertEquals(BigDecimal.ZERO, divisionByZero, "Percent change calculation is incorrect when dividing by zero") | ||
} | ||
} |
Oops, something went wrong.