All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.knowm.xchange.binance.dto.account.BinanceBalance Maven / Gradle / Ivy

The newest version!
package org.knowm.xchange.binance.dto.account;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import org.knowm.xchange.currency.Currency;

public final class BinanceBalance {

  private final Currency currency;
  private final BigDecimal free;
  private final BigDecimal locked;

  public BinanceBalance(
      @JsonProperty("asset") String asset,
      @JsonProperty("free") BigDecimal free,
      @JsonProperty("locked") BigDecimal locked) {
    this.currency = Currency.getInstance(asset);
    this.locked = locked;
    this.free = free;
  }

  public Currency getCurrency() {
    return currency;
  }

  public BigDecimal getTotal() {
    return free.add(locked);
  }

  public BigDecimal getAvailable() {
    return free;
  }

  public BigDecimal getLocked() {
    return locked;
  }

  public String toString() {
    return "[" + currency + ", free=" + free + ", locked=" + locked + "]";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy