XChange
XChange copied to clipboard
Get order engine simulation exchange error
In the simulation exchange, the acquisition engine will use this code In this case, it will be judged whether the. Currencydata is null before obtaining the metadata I don't think we should throw exceptions.
Although the configuration is simulated JSON can solve the problem. Or do you want a default scheme.
Version: xchange-simulated-5.0.13.jar
MatchingEngine getEngine(CurrencyPair currencyPair) {
CurrencyPairMetaData currencyPairMetaData = (CurrencyPairMetaData)this.getExchangeMetaData().getCurrencyPairs().get(currencyPair);
if (currencyPairMetaData == null) {
throw new CurrencyPairNotValidException("Currency pair " + currencyPair + " not known", currencyPair);
} else {
return this.engineFactory.create(currencyPair, currencyPairMetaData == null ? 8 : currencyPairMetaData.getPriceScale(), currencyPairMetaData == null ? BigDecimal.ZERO : currencyPairMetaData.getMinimumAmount());
}
}
After modification
MatchingEngine getEngine(CurrencyPair currencyPair) {
CurrencyPairMetaData currencyPairMetaData = (CurrencyPairMetaData)this.getExchangeMetaData().getCurrencyPairs().get(currencyPair);
return this.engineFactory.create(currencyPair, currencyPairMetaData == null ? 8 : currencyPairMetaData.getPriceScale(), currencyPairMetaData == null ? BigDecimal.ZERO : currencyPairMetaData.getMinimumAmount());
}