aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-06 10:32:04 -0700
committerAdam Soltys <[email protected]>2024-09-06 10:32:04 -0700
commit3bb28f1268243ddd6920d7446e3a060a6c11bd5c (patch)
tree2bc710f004be6258cd9b0145885b095f12b2f914
parentda4ba5fd8a287b5c12e396c5fc478cdca7e3e8d3 (diff)
downloadcoinos-server-3bb28f1268243ddd6920d7446e3a060a6c11bd5c.tar.gz
coinos-server-3bb28f1268243ddd6920d7446e3a060a6c11bd5c.zip
iranian toman
-rw-r--r--lib/countries.ts2
-rw-r--r--lib/rates.ts9
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();