Skip to content

test(trading): cover minimum order amount and cost gates - #3758

Open
Herklos wants to merge 1 commit into
devfrom
cursor/nightly-min-order-tests-3dad
Open

Herklos wants to merge 1 commit into
devfrom
cursor/nightly-min-order-tests-3dad

Conversation

@Herklos

@Herklos Herklos commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Thank you for sending your pull request.
But first, have you included unit tests, and is your code PEP8 conformant? More details

Summary

Add direct unit tests for the minimum order amount and cost helpers that gate order creation when a size is below exchange limits. Test-only change, no production code touched.

Solve the issue: none

Changelog

  • Add unit tests for get_minimal_order_amount (exchange min, explicit zero, precision fallback, missing market)
  • Add unit tests for get_minimal_order_cost (exchange min, zero min ignored, caller price, market price min, missing market)

What's new?

Nightly tests audit (aspect: tests missing for critical paths). get_minimal_order_amount and get_minimal_order_cost decide whether an order is large enough for the exchange. Order creation calls them when adapted quantities are empty, and trading modes use them before placing orders. They had no direct tests.

Scope is one new test file under packages/trading/tests/personal_data/orders/. No existing test or source file is modified.

Verification:

  • pytest packages/trading/tests/personal_data/orders/test_minimal_order_limits.py: 11 passed.
  • pylint on that file with packages/trading/standard.rc: 10.00/10.
  • Mutation check: treating a zero minimum amount as missing makes test_keeps_explicit_zero_min_amount fail. Source restored afterwards.
  • python -m tools.extended_linter --base origin/dev: 0 violations.
Open in Web Open in Cursor 

Order creation uses these helpers when a size is below exchange limits.
They had no direct tests.

Co-authored-by: herklos.dev <herklos.dev@protonmail.com>
@Herklos
Herklos requested a review from GuillaumeDSM as a code owner October 15, 2026 06:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants