本文整理了Java中org.knowm.xchange.dto.marketdata.Ticker.getCurrencyPair()
方法的一些代码示例,展示了Ticker.getCurrencyPair()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ticker.getCurrencyPair()
方法的具体详情如下:
包路径:org.knowm.xchange.dto.marketdata.Ticker
类名称:Ticker
方法名:getCurrencyPair
暂无
代码示例来源:origin: knowm/XChange
public BityTickersHolder(List<Ticker> tickers) {
for (Ticker ticker : tickers) {
mapTickers.put(ticker.getCurrencyPair(), ticker);
}
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
if (!(params instanceof CurrencyPairsParam)) {
throw new IllegalArgumentException("Params must be instance of CurrencyPairsParam");
}
Collection<CurrencyPair> pairs = ((CurrencyPairsParam) params).getCurrencyPairs();
return getAllCexIOTickers()
.stream()
.map(CexIOAdapters::adaptTicker)
.filter(ticker -> pairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
final List<CurrencyPair> currencyPairs = new ArrayList<>();
if (params instanceof CurrencyPairsParam) {
currencyPairs.addAll(((CurrencyPairsParam) params).getCurrencyPairs());
}
return getGateioTickers()
.values()
.stream()
.filter(
ticker -> currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
}
代码示例来源:origin: knowm/XChange
public Map<CurrencyPair, Ticker> tickers() throws IOException {
Map<String, Map<String, String>> tickers = exmo.ticker();
Map<CurrencyPair, Ticker> results = new HashMap<>();
for (String market : tickers.keySet()) {
CurrencyPair currencyPair = adaptMarket(market);
Ticker ticker = ExmoAdapters.adaptTicker(currencyPair, tickers.get(market));
results.put(ticker.getCurrencyPair(), ticker);
}
return results;
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
List<CurrencyPair> currencyPairs =
(params instanceof CurrencyPairsParam)
? new ArrayList<>(((CurrencyPairsParam) params).getCurrencyPairs())
: new ArrayList<>();
return getAllTickers()
.entrySet()
.stream()
.map(
entry ->
LiquiAdapters.adaptTicker(
entry.getValue(),
CurrencyPairDeserializer.getCurrencyPairFromString(entry.getKey())))
.filter(
ticker -> currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
}
代码示例来源:origin: knowm/XChange
private static void generic(Exchange bitcoinAverageExchange) throws IOException {
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = bitcoinAverageExchange.getMarketDataService();
// Get the latest ticker data showing BTC to EUR
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_EUR);
double value = ticker.getLast().doubleValue();
System.out.println("Last: " + ticker.getCurrencyPair().counter.getCurrencyCode() + "-" + value);
System.out.println("Last: " + ticker.getLast().toString());
System.out.println("Volume: " + ticker.getVolume().toString());
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
try {
List<CurrencyPair> currencyPairs =
(params instanceof CurrencyPairsParam)
? new ArrayList<>(((CurrencyPairsParam) params).getCurrencyPairs())
: new ArrayList<>();
return getBittrexMarketSummaries()
.stream()
.map(
bittrexMarketSummary ->
BittrexAdapters.adaptTicker(
bittrexMarketSummary,
BittrexUtils.toCurrencyPair(bittrexMarketSummary.getMarketName())))
.filter(
ticker ->
currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
} catch (BittrexException e) {
throw BittrexErrorAdapter.adapt(e);
}
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
try {
final List<CurrencyPair> currencyPairs = new ArrayList<>();
if (params instanceof CurrencyPairsParam) {
currencyPairs.addAll(((CurrencyPairsParam) params).getCurrencyPairs());
}
return getTickersRaw()
.stream()
.map(
livecoinTicker ->
LivecoinAdapters.adaptTicker(
livecoinTicker,
CurrencyPairDeserializer.getCurrencyPairFromString(
livecoinTicker.getSymbol())))
.filter(
ticker ->
currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
} catch (LivecoinException e) {
throw LivecoinErrorAdapter.adapt(e);
}
}
代码示例来源:origin: knowm/XChange
@Override
public List<Ticker> getTickers(Params params) throws IOException {
try {
final List<CurrencyPair> currencyPairs = new ArrayList<>();
if (params instanceof CurrencyPairsParam) {
currencyPairs.addAll(((CurrencyPairsParam) params).getCurrencyPairs());
}
return getCryptopiaMarkets()
.stream()
.map(
cryptopiaTicker ->
CryptopiaAdapters.adaptTicker(
cryptopiaTicker,
CurrencyPairDeserializer.getCurrencyPairFromString(
cryptopiaTicker.getLabel())))
.filter(
ticker ->
currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
} catch (CryptopiaException e) {
throw CryptopiaErrorAdapter.adapt(e);
}
}
代码示例来源:origin: knowm/XChange
public static void main(String[] args) throws IOException {
// Use the factory to get BitcoinCharts exchange API using default settings
Exchange bitcoinChartsExchange =
ExchangeFactory.INSTANCE.createExchange(BitcoinChartsExchange.class.getName());
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = bitcoinChartsExchange.getMarketDataService();
// Get the latest ticker data showing BTC/bitstampUSD
CurrencyPair currencyPair = new CurrencyPair("BTC", "bitstampUSD");
Ticker ticker = marketDataService.getTicker(currencyPair);
double value = ticker.getLast().doubleValue();
String currency = ticker.getCurrencyPair().counter.getCurrencyCode();
System.out.println("bitstampUSD Last: " + currency + "-" + value);
System.out.println("bitstampUSD Last: " + ticker.getLast().toString());
}
}
代码示例来源: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: knowm/XChange
Arrays.stream(dataServiceV2.getBitfinexTickers(currencyPairs))
.map(org.knowm.xchange.bitfinex.v2.BitfinexAdapters::adaptTicker)
.collect(Collectors.toMap(t -> t.getCurrencyPair(), t -> t.getLast()));
代码示例来源:origin: knowm/XChange
Arrays.stream(dataServiceV2.getBitfinexTickers(currencyPairs))
.map(org.knowm.xchange.bitfinex.v2.BitfinexAdapters::adaptTicker)
.collect(Collectors.toMap(t -> t.getCurrencyPair(), t -> t.getLast()));
代码示例来源:origin: org.knowm.xchange/xchange-cexio
@Override
public List<Ticker> getTickers(Params params) throws IOException {
if (!(params instanceof CurrencyPairsParam)) {
throw new IllegalArgumentException("Params must be instance of CurrencyPairsParam");
}
Collection<CurrencyPair> pairs = ((CurrencyPairsParam) params).getCurrencyPairs();
return getAllCexIOTickers().stream()
.map(CexIOAdapters::adaptTicker)
.filter(ticker -> pairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
}
代码示例来源:origin: org.knowm.xchange/xchange-bittrex
@Override
public List<Ticker> getTickers(Params params) throws IOException {
try {
List<CurrencyPair> currencyPairs =
(params instanceof CurrencyPairsParam)
? new ArrayList<>(((CurrencyPairsParam) params).getCurrencyPairs())
: new ArrayList<>();
return getBittrexMarketSummaries().stream()
.map(
bittrexMarketSummary ->
BittrexAdapters.adaptTicker(
bittrexMarketSummary,
BittrexUtils.toCurrencyPair(bittrexMarketSummary.getMarketName())))
.filter(
ticker ->
currencyPairs.size() == 0 || currencyPairs.contains(ticker.getCurrencyPair()))
.collect(Collectors.toList());
} catch (BittrexException e) {
throw BittrexErrorAdapter.adapt(e);
}
}
代码示例来源:origin: bitrich-info/xchange-stream
@Override
public Observable<Ticker> getTicker(CurrencyPair currencyPair, Object... args) {
return streamingService.subscribeChannel("ticker")
.map(pubSubData -> {
PoloniexMarketData marketData = new PoloniexMarketData();
marketData.setLast(new BigDecimal(pubSubData.arguments().get(1).asText()));
marketData.setLowestAsk(new BigDecimal(pubSubData.arguments().get(2).asText()));
marketData.setHighestBid(new BigDecimal(pubSubData.arguments().get(3).asText()));
marketData.setPercentChange(new BigDecimal(pubSubData.arguments().get(4).asText()));
marketData.setBaseVolume(new BigDecimal(pubSubData.arguments().get(5).asText()));
marketData.setQuoteVolume(new BigDecimal(pubSubData.arguments().get(6).asText()));
marketData.setHigh24hr(new BigDecimal(pubSubData.arguments().get(8).asText()));
marketData.setLow24hr(new BigDecimal(pubSubData.arguments().get(9).asText()));
PoloniexTicker ticker = new PoloniexTicker(marketData, PoloniexUtils.toCurrencyPair(pubSubData.arguments().get(0).asText()));
return PoloniexAdapters.adaptPoloniexTicker(ticker, ticker.getCurrencyPair());
})
.filter(ticker -> ticker.getCurrencyPair().equals(currencyPair));
}
代码示例来源:origin: org.knowm.xchange/xchange-bitfinex
Arrays.stream(dataServiceV2.getBitfinexTickers(currencyPairs))
.map(org.knowm.xchange.bitfinex.v2.BitfinexAdapters::adaptTicker)
.collect(Collectors.toMap(t -> t.getCurrencyPair(), t -> t.getLast()));
代码示例来源:origin: org.knowm.xchange/xchange-bitfinex
Arrays.stream(dataServiceV2.getBitfinexTickers(currencyPairs))
.map(org.knowm.xchange.bitfinex.v2.BitfinexAdapters::adaptTicker)
.collect(Collectors.toMap(t -> t.getCurrencyPair(), t -> t.getLast()));
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!