From 9b8f1fbef5a23e5060e8986c08db52f6cec001fe Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Wed, 13 Nov 2024 22:42:32 +0100 Subject: [PATCH 1/6] Comment explaining price in fill log result --- client/ts/src/fillFeed.ts | 2 +- client/ts/src/types.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ts/src/fillFeed.ts b/client/ts/src/fillFeed.ts index 02a013d11..1612ac975 100644 --- a/client/ts/src/fillFeed.ts +++ b/client/ts/src/fillFeed.ts @@ -213,7 +213,7 @@ function toFillLogResult( taker: fillLog.taker.toBase58(), baseAtoms: fillLog.baseAtoms.inner.toString(), quoteAtoms: fillLog.quoteAtoms.inner.toString(), - price: convertU128(fillLog.price.inner), + priceAtoms: convertU128(fillLog.price.inner), takerIsBuy: fillLog.takerIsBuy, isMakerGlobal: fillLog.isMakerGlobal, makerSequenceNumber: fillLog.makerSequenceNumber.toString(), diff --git a/client/ts/src/types.ts b/client/ts/src/types.ts index ee4e057fb..5e5dc667c 100644 --- a/client/ts/src/types.ts +++ b/client/ts/src/types.ts @@ -12,8 +12,8 @@ export type FillLogResult = { baseAtoms: string; /** Number of quote atoms traded. */ quoteAtoms: string; - /** Price as float. Quote atoms per base atom. */ - price: number; + /** Price as float. Quote atoms per base atom. Client is responsible for translating to tokens. */ + priceAtoms: number; /** Boolean to indicate which side the trade was. */ takerIsBuy: boolean; /** Boolean to indicate whether the maker side is global. */ From 6b54f8c95f95b244268803db1cf6f439a2357e34 Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Wed, 13 Nov 2024 22:45:07 +0100 Subject: [PATCH 2/6] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4a76b8a22..6d5898c7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cks-systems/manifest-sdk", - "version": "0.1.67", + "version": "0.1.68", "files": [ "dist/", "README.md", From 56aeefafeaf8cd4da8cd54b57db051d43497840f Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Wed, 13 Nov 2024 22:46:14 +0100 Subject: [PATCH 3/6] fix build --- debug-ui/scripts/stats-server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debug-ui/scripts/stats-server.ts b/debug-ui/scripts/stats-server.ts index 8a0828aac..7c3817d77 100644 --- a/debug-ui/scripts/stats-server.ts +++ b/debug-ui/scripts/stats-server.ts @@ -111,7 +111,7 @@ export class ManifestStatsServer { this.ws.onmessage = async (message) => { const fill: FillLogResult = JSON.parse(message.data.toString()); - const { market, baseAtoms, quoteAtoms, price, slot } = fill; + const { market, baseAtoms, quoteAtoms, priceAtoms, slot } = fill; // Do not accept old spurious messages. if (this.lastFillSlot > slot) { @@ -144,13 +144,13 @@ export class ManifestStatsServer { } lastPrice.set( { market }, - price * + priceAtoms * 10 ** (this.markets.get(market)!.baseDecimals() - this.markets.get(market)!.quoteDecimals()), ); - this.lastPriceByMarket.set(market, price); + this.lastPriceByMarket.set(market, priceAtoms); this.baseVolumeAtomsSinceLastCheckpoint.set( market, this.baseVolumeAtomsSinceLastCheckpoint.get(market)! + From c0dfea49420f01fb733c8fb36595d8bfd61bf7d6 Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Wed, 13 Nov 2024 22:47:02 +0100 Subject: [PATCH 4/6] comment --- debug-ui/scripts/stats-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug-ui/scripts/stats-server.ts b/debug-ui/scripts/stats-server.ts index 7c3817d77..15f96ddbb 100644 --- a/debug-ui/scripts/stats-server.ts +++ b/debug-ui/scripts/stats-server.ts @@ -74,7 +74,7 @@ export class ManifestStatsServer { private baseVolumeAtomsCheckpoints: Map = new Map(); private quoteVolumeAtomsCheckpoints: Map = new Map(); - // Last price by market + // Last price by market. Price is in atoms per atom. private lastPriceByMarket: Map = new Map(); // Market objects used for mints and decimals. From 86350091af66b531bd77533357c204419d3b74b1 Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Thu, 14 Nov 2024 17:36:22 +0100 Subject: [PATCH 5/6] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d5898c7e..2d3ec4377 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cks-systems/manifest-sdk", - "version": "0.1.68", + "version": "0.1.69", "files": [ "dist/", "README.md", From 620dd12b3a80764b729fbcbf7f649c3a3df3fd1c Mon Sep 17 00:00:00 2001 From: Britt Cyr Date: Thu, 14 Nov 2024 17:40:00 +0100 Subject: [PATCH 6/6] comment on UI --- debug-ui/app/components/Fills.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/debug-ui/app/components/Fills.tsx b/debug-ui/app/components/Fills.tsx index 52ef0393c..b09bbfa85 100644 --- a/debug-ui/app/components/Fills.tsx +++ b/debug-ui/app/components/Fills.tsx @@ -53,6 +53,7 @@ const Fills = ({ marketAddress }: { marketAddress: string }): ReactElement => { Number(fill.baseAtoms) / 10 ** Number(marketRef.current?.baseDecimals() || 0); + // Price is the actual price which factors in rounding, not the limit price. const priceTokens = Number((quoteTokens / baseTokens).toFixed(4)); const fillUi: FillResultUi = { market: fill.market,