本文整理汇总了Java中org.knowm.xchange.Exchange类的典型用法代码示例。如果您正苦于以下问题:Java Exchange类的具体用法?Java Exchange怎么用?Java Exchange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Exchange类属于org.knowm.xchange包,在下文中一共展示了Exchange类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: FreqTradeExchangeServiceImpl
import org.knowm.xchange.Exchange; //导入依赖的package包/类
@Autowired
public FreqTradeExchangeServiceImpl(FreqTradeProperties properties, Exchange exchange) {
this.properties = properties;
this.exchange = exchange;
marketDataService = (BittrexMarketDataService) exchange.getMarketDataService();
accountService = exchange.getAccountService();
tradeService = exchange.getTradeService();
if (properties.isDryRun()) {
LOGGER.info("Instance is running with dry_run enabled");
}
// Check if all pairs are available
List<CurrencyPair> markets = getMarkets();
for (CurrencyPair pair : properties.getPairWhitelist()) {
if (!markets.contains(pair)) {
throw new FreqTradeExchangeInitializationException("Pair: " + pair + " is not available");
}
}
}
开发者ID:jeperon,项目名称:freqtrade-java,代码行数:23,代码来源:FreqTradeExchangeServiceImpl.java
示例2: getCurrencyPairs
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public Collection<CurrencyPair> getCurrencyPairs(String exchangeName) {
Exchange exchangeByName = getExchangeByName(exchangeName);
if (exchangeByName.getExchangeMetaData() != null) {
return exchangeByName.getExchangeMetaData().getCurrencyPairs().keySet();
} else {
return DEFAULT_CURRENCY_PAIRS;
}
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:9,代码来源:IdeaCurrencyApp.java
示例3: getTicker
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public TickerDto getTicker(String exchangeName, CurrencyPair pair) {
Exchange exchange = getExchangeByName(exchangeName);
try {
MarketDataService marketDataService = exchange.getMarketDataService();
return new TickerDto(exchange.getExchangeSpecification().getExchangeName(), marketDataService.getTicker(pair));
} catch (Exception e) {
return new TickerDto(true, exchangeName, pair);
}
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:10,代码来源:IdeaCurrencyApp.java
示例4: BaseXChangeExchangeRateProvider
import org.knowm.xchange.Exchange; //导入依赖的package包/类
/**
* Construct using an XChange Exchange class object for a set of currencies
* @param exchangeClass Class of XChange exchange we are wrapping
* @param pairs pairs to monitor
*/
protected BaseXChangeExchangeRateProvider(Class<? extends Exchange> exchangeClass,
CurrencyUnitPair... pairs) {
this(exchangeClass,
null,
pairs);
}
开发者ID:ConsensusJ,项目名称:consensusj,代码行数:12,代码来源:BaseXChangeExchangeRateProvider.java
示例5: exchange
import org.knowm.xchange.Exchange; //导入依赖的package包/类
@Bean
public Exchange exchange() {
return ExchangeFactory.INSTANCE.createExchangeWithApiKeys(BittrexExchange.class.getName(),
properties.getBittrex().getKey(), properties.getBittrex().getSecret());
}
开发者ID:jeperon,项目名称:freqtrade-java,代码行数:6,代码来源:FreqTradeConfiguration.java
示例6: prepareAvailableExchanges
import org.knowm.xchange.Exchange; //导入依赖的package包/类
private void prepareAvailableExchanges() {
for (Class<? extends Exchange> exchangeClass : ApplicationConstants.exchangeClasses) {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(exchangeClass.getName());
exchanges.put(exchangeClass, exchange);
}
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:7,代码来源:IdeaCurrencyApp.java
示例7: getAvailableExchanges
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public Collection<Exchange> getAvailableExchanges() {
return exchanges.values();
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:4,代码来源:IdeaCurrencyApp.java
示例8: getExchangeByName
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public Exchange getExchangeByName(String exchangeName) {
return exchanges.values().stream().filter(exchange -> exchange.getExchangeSpecification().getExchangeName().equals(exchangeName)).findFirst().orElse(null);
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:4,代码来源:IdeaCurrencyApp.java
示例9: getExchangeByClass
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public Exchange getExchangeByClass(Class<? extends Exchange> exchangeClass) {
return exchanges.get(exchangeClass);
}
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:4,代码来源:IdeaCurrencyApp.java
示例10: TickerData
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public TickerData(CurrencyPair currencyPair, Exchange exchange, BigDecimal bid, BigDecimal ask) {
this.currencyPair = currencyPair;
this.exchange = exchange;
this.bid = bid;
this.ask = ask;
}
开发者ID:Thleruth,项目名称:bot_arbitrage,代码行数:7,代码来源:TickerData.java
示例11: getExchange
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public Exchange getExchange() {
return exchange;
}
开发者ID:Thleruth,项目名称:bot_arbitrage,代码行数:4,代码来源:TickerData.java
示例12: setExchange
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public void setExchange(Exchange exchange) {
this.exchange = exchange;
}
开发者ID:Thleruth,项目名称:bot_arbitrage,代码行数:4,代码来源:TickerData.java
示例13: ActivatedExchange
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public ActivatedExchange(Exchange exchange, boolean tradingMode) {
this.exchange = exchange;
this.tradingMode = tradingMode;
}
开发者ID:Thleruth,项目名称:bot_arbitrage,代码行数:5,代码来源:ActivatedExchange.java
示例14: call
import org.knowm.xchange.Exchange; //导入依赖的package包/类
@Override
public ActivatedExchange call() {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(exchangeSpecs.GetSetupedExchange());
return new ActivatedExchange(exchange, exchangeSpecs.getTradingMode());
}
开发者ID:Thleruth,项目名称:bot_arbitrage,代码行数:6,代码来源:GetExchangeThread.java
示例15: LiveFutureTickerWriter
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public LiveFutureTickerWriter(final Exchange anExchange) {
exchange = anExchange;
db = new FutureTickerDatabase(anExchange.getExchangeSpecification().getExchangeName());
try {
for (FuturesContract contract : FuturesContract.values()) {
Map<CurrencyPair, SortedSet<Trade>> map = new HashMap<>();
for (CurrencyPair pair : anExchange.getExchangeSymbols()) {
// TickerDatabase db = new
// TickerDatabase(anExchange.getExchangeSpecification().getExchangeName());
map.put(pair, new TreeSet<Trade>());
}
lastTrades.put(contract, map);
}
} catch (ExchangeException | NotAvailableFromExchangeException | NotYetImplementedForExchangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
updaterThread = new Thread("LiveFutureTickerWriter for " + anExchange.getExchangeSpecification().getExchangeName()) {
@Override
public void run() {
while (running) {
try {
for (FuturesContract contract : FuturesContract.values()) {
for (CurrencyPair pair : anExchange.getExchangeSymbols()) {
try {
SortedSet<Trade> newTrades = new TreeSet<>(anExchange.getMarketDataService().getTrades(pair, contract).getTrades());
SortedSet<Trade> notSeen = new TreeSet<>(newTrades);
notSeen.removeAll(lastTrades.get(contract).get(pair));
lastTrades.get(contract).put(pair, newTrades);
db.putAll(contract, notSeen);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
return;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (ExchangeException | NotAvailableFromExchangeException | NotYetImplementedForExchangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
updaterThread.setDaemon(true);
updaterThread.start();
}
开发者ID:TSavo,项目名称:Hippo,代码行数:51,代码来源:LiveFutureTickerWriter.java
示例16: LiveTickerWriter
import org.knowm.xchange.Exchange; //导入依赖的package包/类
public LiveTickerWriter(final Exchange anExchange) {
exchange = anExchange;
db = new MongoTickerDatabase(anExchange.getExchangeSpecification().getExchangeName());
try {
for (CurrencyPair pair : anExchange.getExchangeSymbols()) {
// TickerDatabase db = new
// TickerDatabase(anExchange.getExchangeSpecification().getExchangeName());
lastTrades.put(pair, new TreeSet<Trade>());
}
} catch (ExchangeException | NotAvailableFromExchangeException | NotYetImplementedForExchangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
updaterThread = new Thread("LiveTicker updater for " + anExchange.getExchangeSpecification().getExchangeName()) {
@Override
public void run() {
while (running) {
try {
for (CurrencyPair pair : anExchange.getExchangeSymbols()) {
try {
Set<Trade> newTrades = new HashSet<>(anExchange.getMarketDataService().getTrades(pair).getTrades());
Set<Trade> notSeen = new HashSet<>(newTrades);
notSeen.removeAll(lastTrades.get(pair));
lastTrades.put(pair, newTrades);
db.putAll(pair, notSeen);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
return;
}
}catch(GeminiException | ExchangeException e){
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (ExchangeException | NotAvailableFromExchangeException | NotYetImplementedForExchangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
updaterThread.setDaemon(true);
updaterThread.start();
}
开发者ID:TSavo,项目名称:Hippo,代码行数:47,代码来源:LiveTickerWriter.java
注:本文中的org.knowm.xchange.Exchange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论