mirror of
https://gitea.gf4.pw/gf4/haveno-markets.git
synced 2024-12-22 08:09:21 +00:00
add prettier
biome doesn't support formatting html and css in svelte yet, so we use prettier as a workaround for now
This commit is contained in:
parent
64bcead0b2
commit
a921561083
9 changed files with 390 additions and 220 deletions
15
.prettierrc
Normal file
15
.prettierrc
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"useTabs": true,
|
||||||
|
"singleQuote": false,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"printWidth": 80,
|
||||||
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.svelte",
|
||||||
|
"options": {
|
||||||
|
"parser": "svelte"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
README.md
10
README.md
|
@ -1,5 +1,7 @@
|
||||||
# haveno-markets
|
# Haveno Markets
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
* Haveno
|
|
||||||
* ./haveno-statsnode --dumpStatistics=true
|
- Haveno
|
||||||
* bun
|
- ./haveno-statsnode --dumpStatistics=true
|
||||||
|
- bun
|
||||||
|
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -6,13 +6,15 @@
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"fix": "biome check --write *",
|
"fix": "prettier --write . && biome check --write *",
|
||||||
"lint": "biome check *"
|
"lint": "biome check *"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.3",
|
"@biomejs/biome": "^1.9.3",
|
||||||
"@sveltejs/kit": "^2.6.1",
|
"@sveltejs/kit": "^2.6.1",
|
||||||
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.7",
|
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.7",
|
||||||
|
"prettier": "^3.3.2",
|
||||||
|
"prettier-plugin-svelte": "^3.2.5",
|
||||||
"sass": "^1.79.4",
|
"sass": "^1.79.4",
|
||||||
"svelte": "^5.0.0-next.262",
|
"svelte": "^5.0.0-next.262",
|
||||||
"svelte-adapter-bun": "^0.5.2",
|
"svelte-adapter-bun": "^0.5.2",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Haveno Markets</title>
|
<title>Haveno Markets</title>
|
||||||
<link rel="icon" href="data:;base64,=">
|
<link rel="icon" href="data:;base64,=" />
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
<body data-sveltekit-preload-data="hover">
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
|
|
@ -33,25 +33,39 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
<span>
|
<span>
|
||||||
Links:
|
Links:
|
||||||
<a href="https://haveno.markets">Clearnet</a> |
|
<a href="https://haveno.markets">Clearnet</a> |
|
||||||
<a href="http://lsj5o4i7iiogz6q4rstiv75nk7kots2f2nhuga75y7s23leskz2uh6id.onion">Tor</a> |
|
<a
|
||||||
|
href="http://lsj5o4i7iiogz6q4rstiv75nk7kots2f2nhuga75y7s23leskz2uh6id.onion"
|
||||||
|
>Tor</a
|
||||||
|
>
|
||||||
|
|
|
||||||
<a href="http://haveno-markets.i2p">I2P</a>
|
<a href="http://haveno-markets.i2p">I2P</a>
|
||||||
<a href="http://okoeicsihmjkqcqaiqow3arcrzm5ascwhpxq34incxg6a5z4tjza.b32.i2p">(b32)</a>
|
<a
|
||||||
|
href="http://okoeicsihmjkqcqaiqow3arcrzm5ascwhpxq34incxg6a5z4tjza.b32.i2p"
|
||||||
|
>(b32)</a
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
<span style="display:flex;gap:.2em;">
|
<span style="display:flex;gap:.2em;">
|
||||||
Data from:
|
Data from:
|
||||||
<a href="https://haveno-reto.com" style="display:inline-flex;gap:.2em;align-items:center;">
|
<a
|
||||||
|
href="https://haveno-reto.com"
|
||||||
|
style="display:inline-flex;gap:.2em;align-items:center;"
|
||||||
|
>
|
||||||
<img src="/haveno-reto_logo.svg" alt="" style="height:1em;width:1em;" />
|
<img src="/haveno-reto_logo.svg" alt="" style="height:1em;width:1em;" />
|
||||||
haveno-reto
|
haveno-reto
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Donations:
|
Donations:
|
||||||
<a style="word-break:break-all;" href="monero:84LnuW3YpCQirNMN6y6Px1E3DfwnqwXVRARi9eHjzeSVFJqEQmJCxkP5WpkysbcktqUNhXxQLowhJGSknNjJWZNQ7FKp5bu">
|
<a
|
||||||
|
style="word-break:break-all;"
|
||||||
|
href="monero:84LnuW3YpCQirNMN6y6Px1E3DfwnqwXVRARi9eHjzeSVFJqEQmJCxkP5WpkysbcktqUNhXxQLowhJGSknNjJWZNQ7FKp5bu"
|
||||||
|
>
|
||||||
84LnuW3YpCQirNMN6y6Px1E3DfwnqwXVRARi9eHjzeSVFJqEQmJCxkP5WpkysbcktqUNhXxQLowhJGSknNjJWZNQ7FKp5bu
|
84LnuW3YpCQirNMN6y6Px1E3DfwnqwXVRARi9eHjzeSVFJqEQmJCxkP5WpkysbcktqUNhXxQLowhJGSknNjJWZNQ7FKp5bu
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss" global>
|
<style lang="scss" global>
|
||||||
.app {
|
.app {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -94,21 +108,23 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
}
|
}
|
||||||
.card {
|
.card {
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
padding:.5em;
|
padding: 0.5em;
|
||||||
background-color:#552A64;
|
background-color: #552a64;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
:global(h4) {
|
:global(h4) {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color:#F1482D;
|
color: #f1482d;
|
||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
th, td {
|
th,
|
||||||
|
td {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding:.3em;
|
padding: 0.3em;
|
||||||
}
|
}
|
||||||
th:first-child, td:first-child {
|
th:first-child,
|
||||||
|
td:first-child {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
tbody tr:nth-child(2n) {
|
tbody tr:nth-child(2n) {
|
||||||
|
@ -120,7 +136,8 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a, .price {
|
a,
|
||||||
|
.price {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #f60;
|
color: #f60;
|
||||||
}
|
}
|
||||||
|
@ -129,10 +146,10 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
}
|
}
|
||||||
.price {
|
.price {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
margin-bottom:.4em;
|
margin-bottom: 0.4em;
|
||||||
}
|
}
|
||||||
h4 {
|
h4 {
|
||||||
margin:.4em;
|
margin: 0.4em;
|
||||||
}
|
}
|
||||||
.trade-currency {
|
.trade-currency {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
@ -148,11 +165,11 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
width: 97% !important;
|
width: 97% !important;
|
||||||
}
|
}
|
||||||
.card {
|
.card {
|
||||||
margin:.5em 0;
|
margin: 0.5em 0;
|
||||||
padding:.5em 0;
|
padding: 0.5em 0;
|
||||||
}
|
}
|
||||||
.header {
|
.header {
|
||||||
padding:.2em 0;
|
padding: 0.2em 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.header > * {
|
.header > * {
|
||||||
|
@ -160,7 +177,7 @@ Object.groupBy ||= (values, keyFinder) => {
|
||||||
width: 33.3%;
|
width: 33.3%;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap:.2em;
|
gap: 0.2em;
|
||||||
}
|
}
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
.header > * {
|
.header > * {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<svelte:options runes={true} />
|
<svelte:options runes={true} />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
formatPrice,
|
formatPrice,
|
||||||
|
@ -116,7 +117,9 @@ let w = $state();
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col card">
|
<div class="col card">
|
||||||
<h4>XMR/USD</h4>
|
<h4>XMR/USD</h4>
|
||||||
<span class="price">{formatPrice(grouped["USD"][0].price, "USD", true)}</span>
|
<span class="price"
|
||||||
|
>{formatPrice(grouped["USD"][0].price, "USD", true)}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="col card">
|
<div class="col card">
|
||||||
<h4>Liquidity</h4>
|
<h4>Liquidity</h4>
|
||||||
|
@ -126,14 +129,26 @@ let w = $state();
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col card" style="flex:1;" bind:clientWidth={w}>
|
<div class="col card" style="flex:1;" bind:clientWidth={w}>
|
||||||
<h4>Price XMR/<select bind:value={key}>
|
<h4>
|
||||||
|
Price XMR/<select bind:value={key}>
|
||||||
{#each Object.keys(grouped) as key}
|
{#each Object.keys(grouped) as key}
|
||||||
<option>{key}</option>
|
<option>{key}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select></h4>
|
</select>
|
||||||
|
</h4>
|
||||||
|
|
||||||
<Chart width={w-20} height={300} container={{class:"row"}} layout={chartLayout} grid={gridLayout}>
|
<Chart
|
||||||
<CandlestickSeries data={trades} reactive={true} priceFormat={{minMove:10**-precision, precision:precision}}></CandlestickSeries>
|
width={w - 20}
|
||||||
|
height={300}
|
||||||
|
container={{ class: "row" }}
|
||||||
|
layout={chartLayout}
|
||||||
|
grid={gridLayout}
|
||||||
|
>
|
||||||
|
<CandlestickSeries
|
||||||
|
data={trades}
|
||||||
|
reactive={true}
|
||||||
|
priceFormat={{ minMove: 10 ** -precision, precision: precision }}
|
||||||
|
></CandlestickSeries>
|
||||||
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
||||||
</Chart>
|
</Chart>
|
||||||
</div>
|
</div>
|
||||||
|
@ -143,13 +158,29 @@ let w = $state();
|
||||||
<option value="3600000">Hourly</option>
|
<option value="3600000">Hourly</option>
|
||||||
<option value="86400000">Daily</option>
|
<option value="86400000">Daily</option>
|
||||||
<option value="604800000">Weekly</option>
|
<option value="604800000">Weekly</option>
|
||||||
</select> Volume</h4>
|
</select> Volume
|
||||||
<Chart width={w-20} height={300} container={{class:"row"}} layout={chartLayout} grid={gridLayout}>
|
</h4>
|
||||||
<LineSeries data={volume} reactive={true} priceFormat={{precision:2, minMove:.01}}>
|
<Chart
|
||||||
<PriceScale scaleMargins={{bottom:.4, top:.1}}/>
|
width={w - 20}
|
||||||
|
height={300}
|
||||||
|
container={{ class: "row" }}
|
||||||
|
layout={chartLayout}
|
||||||
|
grid={gridLayout}
|
||||||
|
>
|
||||||
|
<LineSeries
|
||||||
|
data={volume}
|
||||||
|
reactive={true}
|
||||||
|
priceFormat={{ precision: 2, minMove: 0.01 }}
|
||||||
|
>
|
||||||
|
<PriceScale scaleMargins={{ bottom: 0.4, top: 0.1 }} />
|
||||||
</LineSeries>
|
</LineSeries>
|
||||||
<HistogramSeries data={swaps} reactive={true} priceScaleId="" priceFormat={{precision:0, minMove:1}}>
|
<HistogramSeries
|
||||||
<PriceScale scaleMargins={{top:.7, bottom:0}}/>
|
data={swaps}
|
||||||
|
reactive={true}
|
||||||
|
priceScaleId=""
|
||||||
|
priceFormat={{ precision: 0, minMove: 1 }}
|
||||||
|
>
|
||||||
|
<PriceScale scaleMargins={{ top: 0.7, bottom: 0 }} />
|
||||||
</HistogramSeries>
|
</HistogramSeries>
|
||||||
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
||||||
</Chart>
|
</Chart>
|
||||||
|
@ -165,10 +196,23 @@ let w = $state();
|
||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
<th>Trades</th>
|
<th>Trades</th>
|
||||||
</tr>
|
</tr>
|
||||||
{#each Object.values(Object.groupBy(data.trades, ({currency}) => currency)).toSorted((a,b) => b.length - a.length || (b[0].currency < a[0].currency ? 1 : -1)).slice(0, 16) as market}
|
{#each Object.values(Object.groupBy(data.trades, ({ currency }) => currency))
|
||||||
|
.toSorted((a, b) => b.length - a.length || (b[0].currency < a[0].currency ? 1 : -1))
|
||||||
|
.slice(0, 16) as market}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="market/{market[0].currency}">{getAsset(market[0].currency).name} ({market[0].currency})</a></td>
|
<td
|
||||||
<td>{formatPrice(market[0].price, market[0].currency, true, false)}</td>
|
><a href="market/{market[0].currency}"
|
||||||
|
>{getAsset(market[0].currency).name} ({market[0].currency})</a
|
||||||
|
></td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
market[0].price,
|
||||||
|
market[0].currency,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
)}</td
|
||||||
|
>
|
||||||
<td>{market.length}</td>
|
<td>{market.length}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -187,9 +231,17 @@ let w = $state();
|
||||||
</tr>
|
</tr>
|
||||||
{#each data.trades.slice(0, 16) as trade}
|
{#each data.trades.slice(0, 16) as trade}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{new Date(trade.date).toISOString().replace("T", " ").replace(/\.\d*Z/, "")}</td>
|
<td
|
||||||
|
>{new Date(trade.date)
|
||||||
|
.toISOString()
|
||||||
|
.replace("T", " ")
|
||||||
|
.replace(/\.\d*Z/, "")}</td
|
||||||
|
>
|
||||||
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
||||||
<td>{formatPrice(trade.amount, trade.currency, false, false)} <span class="trade-currency">{trade.currency}</span></td>
|
<td
|
||||||
|
>{formatPrice(trade.amount, trade.currency, false, false)}
|
||||||
|
<span class="trade-currency">{trade.currency}</span></td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<svelte:options runes={true} />
|
<svelte:options runes={true} />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
import {
|
import {
|
||||||
|
@ -66,16 +67,29 @@ const gridLayout = {
|
||||||
const marketPair = isMoneroQuote(market) ? `${market}/XMR` : `XMR/${market}`;
|
const marketPair = isMoneroQuote(market) ? `${market}/XMR` : `XMR/${market}`;
|
||||||
const BUY_SELL = isMoneroQuote(market) ? ["SELL", "BUY"] : ["BUY", "SELL"];
|
const BUY_SELL = isMoneroQuote(market) ? ["SELL", "BUY"] : ["BUY", "SELL"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{marketPair} - Haveno Markets</title>
|
<title>{marketPair} - Haveno Markets</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col card" bind:clientWidth={w}>
|
<div class="col card" bind:clientWidth={w}>
|
||||||
<h4>{marketPair}</h4>
|
<h4>{marketPair}</h4>
|
||||||
<span class="price">{formatPrice(data.trades?.[0]?.price, market, true, false) || "-"}</span>
|
<span class="price"
|
||||||
|
>{formatPrice(data.trades?.[0]?.price, market, true, false) || "-"}</span
|
||||||
|
>
|
||||||
{#if data.trades?.length}
|
{#if data.trades?.length}
|
||||||
<Chart width={w-20} height={500} container={{class:"row"}} layout={chartLayout} grid={gridLayout}>
|
<Chart
|
||||||
<CandlestickSeries data={trades} reactive={true} priceFormat={{minMove:10**-precision, precision:precision}}></CandlestickSeries>
|
width={w - 20}
|
||||||
|
height={500}
|
||||||
|
container={{ class: "row" }}
|
||||||
|
layout={chartLayout}
|
||||||
|
grid={gridLayout}
|
||||||
|
>
|
||||||
|
<CandlestickSeries
|
||||||
|
data={trades}
|
||||||
|
reactive={true}
|
||||||
|
priceFormat={{ minMove: 10 ** -precision, precision: precision }}
|
||||||
|
></CandlestickSeries>
|
||||||
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
||||||
</Chart>
|
</Chart>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -95,7 +109,14 @@ const BUY_SELL = isMoneroQuote(market) ? ["SELL", "BUY"] : ["BUY", "SELL"];
|
||||||
<tr title={offer.paymentMethod}>
|
<tr title={offer.paymentMethod}>
|
||||||
<td>{formatPrice(offer.price, market, false, false)}</td>
|
<td>{formatPrice(offer.price, market, false, false)}</td>
|
||||||
<td>{formatPrice(offer.amount, "XMR", false, false)}</td>
|
<td>{formatPrice(offer.amount, "XMR", false, false)}</td>
|
||||||
<td>{formatPrice(offer.primaryMarketAmount, market, false, false)}</td>
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
offer.primaryMarketAmount,
|
||||||
|
market,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
)}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -114,7 +135,14 @@ const BUY_SELL = isMoneroQuote(market) ? ["SELL", "BUY"] : ["BUY", "SELL"];
|
||||||
<tr title={offer.paymentMethod}>
|
<tr title={offer.paymentMethod}>
|
||||||
<td>{formatPrice(offer.price, market, false, false)}</td>
|
<td>{formatPrice(offer.price, market, false, false)}</td>
|
||||||
<td>{formatPrice(offer.amount, "XMR", false, false)}</td>
|
<td>{formatPrice(offer.amount, "XMR", false, false)}</td>
|
||||||
<td>{formatPrice(offer.primaryMarketAmount, market, false, false)}</td>
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
offer.primaryMarketAmount,
|
||||||
|
market,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
)}</td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -134,7 +162,12 @@ const BUY_SELL = isMoneroQuote(market) ? ["SELL", "BUY"] : ["BUY", "SELL"];
|
||||||
</tr>
|
</tr>
|
||||||
{#each data.trades as trade}
|
{#each data.trades as trade}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{new Date(trade.date).toISOString().replace("T", " ").replace(/\.\d*Z/, "")}</td>
|
<td
|
||||||
|
>{new Date(trade.date)
|
||||||
|
.toISOString()
|
||||||
|
.replace("T", " ")
|
||||||
|
.replace(/\.\d*Z/, "")}</td
|
||||||
|
>
|
||||||
<td>{formatPrice(trade.price, trade.currency, false, false)}</td>
|
<td>{formatPrice(trade.price, trade.currency, false, false)}</td>
|
||||||
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
||||||
<td>{formatPrice(trade.amount, trade.currency, false, false)}</td>
|
<td>{formatPrice(trade.amount, trade.currency, false, false)}</td>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<svelte:options runes={true} />
|
<svelte:options runes={true} />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { crypto, fiat, formatPrice, getAsset } from "$lib/formatPrice";
|
import { crypto, fiat, formatPrice, getAsset } from "$lib/formatPrice";
|
||||||
import {
|
import {
|
||||||
|
@ -93,12 +94,27 @@ let w = $state();
|
||||||
<option value="604800000">Weekly</option>
|
<option value="604800000">Weekly</option>
|
||||||
</select> Volume
|
</select> Volume
|
||||||
</h4>
|
</h4>
|
||||||
<Chart width={w-20} height={500} container={{class:"row"}} layout={chartLayout} grid={gridLayout}>
|
<Chart
|
||||||
<LineSeries data={volume} reactive={true} priceFormat={{precision:2, minMove:.01}}>
|
width={w - 20}
|
||||||
<PriceScale scaleMargins={{bottom:.4, top:.1}}/>
|
height={500}
|
||||||
|
container={{ class: "row" }}
|
||||||
|
layout={chartLayout}
|
||||||
|
grid={gridLayout}
|
||||||
|
>
|
||||||
|
<LineSeries
|
||||||
|
data={volume}
|
||||||
|
reactive={true}
|
||||||
|
priceFormat={{ precision: 2, minMove: 0.01 }}
|
||||||
|
>
|
||||||
|
<PriceScale scaleMargins={{ bottom: 0.4, top: 0.1 }} />
|
||||||
</LineSeries>
|
</LineSeries>
|
||||||
<HistogramSeries data={swaps} reactive={true} priceScaleId="" priceFormat={{precision:0, minMove:1}}>
|
<HistogramSeries
|
||||||
<PriceScale scaleMargins={{top:.7, bottom:0}}/>
|
data={swaps}
|
||||||
|
reactive={true}
|
||||||
|
priceScaleId=""
|
||||||
|
priceFormat={{ precision: 0, minMove: 1 }}
|
||||||
|
>
|
||||||
|
<PriceScale scaleMargins={{ top: 0.7, bottom: 0 }} />
|
||||||
</HistogramSeries>
|
</HistogramSeries>
|
||||||
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
<TimeScale rightBarStaysOnScroll={true} rightOffset={0} />
|
||||||
</Chart>
|
</Chart>
|
||||||
|
@ -118,10 +134,28 @@ let w = $state();
|
||||||
</tr>
|
</tr>
|
||||||
{#each Object.values(markets).toSorted((a, b) => (b.trades?.length || 0) - (a.trades?.length || 0) || (b.offers?.length || 0) - (a.offers?.length || 0) || (b.code < a.code ? 1 : -1)) as market}
|
{#each Object.values(markets).toSorted((a, b) => (b.trades?.length || 0) - (a.trades?.length || 0) || (b.offers?.length || 0) - (a.offers?.length || 0) || (b.code < a.code ? 1 : -1)) as market}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="market/{market.code}">{getAsset(market.code).name} ({market.code})</a></td>
|
<td
|
||||||
<td>{formatPrice(market.trades?.[0]?.price, market.code, true, false) || "-"}</td>
|
><a href="market/{market.code}"
|
||||||
|
>{getAsset(market.code).name} ({market.code})</a
|
||||||
|
></td
|
||||||
|
>
|
||||||
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
market.trades?.[0]?.price,
|
||||||
|
market.code,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
) || "-"}</td
|
||||||
|
>
|
||||||
<td>{market.offers?.length || "-"}</td>
|
<td>{market.offers?.length || "-"}</td>
|
||||||
<td>{formatPrice(market.trades?.reduce((a,b) => a + b.xmrAmount, 0), "XMR", false, false) || "-"}</td>
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
market.trades?.reduce((a, b) => a + b.xmrAmount, 0),
|
||||||
|
"XMR",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
) || "-"}</td
|
||||||
|
>
|
||||||
<td>{market.trades?.length || "-"}</td>
|
<td>{market.trades?.length || "-"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -131,7 +165,14 @@ let w = $state();
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>{Object.values(data.offers).flat().length}</td>
|
<td>{Object.values(data.offers).flat().length}</td>
|
||||||
<td>{formatPrice(data.trades.reduce((a,b) => a + b.xmrAmount, 0), "XMR", false, false)}</td>
|
<td
|
||||||
|
>{formatPrice(
|
||||||
|
data.trades.reduce((a, b) => a + b.xmrAmount, 0),
|
||||||
|
"XMR",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
)}</td
|
||||||
|
>
|
||||||
<td>{data.trades.length}</td>
|
<td>{data.trades.length}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
@ -151,10 +192,18 @@ let w = $state();
|
||||||
</tr>
|
</tr>
|
||||||
{#each data.trades.slice(0, 64) as trade}
|
{#each data.trades.slice(0, 64) as trade}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{new Date(trade.date).toISOString().replace("T", " ").replace(/\.\d*Z/, "")}</td>
|
<td
|
||||||
|
>{new Date(trade.date)
|
||||||
|
.toISOString()
|
||||||
|
.replace("T", " ")
|
||||||
|
.replace(/\.\d*Z/, "")}</td
|
||||||
|
>
|
||||||
<td>{formatPrice(trade.price, trade.currency, true, false)}</td>
|
<td>{formatPrice(trade.price, trade.currency, true, false)}</td>
|
||||||
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
<td>{formatPrice(trade.xmrAmount, "XMR", false, false)}</td>
|
||||||
<td>{formatPrice(trade.amount, trade.currency, false, false)} <span class="trade-currency">{trade.currency}</span></td>
|
<td
|
||||||
|
>{formatPrice(trade.amount, trade.currency, false, false)}
|
||||||
|
<span class="trade-currency">{trade.currency}</span></td
|
||||||
|
>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue