feat(chart): parse candle flow rows for brick bars
This commit is contained in:
@@ -6,6 +6,9 @@ export type Candle = {
|
|||||||
close: number;
|
close: number;
|
||||||
volume?: number;
|
volume?: number;
|
||||||
oracle?: number | null;
|
oracle?: number | null;
|
||||||
|
flow?: { up: number; down: number; flat: number };
|
||||||
|
flowRows?: number[];
|
||||||
|
flowMoves?: number[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SeriesPoint = {
|
export type SeriesPoint = {
|
||||||
@@ -68,9 +71,18 @@ export async function fetchChart(params: {
|
|||||||
close: Number(c.close),
|
close: Number(c.close),
|
||||||
volume: c.volume == null ? undefined : Number(c.volume),
|
volume: c.volume == null ? undefined : Number(c.volume),
|
||||||
oracle: c.oracle == null ? null : Number(c.oracle),
|
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 || {},
|
indicators: json.indicators || {},
|
||||||
meta: { tf: String(json.tf || params.tf), bucketSeconds: Number(json.bucketSeconds || 0) },
|
meta: { tf: String(json.tf || params.tf), bucketSeconds: Number(json.bucketSeconds || 0) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user