chore: update to common redis + top markers account flag
This commit is contained in:
@@ -20,18 +20,15 @@ import {
|
||||
OrderActionRecord,
|
||||
Event,
|
||||
} from '@drift-labs/sdk';
|
||||
import { RedisClient, RedisClientPrefix } from '@drift/common';
|
||||
|
||||
import { logger, setLogLevel } from '../utils/logger';
|
||||
import { sleep } from '../utils/utils';
|
||||
import { RedisClient } from '../utils/redisClient';
|
||||
import { fromEvent, filter, map } from 'rxjs';
|
||||
|
||||
require('dotenv').config();
|
||||
const driftEnv = (process.env.ENV || 'devnet') as DriftEnv;
|
||||
const commitHash = process.env.COMMIT;
|
||||
const REDIS_HOST = process.env.REDIS_HOST || 'localhost';
|
||||
const REDIS_PORT = process.env.REDIS_PORT || '6379';
|
||||
const REDIS_PASSWORD = process.env.REDIS_PASSWORD;
|
||||
|
||||
//@ts-ignore
|
||||
const sdkConfig = initialize({ env: process.env.ENV });
|
||||
@@ -70,6 +67,9 @@ const main = async () => {
|
||||
env: driftEnv,
|
||||
});
|
||||
|
||||
const redisClient = new RedisClient({ prefix: RedisClientPrefix.DLOB });
|
||||
await redisClient.connect();
|
||||
|
||||
const slotSubscriber = new SlotSubscriber(connection, {});
|
||||
|
||||
const lamportsBalance = await connection.getBalance(wallet.publicKey);
|
||||
@@ -86,9 +86,6 @@ const main = async () => {
|
||||
|
||||
await slotSubscriber.subscribe();
|
||||
|
||||
const redisClient = new RedisClient(REDIS_HOST, REDIS_PORT, REDIS_PASSWORD);
|
||||
await redisClient.connect();
|
||||
|
||||
const eventSubscriber = new EventSubscriber(connection, driftClient.program, {
|
||||
maxTx: 8192,
|
||||
maxEventsPerType: 4096,
|
||||
@@ -182,9 +179,9 @@ const main = async () => {
|
||||
})
|
||||
)
|
||||
.subscribe((fillEvent) => {
|
||||
redisClient.client.publish(
|
||||
redisClient.publish(
|
||||
`trades_${fillEvent.marketType}_${fillEvent.marketIndex}`,
|
||||
JSON.stringify(fillEvent)
|
||||
fillEvent
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user