Skip to content

Commit

Permalink
Fix for review comment(yeah the bullshit one)
Browse files Browse the repository at this point in the history
  • Loading branch information
aligokalppeker committed Jul 22, 2021
1 parent 6f97fc0 commit 58aa082
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ public void remoteInit() throws IOException, ExchangeException {
&& exchangeSpecification.getSecretKey() != null) {
// Bitfinex does not provide any specific wallet health info
// So instead of wallet status, fetch platform status to get wallet health
Integer bitfinexPlatformStatus = dataService.getBitfinexPlatformStatus()[0];
Integer bitfinexPlatformStatusData = dataService.getBitfinexPlatformStatus()[0];
boolean bitfinexPlatformStatusPresent = bitfinexPlatformStatusData != null;
int bitfinexPlatformStatus = bitfinexPlatformStatusPresent ? bitfinexPlatformStatusData : 0;
// Additional remoteInit configuration for authenticated instances
BitfinexAccountService accountService = (BitfinexAccountService) this.accountService;
final BitfinexAccountFeesResponse accountFees = accountService.getAccountFees();
exchangeMetaData = BitfinexAdapters.adaptMetaData(accountFees, bitfinexPlatformStatus, exchangeMetaData);
exchangeMetaData = BitfinexAdapters.adaptMetaData(accountFees, bitfinexPlatformStatus,
bitfinexPlatformStatusPresent, exchangeMetaData);

BitfinexTradeService tradeService = (BitfinexTradeService) this.tradeService;
final BitfinexAccountInfosResponse[] bitfinexAccountInfos =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,18 @@ public static ExchangeMetaData adaptMetaData(
}

public static ExchangeMetaData adaptMetaData(
BitfinexAccountFeesResponse accountFeesResponse, Integer platformStatus, ExchangeMetaData metaData) {
BitfinexAccountFeesResponse accountFeesResponse, int platformStatus,
boolean platformStatusPresent,
ExchangeMetaData metaData) {
final WalletHealth health;
if (platformStatus == PLATFORM_STATUS_ONLINE) {
health = WalletHealth.ONLINE;
} else if (platformStatus == PLATFORM_STATUS_OFFLINE) {
health = WalletHealth.OFFLINE;
if (platformStatusPresent) {
if (platformStatus == PLATFORM_STATUS_ONLINE) {
health = WalletHealth.ONLINE;
} else if (platformStatus == PLATFORM_STATUS_OFFLINE) {
health = WalletHealth.OFFLINE;
} else {
health = WalletHealth.UNKNOWN;
}
} else {
health = WalletHealth.UNKNOWN;
}
Expand Down

0 comments on commit 58aa082

Please sign in to comment.