feat(visualizer): brick-stack flow bars + DLOB dashboard
This commit is contained in:
@@ -6,6 +6,9 @@ export type Candle = {
|
||||
close: number;
|
||||
volume?: number;
|
||||
oracle?: number | null;
|
||||
flow?: { up: number; down: number; flat: number };
|
||||
flowRows?: number[];
|
||||
flowMoves?: number[];
|
||||
};
|
||||
|
||||
export type SeriesPoint = {
|
||||
@@ -68,9 +71,18 @@ export async function fetchChart(params: {
|
||||
close: Number(c.close),
|
||||
volume: c.volume == null ? undefined : Number(c.volume),
|
||||
oracle: c.oracle == null ? null : Number(c.oracle),
|
||||
flow:
|
||||
(c as any)?.flow && typeof (c as any).flow === 'object'
|
||||
? {
|
||||
up: Number((c as any).flow.up),
|
||||
down: Number((c as any).flow.down),
|
||||
flat: Number((c as any).flow.flat),
|
||||
}
|
||||
: undefined,
|
||||
flowRows: Array.isArray((c as any)?.flowRows) ? (c as any).flowRows.map((x: any) => Number(x)) : undefined,
|
||||
flowMoves: Array.isArray((c as any)?.flowMoves) ? (c as any).flowMoves.map((x: any) => Number(x)) : undefined,
|
||||
})),
|
||||
indicators: json.indicators || {},
|
||||
meta: { tf: String(json.tf || params.tf), bucketSeconds: Number(json.bucketSeconds || 0) },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,16 @@ function resolveGraphqlHttpUrl(): string {
|
||||
|
||||
function resolveGraphqlWsUrl(): string {
|
||||
const explicit = envString('VITE_HASURA_WS_URL');
|
||||
if (explicit) return explicit;
|
||||
if (explicit) {
|
||||
if (explicit.startsWith('ws://') || explicit.startsWith('wss://')) return explicit;
|
||||
if (explicit.startsWith('http://')) return `ws://${explicit.slice('http://'.length)}`;
|
||||
if (explicit.startsWith('https://')) return `wss://${explicit.slice('https://'.length)}`;
|
||||
|
||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const host = window.location.host;
|
||||
const path = explicit.startsWith('/') ? explicit : `/${explicit}`;
|
||||
return `${proto}//${host}${path}`;
|
||||
}
|
||||
|
||||
const httpUrl = resolveGraphqlHttpUrl();
|
||||
if (httpUrl.startsWith('ws://') || httpUrl.startsWith('wss://')) return httpUrl;
|
||||
@@ -170,4 +179,3 @@ export function subscribeGraphqlWs<T>({ query, variables, onData, onError, onSta
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ function getApiUrl(): string | undefined {
|
||||
}
|
||||
|
||||
function getHasuraUrl(): string {
|
||||
return (import.meta as any).env?.VITE_HASURA_URL || 'http://localhost:8080/v1/graphql';
|
||||
return (import.meta as any).env?.VITE_HASURA_URL || '/graphql';
|
||||
}
|
||||
|
||||
function getAuthToken(): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user