Improve local defaults and replay candle fetch
This commit is contained in:
parent
b9ad182473
commit
1583a50412
11 changed files with 193 additions and 42 deletions
|
|
@ -22,6 +22,10 @@ const DARK_SEQUENCE: DarkScenario[] = [
|
|||
"sell",
|
||||
"sell"
|
||||
];
|
||||
const SYNTHETIC_SYMBOLS = [
|
||||
"SPY",
|
||||
...SP500_SYMBOLS.filter((symbol) => symbol !== "SPY")
|
||||
];
|
||||
|
||||
const hashSymbol = (value: string): number => {
|
||||
let hash = 0;
|
||||
|
|
@ -138,7 +142,7 @@ export const createSyntheticEquitiesAdapter = (
|
|||
const now = Date.now();
|
||||
const batchSize = 3;
|
||||
|
||||
const darkSymbol = SP500_SYMBOLS[darkSymbolIndex % SP500_SYMBOLS.length];
|
||||
const darkSymbol = SYNTHETIC_SYMBOLS[darkSymbolIndex % SYNTHETIC_SYMBOLS.length];
|
||||
const darkHash = hashSymbol(darkSymbol);
|
||||
const darkBase = 25 + (darkHash % 475);
|
||||
const darkDrift = ((darkStep % 24) - 12) * 0.08;
|
||||
|
|
@ -189,7 +193,7 @@ export const createSyntheticEquitiesAdapter = (
|
|||
|
||||
for (let i = 0; i < batchSize; i += 1) {
|
||||
seq += 1;
|
||||
const symbol = SP500_SYMBOLS[(seq + i) % SP500_SYMBOLS.length];
|
||||
const symbol = SYNTHETIC_SYMBOLS[(seq + i) % SYNTHETIC_SYMBOLS.length];
|
||||
const symbolHash = hashSymbol(symbol);
|
||||
const basePrice = 25 + (symbolHash % 475);
|
||||
const mid = formatPrice(basePrice + ((seq % 40) - 20) * 0.05);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ const service = "ingest-equities";
|
|||
const logger = createLogger({ service });
|
||||
|
||||
const envSchema = z.object({
|
||||
NATS_URL: z.string().default("nats://localhost:4222"),
|
||||
CLICKHOUSE_URL: z.string().default("http://localhost:8123"),
|
||||
NATS_URL: z.string().default("nats://127.0.0.1:4222"),
|
||||
CLICKHOUSE_URL: z.string().default("http://127.0.0.1:8123"),
|
||||
CLICKHOUSE_DATABASE: z.string().default("default"),
|
||||
EQUITIES_INGEST_ADAPTER: z.string().min(1).default("synthetic"),
|
||||
EMIT_INTERVAL_MS: z.coerce.number().int().positive().default(1000),
|
||||
|
|
@ -129,7 +129,7 @@ const run = async () => {
|
|||
servers: env.NATS_URL,
|
||||
name: service
|
||||
},
|
||||
{ attempts: 20, delayMs: 500 }
|
||||
{ attempts: 120, delayMs: 500 }
|
||||
);
|
||||
|
||||
await ensureStream(jsm, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue