PHP: Exchange: decimal_to_precision #2171
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's the PHP port of #1635, based on #2121
I've put new constants in the
ccxt
namespace to avoid polluting global state.Constants have values based on #1635 (they differ in #2121).
I've tried to stick to the variables nomenclature (camelCase) based on #1635
There might be more uncovered / edge cases that need to be handled (negative precision isn't handled in existing PRs neither). Code is covered by same tests that already exist in previous PRs:
I haven't checked it against previous versions (7.1, 7.0, 5.6 etc) - but this is all basic code without any new/shiny/fancy stuff. To be honest - code might be suboptimal - as I've mostly ported Py implementation to PHP. There might be better ways to achieve the same functionality.
Oh, and a bit offtopic: PHPUnit 6 is there because of PHP 5 support, as PHPUnit 7 requires PHP 7 and newer (and switching to newest versions is encouraged by whole community, but that's a topic for another thread).
Let me know if anything. Thank you.