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

Commit

Permalink
Refactor whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
mah454 committed Apr 2, 2021
1 parent d4b9b78 commit c1ab5a4
Show file tree
Hide file tree
Showing 68 changed files with 791 additions and 444 deletions.

This file was deleted.

2 changes: 2 additions & 0 deletions src/main/java/com/binance/api/client/BinanceEngineType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
public enum BinanceEngineType {
SPOT,
MARGIN,
SWAP,
FUTURES,
TESTNET
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.binance.api.client;
package com.binance.api.client.api;

/**
* BinanceApiCallback is a functional interface used together with the BinanceApiAsyncClient to provide a non-blocking REST client.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.binance.api.client;
package com.binance.api.client.api;

import com.binance.api.client.constant.BinanceApiConstants;
import org.apache.commons.lang3.builder.ToStringBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.binance.api.client;
package com.binance.api.client.api;

import com.binance.api.client.domain.event.*;
import com.binance.api.client.domain.market.CandlestickInterval;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.binance.api.client;
package com.binance.api.client.api.async;

import com.binance.api.client.api.BinanceApiCallback;
import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.CancelOrderRequest;
import com.binance.api.client.domain.account.request.CancelOrderResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.binance.api.client;
package com.binance.api.client.api.async;

import com.binance.api.client.api.BinanceApiCallback;
import com.binance.api.client.domain.TransferType;
import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.CancelOrderRequest;
Expand Down Expand Up @@ -58,14 +59,6 @@ public interface BinanceApiAsyncMarginRestClient {
*/
void getOrderStatus(OrderStatusRequest orderStatusRequest, BinanceApiCallback<Order> callback);

/**
* Get margin trades for a specific symbol (async).
*
* @param symbol symbol to get trades from
* @return a list of trades
*/
void getMyTrades(String symbol, BinanceApiCallback<List<Trade>> callback);

// User stream endpoints

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.binance.api.client;
package com.binance.api.client.api.async;

import com.binance.api.client.api.BinanceApiCallback;
import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.*;
import com.binance.api.client.domain.event.ListenKey;
Expand All @@ -12,7 +13,7 @@
/**
* Binance API facade, supporting asynchronous/non-blocking access Binance's REST API.
*/
public interface BinanceApiAsyncRestClient {
public interface BinanceApiSpotAsyncRestClient {

// General endpoints

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.binance.api.client.api.sync;

import com.binance.api.client.domain.account.FuturesAccount;
import com.binance.api.client.domain.account.FuturesNewOrder;
import com.binance.api.client.domain.account.FuturesNewOrderResponse;

public interface BinanceApiFuturesRestClient extends BinanceApiGeneralRestClient {

/**
* Get current margin account information using default parameters.
*/
FuturesAccount getAccount();

/**
* Send in a new margin order.
*
* @param order the new order to submit.
* @return a response containing details about the newly placed order.
*/
FuturesNewOrderResponse newOrder(FuturesNewOrder order);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.binance.api.client;
package com.binance.api.client.api.sync;

import com.binance.api.client.domain.account.*;
import com.binance.api.client.domain.account.request.*;
Expand All @@ -10,7 +10,7 @@
/**
* Binance API facade, supporting synchronous/blocking access Binance's REST API.
*/
public interface BinanceApiRestClient {
public interface BinanceApiGeneralRestClient {

// General endpoints

Expand Down Expand Up @@ -112,39 +112,13 @@ public interface BinanceApiRestClient {
*/
List<TickerStatistics> getAll24HrPriceStatistics();

/**
* Get Latest price for all symbols.
*/
List<TickerPrice> getAllPrices();

/**
* Get latest price for <code>symbol</code>.
*
* @param symbol ticker symbol (e.g. ETHBTC)
*/
TickerPrice getPrice(String symbol);

/**
* Get best price/qty on the order book for all symbols.
*/
List<BookTicker> getBookTickers();

// Account endpoints

/**
* Send in a new order.
*
* @param order the new order to submit.
* @return a response containing details about the newly placed order.
*/
NewOrderResponse newOrder(NewOrder order);

/**
* Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.
*
* @param order the new TEST order to submit.
*/
void newOrderTest(NewOrder order);

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

/**
* Get all account orders; active, canceled, or filled.
*
* @param orderRequest order request parameters
* @return a list of all account orders
*/
List<Order> getAllOrders(AllOrdersRequest orderRequest);

/**
* Get current account information.
*/
Account getAccount(Long recvWindow, Long timestamp);

/**
* Get current account information using default parameters.
*/
Account getAccount();

/**
* Get trades for a specific account and symbol.
*
* @param symbol symbol to get trades from
* @param limit default 500; max 1000
* @param fromId TradeId to fetch from. Default gets most recent trades.
* @return a list of trades
*/
List<Trade> getMyTrades(String symbol, Integer limit, Long fromId, Long recvWindow, Long timestamp);

/**
* Get trades for a specific account and symbol.
*
* @param symbol symbol to get trades from
* @param limit default 500; max 1000
* @return a list of trades
*/
List<Trade> getMyTrades(String symbol, Integer limit);

/**
* Get trades for a specific account and symbol.
*
* @param symbol symbol to get trades from
* @return a list of trades
*/
List<Trade> getMyTrades(String symbol);

List<Trade> getMyTrades(String symbol, Long fromId);

/**
* Submit a withdraw request.
* <p>
* Enable Withdrawals option has to be active in the API settings.
*
* @param asset asset symbol to withdraw
* @param address address to withdraw to
* @param amount amount to withdraw
* @param name description/alias of the address
* @param addressTag Secondary address identifier for coins like XRP,XMR etc.
*/
WithdrawResult withdraw(String asset, String address, String amount, String name, String addressTag);

/**
* Fetch account deposit history.
*
* @return deposit history, containing a list of deposits
*/
DepositHistory getDepositHistory(String asset);

/**
* Fetch account withdraw history.
*
* @return withdraw history, containing a list of withdrawals
*/
WithdrawHistory getWithdrawHistory(String asset);

/**
* Fetch sub-account transfer history.
*
* @return sub-account transfers
*/
List<SubAccountTransfer> getSubAccountTransfers();

/**
* Fetch deposit address.
*
* @return deposit address for a given asset.
*/
DepositAddress getDepositAddress(String asset);

// User stream endpoints
/**
* Start a new user data stream.
Expand Down
Loading

0 comments on commit c1ab5a4

Please sign in to comment.