From 3bb28f1268243ddd6920d7446e3a060a6c11bd5c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Sep 2024 10:32:04 -0700 Subject: iranian toman --- lib/rates.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/rates.ts') diff --git a/lib/rates.ts b/lib/rates.ts index 6172f5eb..b337d543 100644 --- a/lib/rates.ts +++ b/lib/rates.ts @@ -16,15 +16,18 @@ let connect = async () => { ws.onmessage = async function (event) { try { let msg = JSON.parse(event.data); - let rates = await g("rates") || {}; - let fx = await g("fx"); - if (fx) ({ fx } = fx); + let rates = (await g("rates")) || {}; + let { fx } = await g("fx") || {}; if (!fx) return; Object.keys(fx).map((symbol) => { rates[symbol] = msg.c * fx[symbol]; }); + rates["IRT"] = ( + (await got("https://api.nobitex.ir/v2/orderbook/BTCIRT").json()) as any + ).lastTradePrice; + s("rate", msg.c); s("rates", rates); last = Date.now(); -- cgit v1.2.3