Examples of CurrencyPair


Examples of com.opengamma.financial.currency.CurrencyPair

        public CurrencyAmount visitFXOptionSecurity(final FXOptionSecurity security) {
          final Currency currency1 = security.getPutCurrency();
          final double amount1 = security.getPutAmount();
          final Currency currency2 = security.getCallCurrency();
          final double amount2 = security.getCallAmount();
          final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
          if (currencyPair.getBase().equals(currency1)) {
            return CurrencyAmount.of(currency1, amount1);
          }
          return CurrencyAmount.of(currency2, amount2);
        }

        @Override
        public CurrencyAmount visitFXBarrierOptionSecurity(final FXBarrierOptionSecurity security) {
          final Currency currency1 = security.getPutCurrency();
          final double amount1 = security.getPutAmount();
          final Currency currency2 = security.getCallCurrency();
          final double amount2 = security.getCallAmount();
          final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
          if (currencyPair.getBase().equals(currency1)) {
            return CurrencyAmount.of(currency1, amount1);
          }
          return CurrencyAmount.of(currency2, amount2);
        }

        @Override
        public CurrencyAmount visitNonDeliverableFXOptionSecurity(final NonDeliverableFXOptionSecurity security) {
          final Currency currency = security.getDeliveryCurrency();
          final double amount = security.getCallCurrency().equals(currency) ? security.getCallAmount() : security.getPutAmount();
          return CurrencyAmount.of(currency, amount);
        }

        @Override
        public CurrencyAmount visitFXDigitalOptionSecurity(final FXDigitalOptionSecurity security) {
          final Currency currency1 = security.getPutCurrency();
          final double amount1 = security.getPutAmount();
          final Currency currency2 = security.getCallCurrency();
          final double amount2 = security.getCallAmount();
          final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
          if (currencyPair.getBase().equals(currency1)) {
            return CurrencyAmount.of(currency1, amount1);
          }
          return CurrencyAmount.of(currency2, amount2);
        }

        @Override
        public CurrencyAmount visitNonDeliverableFXDigitalOptionSecurity(final NonDeliverableFXDigitalOptionSecurity security) {
          final Currency currency = security.getPaymentCurrency();
          final double amount = security.getCallCurrency().equals(currency) ? security.getCallAmount() : security.getPutAmount();
          return CurrencyAmount.of(currency, amount);
        }

        @Override
        public CurrencyAmount visitFXForwardSecurity(final FXForwardSecurity security) {
          final Currency currency1 = security.getPayCurrency();
          final double amount1 = security.getPayAmount();
          final Currency currency2 = security.getReceiveCurrency();
          final double amount2 = security.getReceiveAmount();
          final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
          if (currencyPair.getBase().equals(currency1)) {
            return CurrencyAmount.of(currency1, amount1);
          }
          return CurrencyAmount.of(currency2, amount2);
        }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    return new OrderBook(null, asks, bids);
  }

  public static CurrencyPair adaptCurrencyPair(final String justcoinMarket) {

    return new CurrencyPair(justcoinMarket.substring(0, 3), justcoinMarket.substring(3));
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  @Override
  public synchronized Collection<CurrencyPair> getExchangeSymbols() throws IOException {

    if (currencyPairs.isEmpty()) {
      for (final JustcoinTicker ticker : justcoin.getTickers()) {
        final CurrencyPair currencyPair = JustcoinAdapters.adaptCurrencyPair(ticker.getId());
        currencyPairs.add(currencyPair);
      }
    }

    return currencyPairs;
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    List<LimitOrder> limitOrders = new ArrayList<LimitOrder>();
    for (VosTradeOrder vosOrder : openOrders) {
      OrderType orderType = vosOrder.getType().equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;
      String id = Integer.toString(vosOrder.getOrder_id());
      BigDecimal price = vosOrder.getPrice().getValue();
      CurrencyPair currPair = new CurrencyPair(vosOrder.getOrder_currency(), vosOrder.getPayment_currency());

      limitOrders.add(new LimitOrder(orderType, vosOrder.getUnits().getValue(), currPair, id, DateUtils.fromMillisUtc(vosOrder.getOrder_date() / 1000L), price));
    }

    return new OpenOrders(limitOrders);
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  }

  public static CurrencyPair adaptCurrencyPair(String symbol) {

    return new CurrencyPair(symbol.substring(0, 3), symbol.substring(3, 6));
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    List<UserTrade> trades = new ArrayList<UserTrade>();
    for (VosTradeOrder order : vosUserTransactions) {

      OrderType orderType = order.getType().equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;
      CurrencyPair currPair = new CurrencyPair(order.getOrder_currency(), order.getPayment_currency());

      final String orderId = String.valueOf(order
          .getOrder_id());
      final Date timestamp = DateUtils.fromMillisUtc(order.getDate_completed() / 1000L);
      final BigDecimal price = order.getPrice().getValue();
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    BTERMarketInfoWrapper marketInfoWrapper = mapper.readValue(is, BTERMarketInfoWrapper.class);

    Map<CurrencyPair, BTERMarketInfo> marketInfoMap = marketInfoWrapper.getMarketInfoMap();
    assertThat(marketInfoMap).hasSize(2);

    CurrencyPair pair = new CurrencyPair("LTC", "CNY");
    BTERMarketInfo marketInfo = marketInfoMap.get(pair);
    assertThat(marketInfo.getCurrencyPair()).isEqualTo(pair);
    assertThat(marketInfo.getDecimalPlaces()).isEqualTo(2);
    assertThat(marketInfo.getMinAmount()).isEqualTo(".5");
    assertThat(marketInfo.getFee()).isEqualTo("0");
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    BTERCurrencyPairs currencyPairs = mapper.readValue(is, BTERCurrencyPairs.class);

    Collection<CurrencyPair> pairs = currencyPairs.getPairs();
    assertThat(pairs).hasSize(83);

    assertThat(pairs.contains(new CurrencyPair("TIPS", "CNY"))).isTrue();
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosDepth.class);
    VosResponse<VosDepth> VaultOfSatoshiDepth = mapper.readValue(is, type);

    List<LimitOrder> asks = VaultOfSatoshiAdapters.adaptOrders(VaultOfSatoshiDepth.getData().getAsks(), new CurrencyPair("BTC", "USD"), "ask", "");

    // Verify all fields filled
    assertThat(asks.get(0).getLimitPrice().doubleValue()).isEqualTo(682.00);
    assertThat(asks.get(0).getType()).isEqualTo(OrderType.ASK);
    assertThat(asks.get(0).getTradableAmount().doubleValue()).isEqualTo(0.22000000);
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  }

  @Override
  public UserTrades getTradeHistory(Object... arguments) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    CurrencyPair currencyPair = null;
    Long startTime = null;
    Long endTime = null;

    if (arguments != null) {
      switch (arguments.length) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.