diff options
| author | Adam Soltys <[email protected]> | 2024-09-06 10:32:04 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-06 10:32:04 -0700 |
| commit | 3bb28f1268243ddd6920d7446e3a060a6c11bd5c (patch) | |
| tree | 2bc710f004be6258cd9b0145885b095f12b2f914 /lib | |
| parent | da4ba5fd8a287b5c12e396c5fc478cdca7e3e8d3 (diff) | |
| download | coinos-server-3bb28f1268243ddd6920d7446e3a060a6c11bd5c.tar.gz coinos-server-3bb28f1268243ddd6920d7446e3a060a6c11bd5c.zip | |
iranian toman
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/countries.ts | 2 | ||||
| -rw-r--r-- | 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(); |
