Repository: ccxt/ccxt
Pull request: poloniex: fix ccxt/ccxt#14829
fix ccxt/ccxt#14829

It turns out `fmod` returns float type, and we compare result and types: `fmod (i % 2) === 0`, that's why `fetch_order_book` didn't work in php.

Problem statement:
Poloniex fetch order book doesnt work
- Programming Language version: PHP 
- CCXT version: latest

After update to latest PHP and latest ccxt i have problem with order book at poloniex (other functions are working fine I can place\cancel order and fetch order data but order book is always empty without any errors)
And I don't know how to find an error

Hints from issue discussion:
@Showgofar oh, it looks like a bug, we'll fix soon.

Commit message: poloniex: fix ccxt/ccxt#14829

Patch to review:
diff --git a/js/poloniex.js b/js/poloniex.js
index 8887211e2abcb..dc21ef7df32b5 100644
--- a/js/poloniex.js
+++ b/js/poloniex.js
@@ -1353,14 +1353,14 @@ module.exports = class poloniex extends Exchange {
         const asksResult = [];
         const bidsResult = [];
         for (let i = 0; i < asks.length; i++) {
-            if ((i % 2) === 0) {
+            if (i % 2) {
                 const price = this.safeNumber (asks, i);
                 const amount = this.safeNumber (asks, this.sum (i, 1));
                 asksResult.push ([ price, amount ]);
             }
         }
         for (let i = 0; i < bids.length; i++) {
-            if ((i % 2) === 0) {
+            if (i % 2) {
                 const price = this.safeNumber (bids, i);
                 const amount = this.safeNumber (bids, this.sum (i, 1));
                 bidsResult.push ([ price, amount ]);


Code review comments:
diff_hunk: @@ -1353,14 +1353,14 @@ module.exports = class poloniex extends Exchange {
         const asksResult = [];
         const bidsResult = [];
         for (let i = 0; i < asks.length; i++) {
-            if ((i % 2) === 0) {
+            if (i % 2) {
path: js/poloniex.js
text: @user1:
@author in this case you've also inverted the conditional, no?

@author:
oh, I think you're right!