Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP: Exchange: decimal_to_precision #2171

Merged
merged 2 commits into from
Mar 28, 2018
Merged

PHP: Exchange: decimal_to_precision #2171

merged 2 commits into from
Mar 28, 2018

Conversation

kornrunner
Copy link
Contributor

@kornrunner kornrunner commented Mar 8, 2018

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:

PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.3
Configuration: /home/work/github/kornrunner/ccxt-origin/phpunit.xml.dist

.....................................................             53 / 53 (100%)

Time: 6.12 seconds, Memory: 4.00MB

OK (53 tests, 57 assertions)

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.

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.

None yet

2 participants