您好我试图从xchange库中使用bitfinex自动收录器:http://knowm.org/open-source/xchange/
我试图使用其中一个示例代码,但它不适合我
import java.io.IOException;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.bitfinex.v1.BitfinexExchange;
import org.knowm.xchange.bitfinex.v1.dto.marketdata.BitfinexTicker;
import org.knowm.xchange.bitfinex.v1.service.BitfinexMarketDataServiceRaw;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.marketdata.Ticker;
import org.knowm.xchange.service.marketdata.MarketDataService;
/**
* Demonstrate requesting Order Book at Bitfinex
*/
public class TickerDemo {
public static void main(String[] args) throws Exception {
// Use the factory to get Bitfinex exchange API using default settings
Exchange bitfinex = ExchangeFactory.INSTANCE.createExchange(BitfinexExchange.class.getName());
//Exchange bitfinex = ExchangeFactory.INSTANCE.createExchangeWithoutSpecification(BitfinexExchange.class.getName());
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = bitfinex.getMarketDataService();
generic(marketDataService);
raw((BitfinexMarketDataServiceRaw) marketDataService);
}
private static void generic(MarketDataService marketDataService) throws IOException {
// Get the latest ticker data showing BTC to USD
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);
System.out.println("generic " + ticker.toString());
}
private static void raw(BitfinexMarketDataServiceRaw marketDataService) throws IOException {
// Get the latest ticker data showing BTC to USD
BitfinexTicker ticker = marketDataService.getBitfinexTicker("btcusd");
System.out.println("raw " + ticker.toString());
}
}
编译时出错:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at org.knowm.xchange.ExchangeFactory.<init>(ExchangeFactory.java:21)
at org.knowm.xchange.ExchangeFactory.<clinit>(ExchangeFactory.java:18)
at TickerDemo.main(TickerDemo.java:21)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
我已经将库上传到我的项目中,无法看到导入的任何错误,所以它应该工作正常,但由于某种原因它没有。使用Intellij