Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 13d878d

Browse files
committed
Refacor whole project
1 parent d4b9b78 commit 13d878d

File tree

68 files changed

+791
-444
lines changed

Some content is hidden

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

68 files changed

+791
-444
lines changed

src/main/java/com/binance/api/client/BinanceApiFuturesRestClient.java

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/main/java/com/binance/api/client/BinanceEngineType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
public enum BinanceEngineType {
77
SPOT,
8+
MARGIN,
9+
SWAP,
810
FUTURES,
911
TESTNET
1012
}

src/main/java/com/binance/api/client/BinanceApiCallback.java renamed to src/main/java/com/binance/api/client/api/BinanceApiCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api;
22

33
/**
44
* BinanceApiCallback is a functional interface used together with the BinanceApiAsyncClient to provide a non-blocking REST client.

src/main/java/com/binance/api/client/BinanceApiError.java renamed to src/main/java/com/binance/api/client/api/BinanceApiError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api;
22

33
import com.binance.api.client.constant.BinanceApiConstants;
44
import org.apache.commons.lang3.builder.ToStringBuilder;

src/main/java/com/binance/api/client/BinanceApiWebSocketClient.java renamed to src/main/java/com/binance/api/client/api/BinanceApiWebSocketClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api;
22

33
import com.binance.api.client.domain.event.*;
44
import com.binance.api.client.domain.market.CandlestickInterval;

src/main/java/com/binance/api/client/BinanceApiAsyncFuturesRestClient.java renamed to src/main/java/com/binance/api/client/api/async/BinanceApiAsyncFuturesRestClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api.async;
22

3+
import com.binance.api.client.api.BinanceApiCallback;
34
import com.binance.api.client.domain.account.*;
45
import com.binance.api.client.domain.account.request.CancelOrderRequest;
56
import com.binance.api.client.domain.account.request.CancelOrderResponse;

src/main/java/com/binance/api/client/BinanceApiAsyncMarginRestClient.java renamed to src/main/java/com/binance/api/client/api/async/BinanceApiAsyncMarginRestClient.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api.async;
22

3+
import com.binance.api.client.api.BinanceApiCallback;
34
import com.binance.api.client.domain.TransferType;
45
import com.binance.api.client.domain.account.*;
56
import com.binance.api.client.domain.account.request.CancelOrderRequest;
@@ -58,14 +59,6 @@ public interface BinanceApiAsyncMarginRestClient {
5859
*/
5960
void getOrderStatus(OrderStatusRequest orderStatusRequest, BinanceApiCallback<Order> callback);
6061

61-
/**
62-
* Get margin trades for a specific symbol (async).
63-
*
64-
* @param symbol symbol to get trades from
65-
* @return a list of trades
66-
*/
67-
void getMyTrades(String symbol, BinanceApiCallback<List<Trade>> callback);
68-
6962
// User stream endpoints
7063

7164
/**

src/main/java/com/binance/api/client/BinanceApiAsyncRestClient.java renamed to src/main/java/com/binance/api/client/api/async/BinanceApiSpotAsyncRestClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api.async;
22

3+
import com.binance.api.client.api.BinanceApiCallback;
34
import com.binance.api.client.domain.account.*;
45
import com.binance.api.client.domain.account.request.*;
56
import com.binance.api.client.domain.event.ListenKey;
@@ -12,7 +13,7 @@
1213
/**
1314
* Binance API facade, supporting asynchronous/non-blocking access Binance's REST API.
1415
*/
15-
public interface BinanceApiAsyncRestClient {
16+
public interface BinanceApiSpotAsyncRestClient {
1617

1718
// General endpoints
1819

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.binance.api.client.api.sync;
2+
3+
import com.binance.api.client.domain.account.FuturesAccount;
4+
import com.binance.api.client.domain.account.FuturesNewOrder;
5+
import com.binance.api.client.domain.account.FuturesNewOrderResponse;
6+
7+
public interface BinanceApiFuturesRestClient extends BinanceApiGeneralRestClient {
8+
9+
/**
10+
* Get current margin account information using default parameters.
11+
*/
12+
FuturesAccount getAccount();
13+
14+
/**
15+
* Send in a new margin order.
16+
*
17+
* @param order the new order to submit.
18+
* @return a response containing details about the newly placed order.
19+
*/
20+
FuturesNewOrderResponse newOrder(FuturesNewOrder order);
21+
}

src/main/java/com/binance/api/client/BinanceApiRestClient.java renamed to src/main/java/com/binance/api/client/api/sync/BinanceApiGeneralRestClient.java

Lines changed: 2 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binance.api.client;
1+
package com.binance.api.client.api.sync;
22

33
import com.binance.api.client.domain.account.*;
44
import com.binance.api.client.domain.account.request.*;
@@ -10,7 +10,7 @@
1010
/**
1111
* Binance API facade, supporting synchronous/blocking access Binance's REST API.
1212
*/
13-
public interface BinanceApiRestClient {
13+
public interface BinanceApiGeneralRestClient {
1414

1515
// General endpoints
1616

@@ -112,39 +112,13 @@ public interface BinanceApiRestClient {
112112
*/
113113
List<TickerStatistics> getAll24HrPriceStatistics();
114114

115-
/**
116-
* Get Latest price for all symbols.
117-
*/
118-
List<TickerPrice> getAllPrices();
119-
120115
/**
121116
* Get latest price for <code>symbol</code>.
122117
*
123118
* @param symbol ticker symbol (e.g. ETHBTC)
124119
*/
125120
TickerPrice getPrice(String symbol);
126121

127-
/**
128-
* Get best price/qty on the order book for all symbols.
129-
*/
130-
List<BookTicker> getBookTickers();
131-
132-
// Account endpoints
133-
134-
/**
135-
* Send in a new order.
136-
*
137-
* @param order the new order to submit.
138-
* @return a response containing details about the newly placed order.
139-
*/
140-
NewOrderResponse newOrder(NewOrder order);
141-
142-
/**
143-
* Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.
144-
*
145-
* @param order the new TEST order to submit.
146-
*/
147-
void newOrderTest(NewOrder order);
148122

149123
/**
150124
* Check an order's status.
@@ -169,94 +143,6 @@ public interface BinanceApiRestClient {
169143
*/
170144
List<Order> getOpenOrders(OrderRequest orderRequest);
171145

172-
/**
173-
* Get all account orders; active, canceled, or filled.
174-
*
175-
* @param orderRequest order request parameters
176-
* @return a list of all account orders
177-
*/
178-
List<Order> getAllOrders(AllOrdersRequest orderRequest);
179-
180-
/**
181-
* Get current account information.
182-
*/
183-
Account getAccount(Long recvWindow, Long timestamp);
184-
185-
/**
186-
* Get current account information using default parameters.
187-
*/
188-
Account getAccount();
189-
190-
/**
191-
* Get trades for a specific account and symbol.
192-
*
193-
* @param symbol symbol to get trades from
194-
* @param limit default 500; max 1000
195-
* @param fromId TradeId to fetch from. Default gets most recent trades.
196-
* @return a list of trades
197-
*/
198-
List<Trade> getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp);
199-
200-
/**
201-
* Get trades for a specific account and symbol.
202-
*
203-
* @param symbol symbol to get trades from
204-
* @param limit default 500; max 1000
205-
* @return a list of trades
206-
*/
207-
List<Trade> getMyTrades(String symbol, Integer limit);
208-
209-
/**
210-
* Get trades for a specific account and symbol.
211-
*
212-
* @param symbol symbol to get trades from
213-
* @return a list of trades
214-
*/
215-
List<Trade> getMyTrades(String symbol);
216-
217-
List<Trade> getMyTrades(String symbol, Long fromId);
218-
219-
/**
220-
* Submit a withdraw request.
221-
* <p>
222-
* Enable Withdrawals option has to be active in the API settings.
223-
*
224-
* @param asset asset symbol to withdraw
225-
* @param address address to withdraw to
226-
* @param amount amount to withdraw
227-
* @param name description/alias of the address
228-
* @param addressTag Secondary address identifier for coins like XRP,XMR etc.
229-
*/
230-
WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag);
231-
232-
/**
233-
* Fetch account deposit history.
234-
*
235-
* @return deposit history, containing a list of deposits
236-
*/
237-
DepositHistory getDepositHistory(String asset);
238-
239-
/**
240-
* Fetch account withdraw history.
241-
*
242-
* @return withdraw history, containing a list of withdrawals
243-
*/
244-
WithdrawHistory getWithdrawHistory(String asset);
245-
246-
/**
247-
* Fetch sub-account transfer history.
248-
*
249-
* @return sub-account transfers
250-
*/
251-
List<SubAccountTransfer> getSubAccountTransfers();
252-
253-
/**
254-
* Fetch deposit address.
255-
*
256-
* @return deposit address for a given asset.
257-
*/
258-
DepositAddress getDepositAddress(String asset);
259-
260146
// User stream endpoints
261147
/**
262148
* Start a new user data stream.

0 commit comments

Comments
 (0)