XChange java Poloniex:热卖以设定限价订单的价格

时间:2017-12-17 22:10:11

标签: java poloniex

我无法弄清楚如何使用XChange java库为Poloniex Exchange设置限价单的卖/买价。

Bellow是初始化和我放置Bids的方法,但没有设置价格。

ExchangeSpecification exSpec = new ExchangeSpecification(PoloniexExchange.class);
exSpec.setApiKey(POLONIEX_API_KEY_PROP_NAME);
exSpec.setSecretKey(POLONIEX_API_SECRET_PROP_NAME);
Exchange poloniex = ExchangeFactory.INSTANCE.createExchange(exSpec);

//-- TRADE SERVICE.
TradeService tradeService = poloniex.getTradeService();

MarketDataService marketDataService = poloniex.getMarketDataService();
Ticker ticker = marketDataService.getTicker(CURRENCY_PAIR);

private static String placeBuyLimitOrder(TradeService tradeService) throws Exception {

    LimitOrder order = new LimitOrder(OrderType.BID, MAIN_IN_TRADE.divide(oldBid, 8, RoundingMode.HALF_UP).setScale(8), CURRENCY_PAIR, null, null, oldBid.subtract(Utils.SATOSHI));
    order.setOrderFlags(null);

    String orderId = tradeService.placeLimitOrder(order);

    return orderId;
}

这种方式设定我的出价等于拍卖中的最高出价,但我想将我设置得更高。有谁知道热卖我自己设定买/卖价?

感谢。

1 个答案:

答案 0 :(得分:0)

变化:

LimitOrder order = new LimitOrder(OrderType.BID, MAIN_IN_TRADE.divide(oldBid, 8, RoundingMode.HALF_UP).setScale(8), CURRENCY_PAIR, null, null, oldBid.subtract(Utils.SATOSHI));

到:

LimitOrder order = new LimitOrder(OrderType.BID, MAIN_IN_TRADE.divide(oldBid + 0.005, 8, RoundingMode.HALF_UP).setScale(8), CURRENCY_PAIR, null, null, oldBid.subtract(Utils.SATOSHI));

如果你想要0.005更高