-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add common classes for OHLC streaming
- Loading branch information
1 parent
692b916
commit 0fb35a2
Showing
8 changed files
with
62 additions
and
24 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/dependabot-auto-merge.yml → ...hub/workflows/dependabot-auto-approve.yml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Dependabot auto-approve | ||
name: dependabot-auto-approve | ||
on: pull_request | ||
|
||
permissions: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
package net.osslabz.crypto; | ||
|
||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Identifies a currency pair. | ||
* | ||
* @param baseCurrencyCode | ||
* @param counterCurrencyCode | ||
*/ | ||
public record CurrencyPair(String baseCurrencyCode, String counterCurrencyCode) { | ||
|
||
public CurrencyPair { | ||
Objects.requireNonNull(baseCurrencyCode, "baseCurrencyCode cannot be null"); | ||
Objects.requireNonNull(counterCurrencyCode, "counterCurrencyCode cannot be null"); | ||
} | ||
|
||
public String getLabel() { | ||
return "%s-%s".formatted(this.baseCurrencyCode, this.counterCurrencyCode); | ||
} | ||
} |
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,16 @@ | ||
package net.osslabz.crypto; | ||
|
||
public enum Exchange { | ||
BINANCE, | ||
|
||
COINBASE, | ||
|
||
KUCOIN, | ||
|
||
KRAKEN, | ||
|
||
MEXC, | ||
|
||
LATOKEN | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package net.osslabz.crypto; | ||
|
||
public record OhlcAsset(CurrencyPair currencyPair, Interval interval) { | ||
public record OhlcAsset(TradingAsset tradingAsset, Interval interval) { | ||
} |
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,16 @@ | ||
package net.osslabz.crypto; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Identifies a trading asset (a currency pair on a specific exchange). | ||
* | ||
* @param exchange | ||
* @param currencyPair | ||
*/ | ||
public record TradingAsset(Exchange exchange, CurrencyPair currencyPair) { | ||
public TradingAsset { | ||
Objects.requireNonNull(exchange, "exchange cannot be null"); | ||
Objects.requireNonNull(currencyPair, "currencyPair cannot be null"); | ||
} | ||
} |