@axis-markets/client 0.9.3 → 0.9.4

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.
@@ -811,6 +811,10 @@ export class AxisAccount extends Emitter {
811
811
  this.removed.set(key, until)
812
812
  }
813
813
  } else if (current) {
814
+ //a new price or amount is a new version of the order that nothing has filled yet
815
+ if (update.price !== current.price || update.amount !== current.amount) {
816
+ Object.assign(current, {quote: update.amount, filledPct: 0})
817
+ }
814
818
  Object.assign(current, {amount: update.amount, price: update.price, expires: Number(update.expires)})
815
819
  }
816
820
  }
@@ -1279,7 +1283,7 @@ function newestFirst(x, y) {
1279
1283
  * @property {'ACTIVE'|'FILLED'|'CANCELED'|'EXPIRED'} status - Current status
1280
1284
  * @property {bigint} price - `buying` per 1 `selling`, contract scale (18 decimals)
1281
1285
  * @property {bigint} amount - Amount of `selling` left
1282
- * @property {bigint} quote - Amount of `selling` at creation
1286
+ * @property {bigint} quote - Original `selling` amount
1283
1287
  * @property {number} expires - Expiration UNIX timestamp in seconds, 0 = none
1284
1288
  * @property {number} created - Creation time, UNIX milliseconds
1285
1289
  * @property {number} updated - Last change, UNIX milliseconds
@@ -1287,7 +1291,7 @@ function newestFirst(x, y) {
1287
1291
  * @property {bigint|null} backed - Share of the account budget in `selling` that backs the order
1288
1292
  * @property {number|null} backedPct - `backed / amount` (0..1), null when unknown
1289
1293
  * @property {boolean} backingPending - The backing is not confirmed yet
1290
- * @property {number} filledPct - Filled share of the initial amount (0..1)
1294
+ * @property {number} filledPct - Filled share of `quote` (0..1)
1291
1295
  * @property {boolean} pending - Created by this client, not reported by the indexer yet
1292
1296
  */
1293
1297
 
package/src/index.d.ts CHANGED
@@ -825,7 +825,7 @@ export interface ApiOrder {
825
825
  price: string;
826
826
  /** Rational price representation */
827
827
  rprice: string;
828
- /** Selling amount at creation */
828
+ /** Original selling amount */
829
829
  quote: string;
830
830
  /** Amount left to sell */
831
831
  amount: string;
@@ -1446,7 +1446,7 @@ export interface AccountOrder {
1446
1446
  price: bigint;
1447
1447
  /** Amount of `selling` left */
1448
1448
  amount: bigint;
1449
- /** Amount of `selling` at creation */
1449
+ /** Original selling amount */
1450
1450
  quote: bigint;
1451
1451
  /** Expiration UNIX timestamp in seconds, 0 = none */
1452
1452
  expires: number;
@@ -1462,7 +1462,7 @@ export interface AccountOrder {
1462
1462
  backedPct: number | null;
1463
1463
  /** The backing is not confirmed yet */
1464
1464
  backingPending: boolean;
1465
- /** Filled share of the initial amount (0..1) */
1465
+ /** Filled share of `quote` (0..1) */
1466
1466
  filledPct: number;
1467
1467
  /** Created by this client, not reported by the indexer yet */
1468
1468
  pending: boolean;