use of org.knowm.xchange.dto.Order.OrderType in project XChange by knowm.
the class KrakenLimitOrderDemo method generic.
private static void generic(Exchange krakenExchange) throws IOException {
TradeService tradeService = krakenExchange.getTradeService();
OrderType orderType = (OrderType.ASK);
BigDecimal tradeableAmount = new BigDecimal("0.01");
BigDecimal price = new BigDecimal("65.25");
LimitOrder limitOrder = new LimitOrder(orderType, tradeableAmount, CurrencyPair.BTC_LTC, "", null, price);
String orderID = tradeService.placeLimitOrder(limitOrder);
System.out.println("Limit Order ID: " + orderID);
}
use of org.knowm.xchange.dto.Order.OrderType in project XChange by knowm.
the class LgoAdapters method adaptUserTrade.
private static UserTrade adaptUserTrade(LgoUserTrade lgoUserTrade) {
OrderType type = adaptUserTradeType(lgoUserTrade);
CurrencyPair currencyPair = adaptProductId(lgoUserTrade.getProductId());
Date creationDate = lgoUserTrade.getCreationDate();
return new UserTrade.Builder().type(type).originalAmount(lgoUserTrade.getQuantity()).currencyPair(currencyPair).price(lgoUserTrade.getPrice()).timestamp(creationDate).id(lgoUserTrade.getId()).orderId(lgoUserTrade.getOrderId()).feeAmount(lgoUserTrade.getFees()).feeCurrency(currencyPair.counter).build();
}
use of org.knowm.xchange.dto.Order.OrderType in project XChange by knowm.
the class BitbayAdapters method createUserTrade.
private static UserTrade createUserTrade(BitbayOrder bitbayOrder) {
CurrencyPair currencyPair = new CurrencyPair(bitbayOrder.getCurrency(), bitbayOrder.getPaymentCurrency());
OrderType type = "ask".equals(bitbayOrder.getType()) ? OrderType.ASK : OrderType.BID;
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date;
try {
date = formatter.parse(bitbayOrder.getDate());
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
return new UserTrade.Builder().type(type).originalAmount(bitbayOrder.getAmount()).currencyPair(currencyPair).price(bitbayOrder.getCurrentPrice().divide(bitbayOrder.getStartAmount())).timestamp(date).id(String.valueOf(bitbayOrder.getId())).orderId(String.valueOf(bitbayOrder.getId())).build();
}
use of org.knowm.xchange.dto.Order.OrderType in project XChange by knowm.
the class CCEXAdapters method adaptOpenOrder.
public static LimitOrder adaptOpenOrder(CCEXOpenorder cCEXOpenOrder) {
OrderType type = cCEXOpenOrder.getOrderType().equalsIgnoreCase("LIMIT_SELL") ? OrderType.ASK : OrderType.BID;
String[] currencies = cCEXOpenOrder.getExchange().split("-");
CurrencyPair pair = new CurrencyPair(currencies[1], currencies[0]);
return new LimitOrder(type, cCEXOpenOrder.getQuantityRemaining(), pair, cCEXOpenOrder.getOrderUuid(), null, cCEXOpenOrder.getLimit());
}
use of org.knowm.xchange.dto.Order.OrderType in project XChange by knowm.
the class CCEXAdapters method adaptCCEXPublicTrade.
public static Trade adaptCCEXPublicTrade(CCEXTrade cCEXTrade, CurrencyPair currencyPair) {
OrderType type = cCEXTrade.getOrderType().equalsIgnoreCase("BUY") ? OrderType.BID : OrderType.ASK;
Date timestamp = stringToDate(cCEXTrade.getTimestamp());
return new Trade.Builder().type(type).originalAmount(cCEXTrade.getQuantity()).currencyPair(currencyPair).price(cCEXTrade.getPrice()).timestamp(timestamp).id(cCEXTrade.getId()).build();
}
Aggregations