From aced36c5ec732755f4889d43475eb365e6a9f9e8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Oct 2024 00:08:09 -0700 Subject: send rate from memory --- lib/rates.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/rates.ts') diff --git a/lib/rates.ts b/lib/rates.ts index b337d543..0dc3f8aa 100644 --- a/lib/rates.ts +++ b/lib/rates.ts @@ -5,6 +5,7 @@ import { g, s } from "$lib/db"; import { sleep } from "$lib/utils"; import WebSocket from "ws"; +export let rate; let last; let ws; let connect = async () => { @@ -28,7 +29,8 @@ let connect = async () => { (await got("https://api.nobitex.ir/v2/orderbook/BTCIRT").json()) as any ).lastTradePrice; - s("rate", msg.c); + rate = msg.c; + s("rate", rate); s("rates", rates); last = Date.now(); } catch (e) { -- cgit v1.2.3