Skip to content

Bug in Price fromPriceStep method #220

@jpwijbenga

Description

@jpwijbenga

Is the price step 0-based or 1-based. Because the check allows both 0 and 'number of pricesteps'. It seems like priceStep should only be allowed to be smaller or equal to marketBasis.getPriceSteps() - 1.

public static Price fromPriceStep(MarketBasis marketBasis, double priceStep) {
        if (marketBasis == null) {
            throw new IllegalArgumentException("marketBasis cannot be null");
        }
        if (priceStep < 0 || priceStep > marketBasis.getPriceSteps()) {
            throw new IllegalArgumentException("priceStep is not in the range of the marketBasis");
        }
        return new Price(marketBasis, marketBasis.getMinimumPrice() + priceStep * marketBasis.getPriceIncrement());
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions