Skip to content
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

v3.4.0 #126

Merged
merged 10 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

## 3.4.0 - 2024-10-02
### Added
- New Margin endpoints:
- `POST /sapi/v1/margin/borrow-repay`
- `GET /sapi/v1/margin/borrow-repay`

### Changed
- Updated `CryptoLoans` v1 to v2:
- `POST /sapi/v1/loan/flexible/borrow` to `POST /sapi/v2/loan/flexible/borrow`
- `GET /sapi/v1/loan/flexible/ongoing/orders` to `GET /sapi/v2/loan/flexible/ongoing/orders`
- `GET /sapi/v1/loan/flexible/borrow/history` to `GET /sapi/v2/loan/flexible/borrow/history`
- `POST /sapi/v1/loan/flexible/repay` to `POST /sapi/v2/loan/flexible/repay`
- `GET /sapi/v1/loan/flexible/repay/history` to `GET /sapi/v2/loan/flexible/repay/history`
- `POST /sapi/v1/loan/flexible/adjust/ltv` to `POST /sapi/v2/loan/flexible/adjust/ltv`
- `GET /sapi/v1/loan/flexible/ltv/adjustment/history` to `GET /sapi/v2/loan/flexible/ltv/adjustment/history`
- `GET /sapi/v1/loan/flexible/loanable/data` to `GET /sapi/v2/loan/flexible/loanable/data`
- `GET /sapi/v1/loan/flexible/collateral/data` to `GET /sapi/v2/loan/flexible/collateral/data`
- Added parameter `isolatedSymbol` to endpoint `GET /sapi/v1/margin/transfer`
- Added parameter `asset` to endpoint `GET /sapi/v1/margin/allAssets`
- Added parameter `symbol` to endpoints `GET /sapi/v1/margin/allPairs` and `GET /sapi/v1/margin/isolated/allPairs`

### Removed
- Deprecated Futures endpoints:
- `POST /sapi/v1/futures/transfer`
- `GET /sapi/v1/futures/transfer`
- `GET /sapi/v1/futures/histDataLink`

- BLVT endpoints:
- `GET /sapi/v1/blvt/tokenInfo`
- `POST /sapi/v1/blvt/subscribe`
- `GET /sapi/v1/blvt/subscribe/record`
- `POST /sapi/v1/blvt/redeem`
- `GET /sapi/v1/blvt/redeem/record`
- `GET /sapi/v1/blvt/userLimit`

- Deprecated Trade endpoint: `POST /api/v3/order/oco`

- Wallet endpoints:
- `POST /sapi/v1/asset/convert-transfer`
- `GET /sapi/v1/asset/convert-transfer/queryByPage`
- `GET /sapi/v1/capital/contract/convertible-coins`
- `POST /sapi/v1/capital/contract/convertible-coins`

## 3.3.0 - 2024-06-19
### Changed
- Upgraded dependencies
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Additionally, it includes test cases and examples.
[https://www.javadoc.io/doc/io.github.binance/binance-connector-java/latest/index.html](https://www.javadoc.io/doc/io.github.binance/binance-connector-java/latest/index.html)

## Getting Started
Copy and paste the following dependency snippet into your `pom.xml` file, replacing `LATEST_VERSION`` with the most [recent version](https://mvnrepository.com/artifact/io.github.binance/binance-connector-java) available:
### Maven
Copy and paste the following dependency snippet into your `pom.xml` file, replacing `LATEST_VERSION` with the most [recent version](https://mvnrepository.com/artifact/io.github.binance/binance-connector-java) available:
```
<dependency>
<groupId>io.github.binance</groupId>
Expand All @@ -28,6 +29,18 @@ Copy and paste the following dependency snippet into your `pom.xml` file, replac
```
Next, install the dependency by executing `mvn install` in the directory where your `pom.xml` is located.

### Gradle
Copy and paste the following dependency snippet into your `build.gradle` file, replacing `LATEST_VERSION` with the most [recent version](https://mvnrepository.com/artifact/io.github.binance/binance-connector-java) available:
```
implementation 'io.github.binance:binance-connector-java:LATEST_VERSION'
```

Make sure to add the Jitpack repository to the `repositories` section of your `build.gradle` file:
```
maven { url 'https://jitpack.io' }
```
Next, install the dependency by executing `gradle dependencies` in the directory where your `build.gradle` is located.

## Examples
The examples are located under **src/test/java/examples**. Before running any of it, `PrivateConfig.java` must be set up correctly with `API_KEY` and` SECRET_KEY` or `PRIVATE_KEY_PATH` (if using RSA Keys).

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.binance</groupId>
<artifactId>binance-connector-java</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>lightweight connector to API</description>
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/binance/connector/client/SpotClient.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.binance.connector.client;

import com.binance.connector.client.impl.spot.AutoInvest;
import com.binance.connector.client.impl.spot.Blvt;
import com.binance.connector.client.impl.spot.C2C;
import com.binance.connector.client.impl.spot.Convert;
import com.binance.connector.client.impl.spot.CryptoLoans;
import com.binance.connector.client.impl.spot.Fiat;
import com.binance.connector.client.impl.spot.Futures;
import com.binance.connector.client.impl.spot.GiftCard;
import com.binance.connector.client.impl.spot.Margin;
import com.binance.connector.client.impl.spot.Market;
Expand All @@ -31,12 +29,10 @@ public interface SpotClient {
void setProxy(ProxyAuth proxy);
void unsetProxy();
AutoInvest createAutoInvest();
Blvt createBlvt();
C2C createC2C();
Convert createConvert();
CryptoLoans createCryptoLoans();
Fiat createFiat();
Futures createFutures();
GiftCard createGiftCard();
Market createMarket();
Margin createMargin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import com.binance.connector.client.SpotClient;
import com.binance.connector.client.enums.DefaultUrls;
import com.binance.connector.client.impl.spot.AutoInvest;
import com.binance.connector.client.impl.spot.Blvt;
import com.binance.connector.client.impl.spot.C2C;
import com.binance.connector.client.impl.spot.Convert;
import com.binance.connector.client.impl.spot.CryptoLoans;
import com.binance.connector.client.impl.spot.Fiat;
import com.binance.connector.client.impl.spot.Futures;
import com.binance.connector.client.impl.spot.GiftCard;
import com.binance.connector.client.impl.spot.Margin;
import com.binance.connector.client.impl.spot.Market;
Expand Down Expand Up @@ -83,11 +81,6 @@ public AutoInvest createAutoInvest() {
return new AutoInvest(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy);
}

@Override
public Blvt createBlvt() {
return new Blvt(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy);
}

@Override
public C2C createC2C() {
return new C2C(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy);
Expand All @@ -108,11 +101,6 @@ public Fiat createFiat() {
return new Fiat(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy);
}

@Override
public Futures createFutures() {
return new Futures(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy);
}

@Override
public GiftCard createGiftCard() {
return new GiftCard(baseUrl, apiKey, signatureGenerator, showLimitUsage, proxy); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
/**
* <h2>WebSocket Streams</h2>
* All stream endpoints under the
* <a href="https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams">WebSocket Market Streams</a> and
* <a href="https://binance-docs.github.io/apidocs/spot/en/#user-data-streams">User Data Streams</a>
* <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams">WebSocket Market Streams</a> and
* <a href="https://developers.binance.com/docs/binance-spot-api-docs/user-data-stream">User Data Streams</a>
* section of the API documentation will be implemented in this class.
* <br>
* Response will be returned as callback.
Expand Down Expand Up @@ -61,8 +61,8 @@ public WebSocketStreamClientImpl(String baseUrl) {
*
* @param symbol Name of the trading pair
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams">
* https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#aggregate-trade-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#aggregate-trade-streams</a>
*/
@Override
public int aggTradeStream(String symbol, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -96,8 +96,8 @@ public int aggTradeStream(String symbol, WebSocketOpenCallback onOpenCallback, W
*
* @param symbol Name of the trading pair
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#trade-streams">
* https://binance-docs.github.io/apidocs/spot/en/#trade-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#trade-streams</a>
*/
@Override
public int tradeStream(String symbol, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -132,8 +132,8 @@ public int tradeStream(String symbol, WebSocketOpenCallback onOpenCallback, WebS
* @param symbol Name of the trading pair
* @param interval Time interval for kline/candlestick
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams">
* https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#klinecandlestick-streams-for-utc">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#klinecandlestick-streams-for-utc</a>
*/
@Override
public int klineStream(String symbol, String interval, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -169,8 +169,8 @@ public int klineStream(String symbol, String interval, WebSocketOpenCallback onO
*
* @param symbol Name of the trading pair
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream">
* https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-mini-ticker-stream">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-mini-ticker-stream</a>
*/
@Override
public int miniTickerStream(String symbol, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -205,8 +205,8 @@ public int miniTickerStream(String symbol, WebSocketOpenCallback onOpenCallback,
* Update Speed: Real-time
*
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#all-market-mini-tickers-stream">
* https://binance-docs.github.io/apidocs/spot/en/#all-market-mini-tickers-stream</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-mini-tickers-stream">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-mini-tickers-stream</a>
*/
@Override
public int allMiniTickerStream(WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -238,8 +238,8 @@ public int allMiniTickerStream(WebSocketOpenCallback onOpenCallback, WebSocketMe
*
* @param symbol Name of the trading pair
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams">
* https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-ticker-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-ticker-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-ticker-streams</a>
*/
@Override
public int symbolTicker(String symbol, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -274,8 +274,8 @@ public int symbolTicker(String symbol, WebSocketOpenCallback onOpenCallback, Web
* Update Speed: Real-time
*
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#all-market-tickers-stream">
* https://binance-docs.github.io/apidocs/spot/en/#all-market-tickers-stream</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-tickers-stream">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-tickers-stream</a>
*/
@Override
public int allTickerStream(WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -307,8 +307,8 @@ public int allTickerStream(WebSocketOpenCallback onOpenCallback, WebSocketMessag
* @param symbol Name of the trading pair
* @param windowSize Window Sizes: 1h,4h
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-rolling-window-statistics-streams">
* https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-rolling-window-statistics-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-rolling-window-statistics-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-rolling-window-statistics-streams</a>
*/
public int rollingWindowTicker(String symbol, String windowSize, WebSocketMessageCallback callback) {
ParameterChecker.checkParameterType(symbol, String.class, "symbol");
Expand Down Expand Up @@ -358,8 +358,8 @@ public int rollingWindowTicker(String symbol, String windowSize, WebSocketOpenCa
*
* @param windowSize Window Sizes: 1h,4h
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#all-market-rolling-window-statistics-streams">
* https://binance-docs.github.io/apidocs/spot/en/#all-market-rolling-window-statistics-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-rolling-window-statistics-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#all-market-rolling-window-statistics-streams</a>
*/
@Override
public int allRollingWindowTicker(String windowSize, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -400,8 +400,8 @@ public int allRollingWindowTicker(String windowSize, WebSocketOpenCallback onOpe
*
* @param symbol Name of the trading pair
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams">
* https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-book-ticker-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#individual-symbol-book-ticker-streams</a>
*/
@Override
public int bookTicker(String symbol, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -437,8 +437,8 @@ public int bookTicker(String symbol, WebSocketOpenCallback onOpenCallback, WebSo
* @param levels Valid are 5, 10, or 20
* @param speed 1000ms or 100ms
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams">
* https://binance-docs.github.io/apidocs/spot/en/#partial-book-depth-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#partial-book-depth-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#partial-book-depth-streams</a>
*/
@Override
public int partialDepthStream(String symbol, int levels, int speed, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -475,8 +475,8 @@ public int partialDepthStream(String symbol, int levels, int speed, WebSocketOpe
* @param symbol Name of the trading pair
* @param speed 1000ms or 100ms
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream">
* https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream</a>
*/
@Override
public int diffDepthStream(String symbol, int speed, WebSocketMessageCallback callback) {
Expand Down Expand Up @@ -506,10 +506,10 @@ public int diffDepthStream(String symbol, int speed, WebSocketOpenCallback onOpe
* User Data Streams are accessed at /ws/&lt;listenKey&gt;
*
* @param listenKey listen key obtained from this
* <a href="https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot">endpoint</a>
* <a href="https://developers.binance.com/docs/binance-spot-api-docs/rest-api#user-data-stream-endpoints">endpoint</a>
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#user-data-streams">
* https://binance-docs.github.io/apidocs/spot/en/#user-data-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/rest-api#start-user-data-stream-user_stream">
* https://developers.binance.com/docs/binance-spot-api-docs/rest-api#start-user-data-stream-user_stream</a>
*/
@Override
public int listenUserStream(String listenKey, WebSocketMessageCallback callback) {
Expand All @@ -520,7 +520,7 @@ public int listenUserStream(String listenKey, WebSocketMessageCallback callback)
* Same as {@link #listenUserStream(String, WebSocketMessageCallback)} plus accepts callbacks for all major websocket connection events.
*
* @param listenKey listen key obtained from this
* <a href="https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot">endpoint</a>
* <a href="https://developers.binance.com/docs/binance-spot-api-docs/rest-api#user-data-stream-endpoints">endpoint</a>
* @param onOpenCallback Callback for when the websocket connection is opened
* @param onMessageCallback Callback for when a message is received
* @param onClosingCallback Callback for when the websocket connection is closing
Expand All @@ -538,8 +538,8 @@ public int listenUserStream(String listenKey, WebSocketOpenCallback onOpenCallba
*
* @param streams ArrayList of stream names to be combined <br>
* @return int - Connection ID
* @see <a href="https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams">
* https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams</a>
* @see <a href="https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams">
* https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams</a>
*/
@Override
public int combineStreams(ArrayList<String> streams, WebSocketMessageCallback callback) {
Expand Down
Loading
Loading