Examples of BitfinexOrderStatusResponse


Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  @Ignore
  @Test
  public void testPlaceOrder() throws IOException {

    InputStream resourceAsStream = BitfinexTradeDataJSONTest.class.getResourceAsStream("/v1/trade/example-place-order-data.json");
    BitfinexOrderStatusResponse response = new ObjectMapper().readValue(resourceAsStream, BitfinexOrderStatusResponse.class);

    assertEquals(4003264, response.getId());
    assertEquals("btcusd", response.getSymbol());
    assertEquals("bitfinex", response.getExchange());
    assertEquals(new BigDecimal("900.0"), response.getPrice());
    assertEquals(new BigDecimal("0.0"), response.getAvgExecutionPrice());
    assertEquals("sell", response.getSide());
    assertEquals("exchange limit", response.getType());
    assertEquals(new BigDecimal("1387061558.610016778"), response.getTimestamp());
    assertTrue(response.isLive());
    assertFalse(response.isCancelled());
    assertFalse(response.getWasForced());
    assertEquals(new BigDecimal("0.01"), response.getOriginalAmount());
    assertEquals(new BigDecimal("0.01"), response.getRemainingAmount());
    assertEquals(new BigDecimal("0.0"), response.getExecutedAmount());
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  @Test
  public void testCancelOrder() throws IOException {

    InputStream resourceAsStream = BitfinexTradeDataJSONTest.class.getResourceAsStream("/v1/trade/example-cancel-order-data.json");
    BitfinexOrderStatusResponse response = new ObjectMapper().readValue(resourceAsStream, BitfinexOrderStatusResponse.class);

    assertEquals(4003242, response.getId());
    assertEquals("btcusd", response.getSymbol());
    assertNull(response.getExchange());
    assertEquals(new BigDecimal("900.0"), response.getPrice());
    assertEquals(new BigDecimal("0.0"), response.getAvgExecutionPrice());
    assertEquals("sell", response.getSide());
    assertEquals("exchange limit", response.getType());
    assertEquals(new BigDecimal("1387061342.0"), response.getTimestamp());
    assertFalse(response.isLive());
    assertTrue(response.isCancelled());
    assertFalse(response.getWasForced());
    assertEquals(new BigDecimal("0.01"), response.getOriginalAmount());
    assertEquals(new BigDecimal("0.01"), response.getRemainingAmount());
    assertEquals(new BigDecimal("0.0"), response.getExecutedAmount());
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  @Test
  public void testOpenOrders() throws IOException {

    InputStream resourceAsStream = BitfinexTradeDataJSONTest.class.getResourceAsStream("/v1/trade/example-open-orders-data.json");
    BitfinexOrderStatusResponse response = new ObjectMapper().readValue(resourceAsStream, BitfinexOrderStatusResponse.class);

    assertEquals(4003242, response.getId());
    assertEquals("btcusd", response.getSymbol());
    assertNull(response.getExchange());
    assertEquals(new BigDecimal("900.0"), response.getPrice());
    assertEquals(new BigDecimal("0.0"), response.getAvgExecutionPrice());
    assertEquals("sell", response.getSide());
    assertEquals("exchange limit", response.getType());
    assertEquals(new BigDecimal("1387061342.0"), response.getTimestamp());
    assertTrue(response.isLive());
    assertFalse(response.isCancelled());
    assertFalse(response.getWasForced());
    assertEquals(new BigDecimal("0.08"), response.getOriginalAmount());
    assertEquals(new BigDecimal("0.06"), response.getRemainingAmount());
    assertEquals(new BigDecimal("0.02"), response.getExecutedAmount());
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

    String pair = BitfinexUtils.toPairString(marketOrder.getCurrencyPair());
    String type = marketOrder.getType().equals(Order.OrderType.BID) ? "buy" : "sell";
    String orderType = bitfinexOrderType.toString();

    try {
      BitfinexOrderStatusResponse newOrder =
          bitfinex.newOrder(apiKey, payloadCreator, signatureCreator, new BitfinexNewOrderRequest(String.valueOf(nextNonce()), pair, marketOrder.getTradableAmount(), BigDecimal.ONE, "bitfinex", type,
              orderType));
      return newOrder;
    } catch (BitfinexException e) {
      throw new ExchangeException(e.getMessage());
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

    else {
      request = new BitfinexNewOrderRequest(String.valueOf(nextNonce()), pair, limitOrder.getTradableAmount(), limitOrder.getLimitPrice(), "bitfinex", type, orderType);
    }

    try {
      BitfinexOrderStatusResponse newOrder = bitfinex.newOrder(apiKey, payloadCreator, signatureCreator, request);
      return newOrder;
    } catch (BitfinexException e) {
      throw new ExchangeException(e.getMessage());
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  }

  public BitfinexOrderStatusResponse getBitfinexOrderStatus(String orderId) throws IOException {

    try {
      BitfinexOrderStatusResponse orderStatus = bitfinex.orderStatus(apiKey, payloadCreator, signatureCreator, new BitfinexOrderStatusRequest(String.valueOf(nextNonce()), Integer.valueOf(orderId)));
      return orderStatus;
    } catch (BitfinexException e) {
      throw new ExchangeException(e.getMessage());
    }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  }

  @Override
  public String placeMarketOrder(MarketOrder marketOrder) throws IOException {

    BitfinexOrderStatusResponse newOrder = placeBitfinexMarketOrder(marketOrder, BitfinexOrderType.MARKET);

    return String.valueOf(newOrder.getId());
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

  }

  @Override
  public String placeLimitOrder(LimitOrder limitOrder) throws IOException {

    BitfinexOrderStatusResponse newOrder = placeBitfinexLimitOrder(limitOrder, BitfinexOrderType.LIMIT, false);

    return String.valueOf(newOrder.getId());
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.trade.BitfinexOrderStatusResponse

      boolean isCancelled = false;
      boolean wasForced = false;
      BigDecimal originalAmount = new BigDecimal("70");
      BigDecimal remainingAmount = originalAmount.subtract(new BigDecimal(i * 1));
      BigDecimal executedAmount = originalAmount.subtract(remainingAmount);
      responses[i] = new BitfinexOrderStatusResponse(i, SYMBOL, EXCHANGE, price, avgExecutionPrice, side, type, timestamp, isLive, isCancelled, wasForced, originalAmount, remainingAmount, executedAmount);
    }

    return responses;
  }
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.