diff options
| author | Adam Soltys <[email protected]> | 2024-10-14 00:08:09 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-14 00:08:09 -0700 |
| commit | aced36c5ec732755f4889d43475eb365e6a9f9e8 (patch) | |
| tree | 6be792469a6c578615401e6f79ff27a5476b8b51 /lib | |
| parent | afbef8dd8dac9e1e71415914f2ecab7ce85f1fa5 (diff) | |
| download | coinos-server-aced36c5ec732755f4889d43475eb365e6a9f9e8.tar.gz coinos-server-aced36c5ec732755f4889d43475eb365e6a9f9e8.zip | |
send rate from memory
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rates.ts | 4 |
1 files changed, 3 insertions, 1 deletions
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) { |
