我不知道如何使用XChange java库为Poloniex Exchange的限价订单设置卖出/买入价格。
下面是初始化和我的方法放置出价,但没有价格设置。
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;
}这种方式将我的出价设置为拍卖中的最高出价,但我想设置更高的出价。有没有人知道如何自己设定买卖价格?
谢谢。
发布于 2018-03-22 22:51:36
更改:
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
https://stackoverflow.com/questions/47859952
复制相似问题