Skip to content

Commit

Permalink
Merge branch 'develop' into binance_implement_channel_inactive_listener
Browse files Browse the repository at this point in the history
  • Loading branch information
rizer1980 committed Jul 31, 2023
2 parents 3fddeab + 916b9a6 commit aef519b
Show file tree
Hide file tree
Showing 47 changed files with 647 additions and 221 deletions.
583 changes: 583 additions & 0 deletions .idea/codeStyles/Project.xml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<version.java>1.8</version.java>
<version.assertj>3.23.1</version.assertj>
<version.assertj>3.24.2</version.assertj>
<version.commons.lang3>3.12.0</version.commons.lang3>
<version.fasterxml>2.14.1</version.fasterxml>
<version.github.mmazi>2.1.0</version.github.mmazi>
<version.resilience4j>1.7.0</version.resilience4j>
<version.junit>4.13.2</version.junit>
<version.lombok>1.18.22</version.lombok>
<version.lombok>1.18.26</version.lombok>
<version.knowm.xchart>3.8.2</version.knowm.xchart>
<version.qos.logback>1.4.5</version.qos.logback>
<version.reflections>0.10.2</version.reflections>
<version.slf4j>2.0.6</version.slf4j>
<version.crypto>5.0.0</version.crypto>
<version.java-jwt>3.19.2</version.java-jwt>
<version.java-jwt>4.0.0</version.java-jwt>

<skipIntegrationTests>true</skipIntegrationTests>
</properties>
Expand Down Expand Up @@ -333,14 +333,6 @@
<version>${version.qos.logback}</version>
</dependency>

<!-- Lombok for boilerplate -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${version.lombok}</version>
<scope>provided</scope>
</dependency>

<!-- jwt for auth -->
<dependency>
<groupId>com.auth0</groupId>
Expand All @@ -363,7 +355,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.86.Final</version>
<version>4.1.90.Final</version>
</dependency>

</dependencies>
Expand Down Expand Up @@ -407,6 +399,14 @@
<scope>test</scope>
</dependency>

<!-- Lombok for boilerplate -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${version.lombok}</version>
<scope>provided</scope>
</dependency>

</dependencies>

<profiles>
Expand Down Expand Up @@ -539,13 +539,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.0.0</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.0.0</version>
<executions>
<execution>
<goals>
Expand Down
7 changes: 2 additions & 5 deletions xchange-bibox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>

</dependencies>
</project>
5 changes: 1 addition & 4 deletions xchange-binance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class BinanceExchange extends BaseExchange implements Exchange {
public static final String SPECIFIC_PARAM_USE_SANDBOX = "Use_Sandbox";
public static final String SPECIFIC_PARAM_USE_FUTURES_SANDBOX = "Use_Sandbox_Futures";
public static final String SPECIFIC_PARAM_FUTURES_ENABLED = "Futures_Enabled";

private static final String SPOT_URL = "https://api.binance.com";
public static final String FUTURES_URL = "https://fapi.binance.com";
Expand Down Expand Up @@ -77,6 +78,11 @@ public boolean isFuturesSandbox(){
exchangeSpecification.getExchangeSpecificParametersItem(SPECIFIC_PARAM_USE_FUTURES_SANDBOX));
}

public boolean isFuturesEnabled(){
return Boolean.TRUE.equals(
exchangeSpecification.getExchangeSpecificParametersItem(SPECIFIC_PARAM_FUTURES_ENABLED));
}

public boolean usingSandbox() {
return enabledSandbox(exchangeSpecification);
}
Expand All @@ -101,7 +107,9 @@ public void remoteInit() {
}
} else {
exchangeMetaData = BinanceAdapters.adaptExchangeMetaData(marketDataService.getExchangeInfo(), assetDetailMap);
BinanceAdapters.adaptFutureExchangeMetaData(exchangeMetaData, marketDataService.getFutureExchangeInfo());
if(isFuturesEnabled()){
BinanceAdapters.adaptFutureExchangeMetaData(exchangeMetaData, marketDataService.getFutureExchangeInfo());
}
}

} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ public AccountInfo getAccountInfo() throws IOException {
wallets.add(BinanceAdapters.adaptBinanceSpotWallet(account()));
}
} else {
BinanceFutureAccountInformation futureAccountInformation = futuresAccount();
if(exchange.isFuturesEnabled()){
BinanceFutureAccountInformation futureAccountInformation = futuresAccount();
wallets.add(BinanceAdapters.adaptBinanceFutureWallet(futureAccountInformation));
openPositions.addAll(BinanceAdapters.adaptOpenPositions(futureAccountInformation.getPositions()));
}
wallets.add(BinanceAdapters.adaptBinanceSpotWallet(account()));
wallets.add(BinanceAdapters.adaptBinanceFutureWallet(futureAccountInformation));
openPositions.addAll(BinanceAdapters.adaptOpenPositions(futureAccountInformation.getPositions()));

}
return new AccountInfo(
exchange.getExchangeSpecification().getUserName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private String placeOrderAllProducts(
order.hasFlag(
org.knowm.xchange.binance.dto.trade.BinanceOrderFlags.REDUCE_ONLY),
limitPrice,
getClientOrderId(order),
order.getUserReference(),
stopPrice,
false,
null,
Expand All @@ -157,7 +157,7 @@ private String placeOrderAllProducts(
order.getOriginalAmount(),
quoteOrderQty,
limitPrice,
getClientOrderId(order),
order.getUserReference(),
stopPrice,
trailingDelta,
null,
Expand Down Expand Up @@ -193,7 +193,7 @@ public void placeTestOrder(
order.getOriginalAmount(),
quoteOrderQty,
limitPrice,
getClientOrderId(order),
order.getUserReference(),
stopPrice,
trailingDelta,
null);
Expand All @@ -202,20 +202,6 @@ public void placeTestOrder(
}
}

private String getClientOrderId(Order order) {

String clientOrderId = null;
for (IOrderFlags flags : order.getOrderFlags()) {
if (flags instanceof BinanceOrderFlags) {
BinanceOrderFlags bof = (BinanceOrderFlags) flags;
if (clientOrderId == null) {
clientOrderId = bof.getClientId();
}
}
}
return clientOrderId;
}

@Override
public boolean cancelOrder(CancelOrderParams params) throws IOException {
try {
Expand Down
2 changes: 1 addition & 1 deletion xchange-binance/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</appender>


<root level="WARN">
<root level="DEBUG">
<appender-ref ref="CONSOLE_APPENDER"/>
</root>

Expand Down
4 changes: 0 additions & 4 deletions xchange-bitbay/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

Expand Down
4 changes: 0 additions & 4 deletions xchange-bitcoinde/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
5 changes: 1 addition & 4 deletions xchange-bitfinex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 1 addition & 4 deletions xchange-bitmex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>
</project>
6 changes: 0 additions & 6 deletions xchange-bitstamp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
<!-- Parent provides default configuration for dependencies -->
<dependencies>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-core</artifactId>
Expand Down
5 changes: 1 addition & 4 deletions xchange-bittrex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 1 addition & 4 deletions xchange-blockchain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions xchange-bybit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
<!-- Parent provides default configuration for dependencies -->
<dependencies>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-core</artifactId>
Expand Down
5 changes: 1 addition & 4 deletions xchange-coinbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 0 additions & 5 deletions xchange-coinbasepro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
<artifactId>wiremock-jre8</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 0 additions & 5 deletions xchange-coincheck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>

</dependencies>

Expand Down
5 changes: 0 additions & 5 deletions xchange-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,5 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>
</project>
5 changes: 0 additions & 5 deletions xchange-cryptowatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>

</project>
5 changes: 1 addition & 4 deletions xchange-deribit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<artifactId>xchange-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>
</project>
6 changes: 1 addition & 5 deletions xchange-dydx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
<artifactId>xchange-dydx</artifactId>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-core</artifactId>
Expand Down
Loading

0 comments on commit aef519b

Please sign in to comment.