本文整理了Java中org.knowm.xchange.dto.marketdata.Ticker.getTimestamp()
方法的一些代码示例,展示了Ticker.getTimestamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ticker.getTimestamp()
方法的具体详情如下:
包路径:org.knowm.xchange.dto.marketdata.Ticker
类名称:Ticker
方法名:getTimestamp
暂无
代码示例来源:origin: knowm/XChange
public static void main(String[] args) throws IOException {
// Use the factory to get Cex.IO exchange API using default settings
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(AbucoinsExchange.class.getName());
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = exchange.getMarketDataService();
// Get the latest ticker data showing BTC to USD
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
System.out.println("Pair: " + ticker.getCurrencyPair());
System.out.println("Last: " + ticker.getLast());
System.out.println("Volume: " + ticker.getVolume());
System.out.println("High: " + ticker.getHigh());
System.out.println("Low: " + ticker.getLow());
System.out.println("Bid: " + ticker.getBid());
System.out.println("Ask: " + ticker.getAsk());
System.out.println("Timestamp: " + ticker.getTimestamp());
}
}
代码示例来源:origin: knowm/XChange
public static void main(String[] args) throws IOException {
// Use the factory to get Cex.IO exchange API using default settings
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CexIOExchange.class.getName());
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = exchange.getMarketDataService();
// Get the latest ticker data showing BTC to USD
Ticker ticker = marketDataService.getTicker(new CurrencyPair(Currency.BTC, Currency.USD));
System.out.println("Pair: " + ticker.getCurrencyPair());
System.out.println("Last: " + ticker.getLast());
System.out.println("Volume: " + ticker.getVolume());
System.out.println("High: " + ticker.getHigh());
System.out.println("Low: " + ticker.getLow());
System.out.println("Bid: " + ticker.getBid());
System.out.println("Ask: " + ticker.getAsk());
System.out.println("Timestamp: " + ticker.getTimestamp());
}
}
代码示例来源:origin: ConsensusJ/consensusj
private ExchangeRateChange buildExchangeRateChange(CurrencyUnitPair pair, Ticker ticker) {
Date date = ticker.getTimestamp();
// Not all exchanges provide a timestamp, default to 0 if it is null
long milliseconds = (date != null) ? date.getTime() : 0;
return new ExchangeRateChange(buildExchangeRate(pair, ticker), milliseconds);
}
代码示例来源:origin: org.knowm.xchange/xchange-btcchina
public static Ticker adaptUpdate(Ticker ticker, MarketDataIncrementalRefresh message) throws FieldNotFound {
Ticker.Builder tickerBuilder = new Ticker.Builder().currencyPair(ticker.getCurrencyPair()).timestamp(ticker.getTimestamp()).bid(ticker.getBid())
.ask(ticker.getAsk()).last(ticker.getLast()).high(ticker.getHigh()).low(ticker.getLow()).volume(ticker.getVolume());
int noMDEntries = message.getNoMDEntries().getValue();
for (int i = 1; i <= noMDEntries; i++) {
Group group = message.getGroup(i, NoMDEntries.FIELD);
adapt(tickerBuilder, group);
}
return tickerBuilder.build();
}
内容来源于网络,如有侵权,请联系作者删除!