Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '23'
java-version: '25'

- name: Build pull request
run: mvn clean package
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This example will generate the `eoy-balance.csv` file, showing the balance of yo
mvn -pl examples exec:java -Dexec.mainClass=dev.andstuff.kraken.example.EoyBalanceExample -Dexec.args="2025-01-31T00:00:00Z"
```

## Libary usage
## Library usage

### Public endpoints

Expand All @@ -58,7 +58,7 @@ Map<String, AssetPair> pairs = api.assetPairs(List.of("ETH/BTC", "ETH/USD"));
// {ETH/BTC=AssetPair[alternateName=ETHXBT, webSocketName=ETH/XBT, …
```

If the endpoint has not yet been implemented (feel free to submit a PR!), the generic `query` method can be used, which will return a `JsonNode` of the [Jackson][2] deserialization libary:
If the endpoint has not yet been implemented (feel free to submit a PR!), the generic `query` method can be used, which will return a `JsonNode` of the [Jackson][2] deserialization library:

```java
JsonNode ticker = api.query(KrakenAPI.Public.TICKER, Map.of("pair", "XBTEUR"));
Expand Down
7 changes: 4 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This document explains how a kraken-api-java release is created and describes what are the tools used and how they interact with each other.

When a release is created, the visible "output" is an updated [CHANGLOG.md](https://github.com/nyg/kraken-api-java/blob/master/CHANGELOG.md) file, a [GitHub release](https://github.com/nyg/kraken-api-java/releases) with a changelog, and the [release artifact](https://repo1.maven.org/maven2/dev/andstuff/kraken/kraken-api/) available in the Maven Central repository.
When a release is created, the visible "output" is an updated [CHANGELOG.md](https://github.com/nyg/kraken-api-java/blob/master/CHANGELOG.md)
file, a [GitHub release](https://github.com/nyg/kraken-api-java/releases) with a changelog, and the [release artifact](https://repo1.maven.org/maven2/dev/andstuff/kraken/kraken-api/) available in the Maven Central repository.

## Overview

Expand All @@ -19,7 +20,7 @@ Also note that we do not use GitHub's own Maven repository, a.k.a. [GitHub Packa

## Detailed steps

The Maven release plugin helps automatizing certain tasks when making releases for Maven-based projects. Releasing requires invoking two of the plugin's goals: `prepare` and `perform`.
The Maven release plugin helps to automatize certain tasks when making releases for Maven-based projects. Releasing requires invoking two of the plugin's goals: `prepare` and `perform`.

In short, the `prepare` goal updates version numbers in the POMs and creates a tag in the SCM (e.g. Git). The `perform` goal checks out the created tag, builds the project artifacts and publishes them on a remote Maven repository.

Expand Down Expand Up @@ -47,7 +48,7 @@ The detailed list of steps executed by the prepare goal are defined [here](https

6. Create and push a commit with the changes made above. The message of the commit can be customized with the `scmDevelopmentCommitComment`.

The prepare goal also creates a `release.properties` file that is used by the `perform` goal in order to know which tag to checkout and build.
The prepare goal also creates a `release.properties` file that is used by the `perform` goal in order to know which tag to check out and build.

Finally, when wanting to make a release, the command line looks like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EoyBalanceExample {

private final KrakenAPI api;

public static void main(String[] args) {
static void main(String[] args) {
KrakenCredentials credentials = readFromFile("/api-keys.properties");
Instant dateTo = Instant.parse(args.length > 1 ? args[1] : "2024-01-01T00:00:00Z");
new EoyBalanceExample(new KrakenAPI(credentials))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@Slf4j
public class SimpleExamples {

public static void main(String[] args) {
static void main() {

/* Public endpoint examples */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class StakingRewardsSummaryExample {

private final KrakenAPI api;

public static void main(String[] args) {
static void main() {
KrakenCredentials credentials = readFromFile("/api-keys.properties");
new StakingRewardsSummaryExample(new KrakenAPI(credentials))
.generate("rewards.csv", "rewards-summary.csv");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static KrakenCredentials readFromFile(String path) {
return new KrakenCredentials(properties.getProperty("key"), properties.getProperty("secret"));
}
catch (IOException e) {
throw new IllegalStateException(String.format("Could not read properties from file: %s", path));
throw new IllegalStateException("Could not read properties from file: %s".formatted(path), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.opencsv.bean.AbstractCsvConverter;
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
import com.opencsv.exceptions.CsvBeanIntrospectionException;
import com.opencsv.exceptions.CsvChainedException;
import com.opencsv.exceptions.CsvConstraintViolationException;
import com.opencsv.exceptions.CsvDataTypeMismatchException;
import com.opencsv.exceptions.CsvFieldAssignmentException;
Expand All @@ -29,7 +28,7 @@ public RecordMappingStrategy(Class<T> type) {
}

@Override
public T populateNewBean(String[] line) throws CsvBeanIntrospectionException, CsvFieldAssignmentException, CsvChainedException {
public T populateNewBean(String[] line) throws CsvBeanIntrospectionException, CsvFieldAssignmentException {
RecordComponent[] recordComponents = type.getRecordComponents();
if (recordComponents.length != line.length) {
throw new CsvRuntimeException("Mismatch between line values and record components");
Expand Down Expand Up @@ -71,7 +70,7 @@ private Map<String, Object> createValuesMap(String[] line) throws CsvConstraintV
public static class KrakenInstantConverter extends AbstractCsvConverter {

@Override
public Object convertToRead(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException {
public Object convertToRead(String value) {
String[] dateTime = value.split(" ");
return Instant.parse("%sT%sZ".formatted(dateTime[0], dateTime[1]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ public enum Type {
TRANSFER,
WITHDRAWAL,

@JsonProperty("custodytransfer") CUSTODY_TRANSFER,
@JsonProperty("nftcreatorfee") NFT_CREATOR_FEE,
@JsonProperty("nftrebate") NFT_REBATE,
@JsonProperty("nfttrade") NFT_TRADE,
@JsonProperty("custodytransfer")
CUSTODY_TRANSFER,
@JsonProperty("nftcreatorfee")
NFT_CREATOR_FEE,
@JsonProperty("nftrebate")
NFT_REBATE,
@JsonProperty("nfttrade")
NFT_TRADE,

@JsonEnumDefaultValue UNKNOWN
@JsonEnumDefaultValue
UNKNOWN
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.Instant;

import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
import com.fasterxml.jackson.annotation.JsonProperty;

import dev.andstuff.kraken.api.endpoint.account.params.ReportFormat;
Expand All @@ -10,7 +11,7 @@ public record Report(String id,
@JsonProperty("descr") String description,
ReportFormat format,
String subType,
String status, // TODO enum
Status status,
String fields,
@JsonProperty("createdtm") Instant requestDate,
@JsonProperty("starttm") Instant creationDate,
Expand All @@ -19,7 +20,15 @@ public record Report(String id,
@JsonProperty("dataendtm") Instant reportToDate,
String asset) {

enum Status {
QUEUED,
PROCESSING,
PROCESSED,
@JsonEnumDefaultValue
UNKNOWN
}

public boolean isProcessed() {
return "Processed".equals(status);
return status == Status.PROCESSED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static byte[] hmacSha512(byte[] key, byte[] message) {
return mac.doFinal(message);
}
catch (InvalidKeyException | NoSuchAlgorithmException e) {
throw new IllegalStateException("Could not compute HMAC digest");
throw new IllegalStateException("Could not compute HMAC digest", e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>23</release>
<release>25</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
Expand Down