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/countries.ts | 2 +- lib/rates.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/countries.ts b/lib/countries.ts index 70f04c84..73fea1ff 100644 --- a/lib/countries.ts +++ b/lib/countries.ts @@ -100,7 +100,7 @@ export default { IS: "ISK", IN: "INR", ID: "IDR", - IR: "IRR", + IR: "IRT", IQ: "IQD", IE: "EUR", IM: "GBP", 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