From cd9748e59f1dd9ef31afb22195b8d5a1346ec5c3 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 16 May 2022 00:09:44 -0500 Subject: start adding auctionprices page --- src/lib/APITypes.d.ts | 19 ++++++ src/lib/AuctionPriceScatterplot.svelte | 49 ++++++++++++++ src/routes/auctionprices.svelte | 114 +++++++++++++++++++++++++++++++++ src/routes/index.svelte | 2 +- 4 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 src/lib/AuctionPriceScatterplot.svelte create mode 100644 src/routes/auctionprices.svelte diff --git a/src/lib/APITypes.d.ts b/src/lib/APITypes.d.ts index 6402721..6429e8b 100644 --- a/src/lib/APITypes.d.ts +++ b/src/lib/APITypes.d.ts @@ -434,3 +434,22 @@ export interface AccessoryBagUpgrades { list: string[] } } + +export interface SimpleAuctionSchema { + /** The UUID of the auction so we can look it up later. */ + id: string + coins: number + /** + * The timestamp as **seconds** since epoch. It's in seconds instead of ms + * since we don't need to be super exact and so it's shorter. + */ + ts: number + /** Whether the auction was bought or simply expired. */ + success: boolean + bin: boolean +} +export interface ItemAuctionsSchema { + /** The id of the item */ + _id: string + auctions: SimpleAuctionSchema[] +} diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte new file mode 100644 index 0000000..f887725 --- /dev/null +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -0,0 +1,49 @@ + + + + + + + + + + + {#each item.auctions as auction} + {@const timestampPercentage = + (auction.ts - earliestTimestamp) / (currentTimestamp - earliestTimestamp)} + + {/each} + + + + diff --git a/src/routes/auctionprices.svelte b/src/routes/auctionprices.svelte new file mode 100644 index 0000000..f464f7b --- /dev/null +++ b/src/routes/auctionprices.svelte @@ -0,0 +1,114 @@ + + + + + +
+ + + +
+

SkyBlock Auction Prices

+
+ +
+
+ {#each data as item (item._id)} + {@const binAuctions = item.auctions.filter(i => i.bin)} + {@const normalAuctions = item.auctions.filter(i => !i.bin)} +
+

{cleanId(item._id.toLowerCase())}

+
+ {#if binAuctions.length > 0} +

+ Lowest recent BIN: + {binAuctions.reduce((a, b) => (a.coins < b.coins ? a : b)).coins.toLocaleString()} coins + +

+ {/if} + {#if normalAuctions.length > 0} +

+ Lowest recent auction: + {normalAuctions + .reduce((a, b) => (a.coins < b.coins ? a : b)) + .coins.toLocaleString()} coins + +

+ {/if} +
+
+ +
+
+ {/each} + {#if data.length === 0} + No results + {/if} +
+
+ + diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 4c11a88..d22f854 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -49,7 +49,7 @@

Other SkyBlock tools