-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4931 from bigscoop/exchange-health
[general] Add getting of exchange health
- Loading branch information
Showing
12 changed files
with
145 additions
and
16 deletions.
There are no files selected for viewing
20 changes: 11 additions & 9 deletions
20
xchange-binance/src/main/java/org/knowm/xchange/binance/dto/meta/BinanceSystemStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package org.knowm.xchange.binance.dto.meta; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Value; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
@Value | ||
@Builder | ||
@Jacksonized | ||
public class BinanceSystemStatus { | ||
|
||
// 0: normal,1:system maintenance | ||
@JsonProperty private String status; | ||
// normal or system maintenance | ||
@JsonProperty private String msg; | ||
@JsonProperty | ||
String status; | ||
|
||
public String getStatus() { | ||
return status; | ||
} | ||
// normal or system maintenance | ||
@JsonProperty | ||
String msg; | ||
|
||
public String getMsg() { | ||
return msg; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
xchange-core/src/main/java/org/knowm/xchange/dto/meta/ExchangeHealth.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.knowm.xchange.dto.meta; | ||
|
||
public enum ExchangeHealth { | ||
ONLINE, | ||
OFFLINE, | ||
|
||
/** | ||
* Can only cancel the order but not place order | ||
*/ | ||
CANCEL_ONLY; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
xchange-gateio-v4/src/main/java/org/knowm/xchange/gateio/config/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...nge-gateio-v4/src/main/java/org/knowm/xchange/gateio/dto/marketdata/GateioServerTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.knowm.xchange.gateio.dto.marketdata; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.time.Instant; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
@Data | ||
@Builder | ||
@Jacksonized | ||
public class GateioServerTime { | ||
|
||
@JsonProperty("server_time") | ||
Instant time; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...v4/src/test/java/org/knowm/xchange/gateio/service/GateioMarketDataServiceIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.knowm.xchange.gateio.service; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.knowm.xchange.ExchangeFactory; | ||
import org.knowm.xchange.dto.meta.ExchangeHealth; | ||
import org.knowm.xchange.gateio.GateioExchange; | ||
|
||
class GateioMarketDataServiceIntegration { | ||
|
||
GateioExchange exchange = ExchangeFactory.INSTANCE.createExchange(GateioExchange.class); | ||
|
||
@Test | ||
void exchange_health() { | ||
ExchangeHealth actual = exchange.getMarketDataService().getExchangeHealth(); | ||
assertThat(actual).isEqualTo(ExchangeHealth.ONLINE); | ||
} | ||
|
||
} |