Search in sources :

Example 1 with BitfinexTradeServiceRaw

use of org.knowm.xchange.bitfinex.service.BitfinexTradeServiceRaw in project XChange by knowm.

the class BitfinexOfferDemo method raw.

private static void raw(Exchange bfx) throws IOException {
    BitfinexTradeServiceRaw tradeService = (BitfinexTradeServiceRaw) bfx.getTradeService();
    BitfinexOfferStatusResponse fixedRateResponse = tradeService.placeBitfinexFixedRateLoanOrder(new FixedRateLoanOrder(OrderType.BID, "USD", new BigDecimal("0.01"), 2, "", null, new BigDecimal("0.01")), BitfinexOrderType.LIMIT);
    System.out.println("Fixed rate order response: " + fixedRateResponse);
    BitfinexOfferStatusResponse floatingRateResponse = tradeService.placeBitfinexFloatingRateLoanOrder(new FloatingRateLoanOrder(OrderType.BID, "USD", new BigDecimal("0.01"), 2, "", null, BigDecimal.ZERO), BitfinexOrderType.MARKET);
    System.out.println("Floating rate order response: " + floatingRateResponse);
    BitfinexCreditResponse[] activeCredits = tradeService.getBitfinexActiveCredits();
    System.out.println("Active credits: " + Arrays.toString(activeCredits));
    BitfinexOfferStatusResponse[] openOffers = tradeService.getBitfinexOpenOffers();
    System.out.println("Open offers response: " + Arrays.toString(openOffers));
    for (BitfinexOfferStatusResponse offer : openOffers) {
        BitfinexOfferStatusResponse cancelResponse = tradeService.cancelBitfinexOffer(Long.toString(offer.getId()));
        System.out.println("Cancel offer response: " + cancelResponse);
    }
}
Also used : FixedRateLoanOrder(org.knowm.xchange.dto.trade.FixedRateLoanOrder) BitfinexOfferStatusResponse(org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexOfferStatusResponse) BitfinexCreditResponse(org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexCreditResponse) BitfinexTradeServiceRaw(org.knowm.xchange.bitfinex.service.BitfinexTradeServiceRaw) BigDecimal(java.math.BigDecimal) FloatingRateLoanOrder(org.knowm.xchange.dto.trade.FloatingRateLoanOrder)

Example 2 with BitfinexTradeServiceRaw

use of org.knowm.xchange.bitfinex.service.BitfinexTradeServiceRaw in project XChange by knowm.

the class BitfinexTradeDemo method raw.

private static void raw(Exchange bfx) throws IOException {
    /*
    BitfinexTradeServiceRaw tradeService = (BitfinexTradeServiceRaw) bfx.getTradeService();
    LimitOrder limitOrder = new LimitOrder.Builder(OrderType.BID, CurrencyPair.BTC_USD).limitPrice(new BigDecimal("481.69"))
        .originalAmount(new BigDecimal("0.001")).build();
    tradeService.placeBitfinexLimitOrder(limitOrder, BitfinexOrderType.LIMIT);
    */
    BitfinexTradeServiceRaw tradeService = (BitfinexTradeServiceRaw) bfx.getTradeService();
    Date tenDaysAgo = Date.from(LocalDate.now().minusDays(10).atStartOfDay(ZoneId.systemDefault()).toInstant());
    BitfinexFundingTradeResponse[] fundingTradeResponses = tradeService.getBitfinexFundingHistory("USD", tenDaysAgo, 2000);
}
Also used : BitfinexFundingTradeResponse(org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexFundingTradeResponse) BitfinexTradeServiceRaw(org.knowm.xchange.bitfinex.service.BitfinexTradeServiceRaw) Date(java.util.Date) LocalDate(java.time.LocalDate)

Aggregations

BitfinexTradeServiceRaw (org.knowm.xchange.bitfinex.service.BitfinexTradeServiceRaw)2 BigDecimal (java.math.BigDecimal)1 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 BitfinexCreditResponse (org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexCreditResponse)1 BitfinexFundingTradeResponse (org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexFundingTradeResponse)1 BitfinexOfferStatusResponse (org.knowm.xchange.bitfinex.v1.dto.trade.BitfinexOfferStatusResponse)1 FixedRateLoanOrder (org.knowm.xchange.dto.trade.FixedRateLoanOrder)1 FloatingRateLoanOrder (org.knowm.xchange.dto.trade.FloatingRateLoanOrder)1