Skip to content

Commit 3c827e9

Browse files
authored
Merge pull request #2227 from douggie/develop
#2063 BitMex Symbol Adapters
2 parents d7071b4 + 0df0c1b commit 3c827e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2219
-454
lines changed

xchange-bitmex/src/main/java/org/knowm/xchange/bitmex/Bitmex.java

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import javax.ws.rs.GET;
88
import javax.ws.rs.HeaderParam;
99
import javax.ws.rs.Path;
10+
import javax.ws.rs.PathParam;
1011
import javax.ws.rs.Produces;
1112
import javax.ws.rs.QueryParam;
1213
import javax.ws.rs.core.MediaType;
@@ -16,8 +17,10 @@
1617
import org.knowm.xchange.bitmex.dto.account.BitmexTicker;
1718
import org.knowm.xchange.bitmex.dto.account.BitmexWallet;
1819
import org.knowm.xchange.bitmex.dto.account.BitmexWalletTransaction;
20+
import org.knowm.xchange.bitmex.dto.marketdata.BitmexPublicOrder;
21+
import org.knowm.xchange.bitmex.dto.marketdata.BitmexPublicTrade;
22+
import org.knowm.xchange.bitmex.dto.marketdata.results.BitmexSymbolsAndPromptsResult;
1923
import org.knowm.xchange.bitmex.dto.trade.BitmexPosition;
20-
import org.knowm.xchange.bitmex.dto.trade.BitmexTrade;
2124

2225
import si.mazi.rescu.ParamsDigest;
2326
import si.mazi.rescu.SynchronizedValueFactory;
@@ -28,82 +31,67 @@ public interface Bitmex {
2831

2932
@GET
3033
@Path("user")
31-
BitmexAccount getAccount(@HeaderParam("API-KEY") String apiKey,
32-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
33-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest) throws IOException;
34+
BitmexAccount getAccount(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce, @HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest)
35+
throws IOException;
3436

3537
@GET
3638
@Path("user/wallet")
37-
BitmexWallet getWallet(@HeaderParam("API-KEY") String apiKey,
38-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
39-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
40-
@Nullable @QueryParam("currency") String currency) throws IOException;
39+
BitmexWallet getWallet(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce, @HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
40+
@Nullable @PathParam("currency") String currency) throws IOException;
4141

42-
//Get a history of all of your wallet transactions (deposits, withdrawals, PNL)
42+
// Get a history of all of your wallet transactions (deposits, withdrawals, PNL)
4343
@GET
4444
@Path("user/walletHistory")
45-
List<BitmexWalletTransaction> getWalletHistory(@HeaderParam("API-KEY") String apiKey,
46-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
47-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
48-
@Nullable @QueryParam("currency") String currency) throws IOException;
45+
List<BitmexWalletTransaction> getWalletHistory(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
46+
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest, @Nullable @PathParam("currency") String currency) throws IOException;
4947

50-
//Get a summary of all of your wallet transactions (deposits, withdrawals, PNL)
48+
// Get a summary of all of your wallet transactions (deposits, withdrawals, PNL)
5149
@GET
5250
@Path("user/walletSummary")
53-
List<BitmexWalletTransaction> getWalletSummary(@HeaderParam("API-KEY") String apiKey,
54-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
55-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
56-
@Nullable @QueryParam("currency") String currency) throws IOException;
51+
List<BitmexWalletTransaction> getWalletSummary(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
52+
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest, @Nullable @PathParam("currency") String currency) throws IOException;
5753

5854
@GET
5955
@Path("user/margin")
60-
BitmexMarginAccount getMarginAccountStatus(@HeaderParam("API-KEY") String apiKey,
61-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
62-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
63-
@Nullable @QueryParam("currency") String currency) throws IOException;
56+
BitmexMarginAccount getMarginAccountStatus(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
57+
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest, @Nullable @PathParam("currency") String currency) throws IOException;
6458

6559
@GET
6660
@Path("user/margin?currency=all")
67-
List<BitmexMarginAccount> getMarginAccountsStatus(@HeaderParam("API-KEY") String apiKey,
68-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
61+
List<BitmexMarginAccount> getMarginAccountsStatus(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
6962
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest) throws IOException;
7063

7164
@GET
7265
@Path("trade")
73-
List<BitmexTrade> getTrades(@HeaderParam("API-KEY") String apiKey,
74-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
75-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest) throws IOException;
66+
BitmexPublicTrade[] getTrades(@QueryParam("symbol") String currencyPair, @QueryParam("reverse") Boolean reverse) throws IOException;
7667

7768
@GET
78-
@Path("trade")
79-
List<BitmexTrade> getTrades(@HeaderParam("API-KEY") String apiKey,
80-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
81-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
82-
@QueryParam("symbol") String symbol) throws IOException;
69+
@Path("orderBook/L2")
70+
BitmexPublicOrder[] getDepth(@QueryParam("symbol") String currencyPair, @QueryParam("depth") Double depth) throws IOException;
8371

8472
@GET
8573
@Path("position")
86-
List<BitmexPosition> getPositions(@HeaderParam("API-KEY") String apiKey,
87-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
88-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest) throws IOException;
74+
List<BitmexPosition> getPositions(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce, @HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest)
75+
throws IOException;
8976

9077
@GET
9178
@Path("position")
92-
List<BitmexPosition> getPositions(@HeaderParam("API-KEY") String apiKey,
93-
@HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce,
94-
@HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
95-
@Nullable @QueryParam("symbol") String symbol,
96-
@Nullable @QueryParam("filter") String filter) throws IOException;
79+
List<BitmexPosition> getPositions(@HeaderParam("API-KEY") String apiKey, @HeaderParam("API-NONCE") SynchronizedValueFactory<Long> nonce, @HeaderParam("API-SIGNATURE") ParamsDigest paramsDigest,
80+
@Nullable @QueryParam("symbol") String symbol, @Nullable @QueryParam("filter") String filter) throws IOException;
9781

9882
@GET
9983
@Path("instrument")
10084
List<BitmexTicker> getTickers() throws IOException, BitmexException;
10185

10286
@GET
10387
@Path("instrument")
104-
List<BitmexTicker> getTicker(@QueryParam("symbol") String symbol) throws IOException, BitmexException;
88+
List<BitmexTicker> getTicker(@PathParam("symbol") String symbol) throws IOException, BitmexException;
10589

10690
@GET
10791
@Path("instrument/active")
10892
List<BitmexTicker> getActiveTickers() throws IOException, BitmexException;
93+
94+
@GET
95+
@Path("instrument/activeIntervals")
96+
BitmexSymbolsAndPromptsResult getPromptsAndSymbols() throws IOException, BitmexException;
10997
}

0 commit comments

Comments
 (0)