-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[coinex] Extend functionality #4884
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a0efec1
[general] Define log4j-api version
bigscoop ab7bf44
[coinex] Add http requests
bigscoop f258024
[coinex] Tune lombok and maven settings
bigscoop 92f4765
[coinex] Configure ObjectMapper
bigscoop 585df93
[coinex] Extend market data, add error handling, symbol mappings
bigscoop 1375bd8
[coinex] Add getting of balances
bigscoop 4ebb9bd
[coinex] Add integration test for AccountService
bigscoop 5f88222
Merge branch 'knowm-develop' into coinex
bigscoop a8ab7ec
[coinex] Add getting of chain infos
bigscoop ca24d47
[coinex] Add getting of orderbook
bigscoop e2b73a0
[coinex] Configure logging in tests
bigscoop 4571547
[coinex] Disable body annotation for GET methods
bigscoop e27a063
[coinex] Add instrument metadata initialization
bigscoop 1395a5d
[coinex] Minor fixes
bigscoop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
http-client.private.env.json | ||
integration-test.env.properties |
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,21 @@ | ||
## Using IntelliJ Idea HTTP client | ||
|
||
There are *.http files stored in `src/test/resources/rest` that can be used with IntelliJ Idea HTTP Client. | ||
|
||
Some requests need authorization, so the api credentials have to be stored in `http-client.private.env.json` in module's root. Sample content can be found in `example.http-client.private.env.json` | ||
|
||
> [!CAUTION] | ||
> Never commit your api credentials to the repository! | ||
|
||
|
||
[HTTP Client documentation](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html) | ||
|
||
## Running integration tests that require API keys | ||
|
||
Integration tests that require API keys read them from environment variables. They can be defined in `integration-test.env.properties`. Sample content can be found in `example.integration-test.env.properties`. | ||
|
||
If no keys are provided the integration tests that need them are skipped. | ||
|
||
> [!CAUTION] | ||
> Never commit your api credentials to the repository! | ||
|
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,6 @@ | ||
{ | ||
"default": { | ||
"api_key": "replace_me", | ||
"api_secret": "replace_me" | ||
} | ||
} |
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,2 @@ | ||
apiKey=change_me | ||
secretKey=change_me |
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,5 @@ | ||
{ | ||
"default": { | ||
"api_host": "https://api.coinex.com", | ||
} | ||
} |
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,2 @@ | ||
lombok.equalsAndHashCode.callSuper = call | ||
lombok.tostring.callsuper = call |
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
54 changes: 54 additions & 0 deletions
54
xchange-coinex/src/main/java/org/knowm/xchange/coinex/Coinex.java
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,54 @@ | ||
package org.knowm.xchange.coinex; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.QueryParam; | ||
import jakarta.ws.rs.core.MediaType; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.knowm.xchange.coinex.dto.CoinexException; | ||
import org.knowm.xchange.coinex.dto.CoinexResponse; | ||
import org.knowm.xchange.coinex.dto.marketdata.CoinexAllMarketStatisticsV1; | ||
import org.knowm.xchange.coinex.dto.marketdata.CoinexChainInfo; | ||
import org.knowm.xchange.coinex.dto.marketdata.CoinexCurrencyPairInfo; | ||
import org.knowm.xchange.coinex.dto.marketdata.CoinexMarketDepth; | ||
import org.knowm.xchange.coinex.dto.marketdata.CoinexSingleMarketStatisticsV1; | ||
|
||
@Path("") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public interface Coinex { | ||
|
||
@GET | ||
@Path("v1/common/asset/config") | ||
CoinexResponse<Map<String, CoinexChainInfo>> allChainInfos() | ||
throws IOException, CoinexException; | ||
|
||
|
||
@GET | ||
@Path("v1/market/ticker/all") | ||
CoinexResponse<CoinexAllMarketStatisticsV1> allMarketStatistics() | ||
throws IOException, CoinexException; | ||
|
||
|
||
@GET | ||
@Path("v1/market/ticker") | ||
CoinexResponse<CoinexSingleMarketStatisticsV1> singleMarketStatistics(@QueryParam("market") String market) | ||
throws IOException, CoinexException; | ||
|
||
|
||
@GET | ||
@Path("v2/spot/market") | ||
CoinexResponse<List<CoinexCurrencyPairInfo>> marketStatus(@QueryParam("market") String markets) | ||
throws IOException, CoinexException; | ||
|
||
|
||
@GET | ||
@Path("v2/spot/depth") | ||
CoinexResponse<CoinexMarketDepth> marketDepth(@QueryParam("market") String market, | ||
@QueryParam("limit") Integer limit, @QueryParam("interval") Integer interval) | ||
throws IOException, CoinexException; | ||
|
||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slf4j should be in dependencies, not in dependency management. That way it's in all submodules without needed to explicitly add it in each child module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you're right, but it has to be in both sections:
in
dependencyManagement
we define the version without declaring the factual dependencyin
dependencies
we declare the factual dependency and the version is taken the one that is declared independencyManagement
The advantage of that approach is that we avoid compiling against one version and using another in the runtime.
Now it looks like that: we compile against
slf4j-api
2.0.13, but effectively getting 2.0.6 via transitive dependency:Once we declare the version in
dependencyManagement
the dependency tree looks way better - we compile against 2.0.13 and get 2.0.13:That is a well known problem caled dependency hell and there is a
maven-enforcer-plugin
that helps against such problems.If we agree on that I'll do the analysis for all modules and can prepare the PR afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool. I didn't even know this issue existed at all.