aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rates.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rates.ts')
-rw-r--r--lib/rates.ts9
1 files changed, 6 insertions, 3 deletions
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();