44
55[ Sign up in CryptoMarket] ( https://www.cryptomkt.com/account/register ) .
66
7- # Installation
7+ ## Installation
88
99Add the Maven dependency
1010
1111``` xml
1212<dependency >
1313 <groupId >com.cryptomkt.api</groupId >
1414 <artifactId >cryptomarket</artifactId >
15- <version >3.1.3 </version >
15+ <version >3.3.0 </version >
1616</dependency >
1717```
1818
19- # Documentation
19+ ## Documentation
2020
2121This sdk makes use of the [ api version 3] ( https://api.exchange.cryptomkt.com ) of Cryptomarket.
2222
23- # Quick Start
23+ ## Quick Start
2424
25- ## Rest client
25+ ### Rest client
2626
2727``` java
2828
@@ -53,8 +53,8 @@ List<Balance> spotBalances = client.getSpotTradingBalances();
5353
5454// move balance from account to trading
5555String result = client. transferBetweenWalletAndExchange(
56- ' ETH' ,
57- ' 3.2' ,
56+ ' ETH' ,
57+ ' 3.2' ,
5858 AccountType . WALLET ,
5959 AccountType . SPOT );
6060
@@ -80,11 +80,11 @@ import com.cryptomarket.params.ParamsBuilder;
8080List<String > symbols = new ArrayList<String > (Arrays . asList(" EOSETH" , " ETHBTC" ));
8181// get candles
8282Map<String , List<Candle > > candles = client. getCandles(
83- symbols,
84- Period . _4_HOURS,
85- Sort . ASC ,
86- null ,
87- null ,
83+ symbols,
84+ Period . _4_HOURS,
85+ Sort . ASC ,
86+ null ,
87+ null ,
8888 null );
8989// is equivalent to:
9090Map<String , List<Candle > > candles client. getCandles(new ParamsBuilder ()
@@ -93,7 +93,7 @@ Map<String, List<Candle>> candles client.getCandles(new ParamsBuilder()
9393 .sort(Sort . ASC ));
9494```
9595
96- ## Exception handling
96+ ### Exception handling
9797
9898``` java
9999
@@ -111,7 +111,7 @@ try {
111111
112112```
113113
114- ## Websocket client
114+ ### Websocket client
115115
116116There are three websocket clients, the market data client, the spot trading client and the wallet client.
117117The market data client requires no authentication, while the spot trading client and the wallet client do require it.
@@ -143,10 +143,12 @@ BiConsumer<List<Report>, NotificationType> biConsumerExample = (data, notificati
143143The documentation of a specific subscription explains which types of
144144notification uses.
145145
146- ### Websocket Lifetime
147- There are hooks for the connection, close and faiule of the websockets.
146+ #### Websocket Lifetime
147+
148+ There are hooks for the connection, close and faiule of the websockets.
148149
149150On an authenticated client, onConnect is called after authentication, which happens automatically after connection.
151+
150152``` java
151153// ws client lifetime
152154CryptomarketWSSpotTradingClient wsClient;
@@ -157,10 +159,12 @@ CryptomarketWSSpotTradingClient wsClient;
157159 wsClient. connect();
158160```
159161
160- ### Websocket Connection
161- The websockets take some time (around one second) to connect, and authenticated sockets take a little more time to authenticate, so we must wait to the client to call onConnect first.
162+ #### Websocket Connection
163+
164+ The websockets take some time (around one second) to connect, and authenticated sockets take a little more time to authenticate, so we must wait to the client to call onConnect first.
162165
163166A way of doing this is using a future task
167+
164168``` java
165169var wsClient = new CryptomarketWSSpotTradingClientImpl (KeyLoader . getApiKey(), KeyLoader . getApiSecret());
166170var ft = new FutureTask<Object > (() - > {}, new Object ());
@@ -170,6 +174,7 @@ ft.get();
170174// here we are connected and authenticated already
171175wsClient. getSpotTradingBalances((balances, err) - > {... });
172176```
177+
173178We can also run our logic inside the onConnect hook
174179
175180``` java
@@ -181,6 +186,7 @@ wsClient.onConnect(()-> {
181186});
182187wsClient. connect();
183188```
189+
184190Or we can sleep some time to wait connection
185191
186192``` java
@@ -192,7 +198,7 @@ TimeUnit.Seconds.sleep(3);
192198wsClient. getSpotTradingBalances((balances, err) - > {... });
193199```
194200
195- ### MarketDataClient
201+ #### MarketDataClient
196202
197203Example of use of the market data client
198204
@@ -223,7 +229,7 @@ marketDataClient.subscribeToPartialOrderBook(
223229
224230```
225231
226- ### SpotTradingClient
232+ #### SpotTradingClient
227233
228234Example of use of the spot trading client
229235
@@ -259,7 +265,7 @@ tradingClient.createSpotOrder(
259265 });
260266```
261267
262- ### WalletClient
268+ #### WalletClient
263269
264270Example of use of the wallet client
265271
@@ -293,12 +299,12 @@ walletClient.subscribeToTransactions(
293299 });
294300```
295301
296- # Constants
302+ ## Constants
297303
298304All constants required for calls are in ` com.cryptomarket.sdk.params ` .
299305each enum has the name of the argument that needs it.
300306
301- # Checkout our other SDKs
307+ ## Checkout our other SDKs
302308
303309<!-- agregar links -->
304310
0 commit comments