feat: price chart

This commit is contained in:
2024-01-26 10:12:35 +00:00
parent 9a220fafd5
commit 4f4649da2c
4 changed files with 114 additions and 8 deletions

View File

@ -380,12 +380,16 @@ export class Connection extends EventEmitter<ConnectionEvents> {
} else if (cmd[0] === "SYNC") {
const [_, id, eventSet, ...filters] = cmd;
const lastResortSync = () => {
const latest = eventSet.reduce((acc, v) => (acc = v.created_at > acc ? v.created_at : acc), 0);
const newFilters = filters.map(a => ({
...a,
since: latest,
}));
this.queueReq(["REQ", id, ...newFilters], item.cb);
if (filters.some(a => a.since || a.until)) {
this.queueReq(["REQ", id, ...filters], item.cb);
} else {
const latest = eventSet.reduce((acc, v) => (acc = v.created_at > acc ? v.created_at : acc), 0);
const newFilters = filters.map(a => ({
...a,
since: latest,
}));
this.queueReq(["REQ", id, ...newFilters], item.cb);
}
};
if (this.Info?.software?.includes("strfry")) {
const neg = new NegentropyFlow(id, this, eventSet, filters);