@d8x/perpetuals-sdk 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -523,13 +523,16 @@ export default class PerpetualDataHandler {
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
private static _flagToOrderType(order: SmartContractOrder): string {
|
|
526
|
-
let
|
|
527
|
-
let
|
|
528
|
-
|
|
526
|
+
let flag = BigNumber.from(order.flags);
|
|
527
|
+
let isLimit = containsFlag(flag, MASK_LIMIT_ORDER);
|
|
528
|
+
let hasLimit = !BigNumber.from(order.fLimitPrice).eq(0) || !BigNumber.from(order.fLimitPrice).eq(MAX_64x64);
|
|
529
|
+
let isStop = containsFlag(flag, MASK_STOP_ORDER);
|
|
530
|
+
|
|
531
|
+
if (isStop && hasLimit) {
|
|
529
532
|
return ORDER_TYPE_STOP_LIMIT;
|
|
530
|
-
} else if (
|
|
533
|
+
} else if (isStop && !hasLimit) {
|
|
531
534
|
return ORDER_TYPE_STOP_MARKET;
|
|
532
|
-
} else if (
|
|
535
|
+
} else if (isLimit && !isStop) {
|
|
533
536
|
return ORDER_TYPE_LIMIT;
|
|
534
537
|
} else {
|
|
535
538
|
return ORDER_TYPE_MARKET;
|