Package com.xeiam.xchange.coinbase.dto.marketdata

Examples of com.xeiam.xchange.coinbase.dto.marketdata.CoinbaseMoney


  }

  public static UserTrade adaptTrade(final CoinbaseTransfer transfer) {

    final OrderType orderType = adaptOrderType(transfer.getType());
    final CoinbaseMoney btcAmount = transfer.getBtcAmount();
    final BigDecimal tradableAmount = btcAmount.getAmount();
    final String tradableIdentifier = btcAmount.getCurrency();
    final CoinbaseMoney subTotal = transfer.getSubtotal();
    final String transactionCurrency = subTotal.getCurrency();
    final BigDecimal price = subTotal.getAmount().divide(tradableAmount, RoundingMode.HALF_EVEN);
    final Date timestamp = transfer.getCreatedAt();
    final String id = transfer.getTransactionId();
    final BigDecimal feeAmount = transfer.getCoinbaseFee().getAmount();
    final String feeCurrency = transfer.getCoinbaseFee().getCurrency();
View Full Code Here


   * @return A {@code CoinbaseAmount} wrapper around a {@code CoinbaseMoney} object representing the current user's balance.
   * @throws IOException
   */
  public CoinbaseMoney getCoinbaseBalance() throws IOException {

    final CoinbaseMoney balance = coinbase.getBalance(exchangeSpecification.getApiKey(), signatureCreator, getNonce());
    return balance;
  }
View Full Code Here

    }

    @Override
    public CoinbaseMoney getAmount() {

      return new CoinbaseMoney(currencyIso, new BigDecimal(amountString));
    }
View Full Code Here

  public Ticker getTicker(final CurrencyPair currencyPair, final Object... args) throws IOException {

    final String currency = currencyPair.counterSymbol;
    final CoinbasePrice buyPrice = super.getCoinbaseBuyPrice(BigDecimal.ONE, currency);
    final CoinbasePrice sellPrice = super.getCoinbaseSellPrice(BigDecimal.ONE, currency);
    final CoinbaseMoney spotRate = super.getCoinbaseSpotRate(currency);

    final CoinbaseSpotPriceHistory coinbaseSpotPriceHistory =
        (args != null && args.length > 0 && args[0] != null && args[0] instanceof Boolean && (Boolean) args[0]) ? super.getCoinbaseHistoricalSpotRates() : null;

    return CoinbaseAdapters.adaptTicker(currencyPair, buyPrice, sellPrice, spotRate, coinbaseSpotPriceHistory);
View Full Code Here

    final String amount = node.path("cents").asText();
    final String currency = node.path("currency_iso").asText();
    final int numDecimals = (currency.equalsIgnoreCase("BTC")) ? 8 : 2;

    return new CoinbaseMoney(currency, new BigDecimal(amount).movePointLeft(numDecimals));
  }
View Full Code Here

  public static CoinbaseMoney getCoinbaseMoneyFromNode(final JsonNode node) {

    final String amount = node.path("amount").asText();
    final String currency = node.path("currency").asText();

    return new CoinbaseMoney(currency, new BigDecimal(amount));
  }
View Full Code Here

    System.out.println("Buy Price for " + amount + " BTC: " + buyPrice);

    CoinbasePrice sellPrice = marketDataService.getCoinbaseSellPrice();
    System.out.println("Sell Price: " + sellPrice);

    CoinbaseMoney spotRate = marketDataService.getCoinbaseSpotRate("EUR");
    System.out.println("Spot Rate: " + spotRate);

    int page = 2;
    CoinbaseSpotPriceHistory spotPriceHistory = marketDataService.getCoinbaseHistoricalSpotRates(page);
    List<CoinbaseHistoricalSpotPrice> spotPriceHistoryList = spotPriceHistory.getSpotPriceHistory();
View Full Code Here

    private String price4;
    private String price5;

    public CoinbaseButtonBuilder(final String name, final String currency, final String priceString) {

      this(name, new CoinbaseMoney(currency, new BigDecimal(priceString)));
    }
View Full Code Here

      final String fundingType = transferNode.path("_type").asText();
      final CoinbaseTransferType type = CoinbaseTransferType.valueOf(transferNode.path("type").asText().toUpperCase());
      final String code = transferNode.path("code").asText();
      final Date createdAt = DateUtils.fromISO8601DateString(transferNode.path("created_at").asText());
      final JsonNode feesNode = transferNode.path("fees");
      final CoinbaseMoney coinbaseFee = CoinbaseCentsDeserializer.getCoinbaseMoneyFromCents(feesNode.path("coinbase"));
      final CoinbaseMoney bankFee = CoinbaseCentsDeserializer.getCoinbaseMoneyFromCents(feesNode.path("bank"));
      final Date payoutDate = DateUtils.fromISO8601DateString(transferNode.path("payout_date").asText());
      final String transactionId = transferNode.path("transaction_id").asText();
      final CoinbaseTransferStatus status = CoinbaseTransferStatus.valueOf(transferNode.path("status").asText().toUpperCase());
      final CoinbaseMoney btcAmount = CoinbaseMoneyDeserializer.getCoinbaseMoneyFromNode(transferNode.path("btc"));
      final CoinbaseMoney subtotal = CoinbaseMoneyDeserializer.getCoinbaseMoneyFromNode(transferNode.path("subtotal"));
      final CoinbaseMoney total = CoinbaseMoneyDeserializer.getCoinbaseMoneyFromNode(transferNode.path("total"));
      final String description = transferNode.path("description").asText();

      return new CoinbaseTransfer(id, type, fundingType, code, createdAt, coinbaseFee, bankFee, payoutDate, transactionId, status, btcAmount, subtotal, total, description, success, errors);
    }
View Full Code Here

    InputStream is = CoinbaseAdapterTest.class.getResourceAsStream("/marketdata/example-price-data.json");
    ObjectMapper mapper = new ObjectMapper();
    CoinbasePrice price = mapper.readValue(is, CoinbasePrice.class);

    CoinbaseMoney spotPrice = new CoinbaseMoney(Currencies.USD, new BigDecimal("719.79"));

    is = CoinbaseAdapterTest.class.getResourceAsStream("/marketdata/example-spot-rate-history-data.json");
    String spotPriceHistoryString;
    Scanner scanner = null;
    try {
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.coinbase.dto.marketdata.CoinbaseMoney

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.