Get order engine simulation exchange error

Open
#4,422 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
backend

Research direction

Start at MatchingEngine.getEngine in the simulation exchange and reproduce the missing-CurrencyPair metadata case using the configuration described in the issue. Confirm that engine creation uses the shown fallback values without throwing CurrencyPairNotValidException; no source file or test is named in the report.

Written by the indexing model from the issue text.

Description

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());
    }
Dominant language
Java
Stars
4.1k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knowm/XChange

All issues in knowm/XChange

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.