@@ -1498,17 +1498,29 @@ private function depthData(string $symbol, array $json)
1498
1498
}
1499
1499
1500
1500
/**
1501
- * roundStep rounds number with given step
1502
- * @param $value price
1501
+ * roundStep rounds quantity with stepSize
1502
+ * @param $qty quantity
1503
1503
* @param $stepSize parameter from exchangeInfo
1504
1504
* @return rounded value. example: roundStep(1.2345, 0.1) = 1.2
1505
1505
*
1506
1506
*/
1507
- public function roundStep ($ value , $ stepSize = 0.1 ) {
1507
+ public function roundStep ($ qty , $ stepSize = 0.1 ) {
1508
1508
$ precision = strlen (substr (strrchr (rtrim ($ stepSize ,'0 ' ), '. ' ), 1 ));
1509
- return round ((($ value / $ stepSize ) | 0 ) * $ stepSize , $ precision );
1509
+ return round ((($ qty / $ stepSize ) | 0 ) * $ stepSize , $ precision );
1510
1510
}
1511
-
1511
+
1512
+ /**
1513
+ * roundTicks rounds price with tickSize
1514
+ * @param $value price
1515
+ * @param $tickSize parameter from exchangeInfo
1516
+ * @return rounded value. example: roundStep(1.2345, 0.1) = 1.2
1517
+ *
1518
+ */
1519
+ public function roundTicks ($ price , $ tickSize ) {
1520
+ $ precision = strlen (rtrim (substr ($ tickSize ,strpos ($ tickSize , '. ' , 1 ) + 1 ), '0 ' ));
1521
+ return number_format ($ price , $ precision , '. ' , '' );
1522
+ }
1523
+
1512
1524
/**
1513
1525
* getTransfered gets the total transfered in b,Kb,Mb,Gb
1514
1526
*
0 commit comments