-
Notifications
You must be signed in to change notification settings - Fork 2k
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 #4956 from bigscoop/bitget
[bitget] Extend functionality
- Loading branch information
Showing
41 changed files
with
1,643 additions
and
9 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
.../java/org/knowm/xchange/bitget/config/converter/StringToFundingRecordStatusConverter.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,23 @@ | ||
package org.knowm.xchange.bitget.config.converter; | ||
|
||
import com.fasterxml.jackson.databind.util.StdConverter; | ||
import java.util.Locale; | ||
import org.knowm.xchange.dto.account.FundingRecord.Status; | ||
|
||
/** Converts string to {@code FundingRecord.Status} */ | ||
public class StringToFundingRecordStatusConverter extends StdConverter<String, Status> { | ||
|
||
@Override | ||
public Status convert(String value) { | ||
switch (value.toUpperCase(Locale.ROOT)) { | ||
case "PENDING": | ||
return Status.PROCESSING; | ||
case "FAIL": | ||
return Status.FAILED; | ||
case "SUCCESS": | ||
return Status.COMPLETE; | ||
default: | ||
throw new IllegalArgumentException("Can't map " + value); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
xchange-bitget/src/main/java/org/knowm/xchange/bitget/dto/account/BitgetAccountType.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,19 @@ | ||
package org.knowm.xchange.bitget.dto.account; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum BitgetAccountType { | ||
SPOT("spot"), | ||
P2P("p2p"), | ||
COIN_FUTURES("coin_futures"), | ||
USDT_FUTURES("usdt_futures"), | ||
USDC_FUTURES("usdc_futures"), | ||
CROSSED_MARGIN("crossed_margin"), | ||
ISOLATED_MARGIN("isolated_margin"); | ||
|
||
@JsonValue private final String value; | ||
} |
85 changes: 85 additions & 0 deletions
85
...et/src/main/java/org/knowm/xchange/bitget/dto/account/BitgetDepositWithdrawRecordDto.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,85 @@ | ||
package org.knowm.xchange.bitget.dto.account; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import java.math.BigDecimal; | ||
import java.time.Instant; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.extern.jackson.Jacksonized; | ||
import org.knowm.xchange.bitget.config.converter.StringToCurrencyConverter; | ||
import org.knowm.xchange.bitget.config.converter.StringToFundingRecordStatusConverter; | ||
import org.knowm.xchange.currency.Currency; | ||
import org.knowm.xchange.dto.account.FundingRecord.Status; | ||
|
||
@Data | ||
@Builder | ||
@Jacksonized | ||
public class BitgetDepositWithdrawRecordDto { | ||
|
||
@JsonProperty("orderId") | ||
private String orderId; | ||
|
||
@JsonProperty("tradeId") | ||
private String tradeId; | ||
|
||
@JsonProperty("coin") | ||
@JsonDeserialize(converter = StringToCurrencyConverter.class) | ||
private Currency currency; | ||
|
||
@JsonProperty("clientOid") | ||
private String clientOid; | ||
|
||
@JsonProperty("type") | ||
private RecordType type; | ||
|
||
@JsonProperty("dest") | ||
private DepositType depositType; | ||
|
||
@JsonProperty("size") | ||
private BigDecimal size; | ||
|
||
@JsonProperty("fee") | ||
private BigDecimal fee; | ||
|
||
@JsonProperty("status") | ||
@JsonDeserialize(converter = StringToFundingRecordStatusConverter.class) | ||
private Status status; | ||
|
||
@JsonProperty("fromAddress") | ||
private String fromAddress; | ||
|
||
@JsonProperty("toAddress") | ||
private String toAddress; | ||
|
||
@JsonProperty("chain") | ||
private String chain; | ||
|
||
@JsonProperty("confirm") | ||
private Integer confirmCount; | ||
|
||
@JsonProperty("tag") | ||
private String toAddressTag; | ||
|
||
@JsonProperty("cTime") | ||
private Instant createdAt; | ||
|
||
@JsonProperty("uTime") | ||
private Instant updatedAt; | ||
|
||
public static enum RecordType { | ||
@JsonProperty("withdraw") | ||
WITHDRAW, | ||
|
||
@JsonProperty("deposit") | ||
DEPOSIT | ||
} | ||
|
||
public static enum DepositType { | ||
@JsonProperty("on_chain") | ||
ON_CHAIN, | ||
|
||
@JsonProperty("internal_transfer") | ||
INTERNAL_TRANSFER | ||
} | ||
} |
Oops, something went wrong.