UNPKG

fixparser

Version:

FIX.Latest / 5.0 SP2 Parser

108 lines (107 loc) 3.41 kB
import type { KeyObject } from 'node:tls'; import type { ProxyAgent } from 'proxy-agent'; import type { IMessageStore } from 'fixparser-common'; import type { FIXParser } from './FIXParser'; import type { ConnectionType, FIXParserBase, Options as FIXParserOptions, Protocol } from './FIXParserBase'; import type { Options as FIXParserBrowserOptions } from './FIXParserBrowser'; import type { Field } from './fields/Field'; import type { Logger } from './logger/Logger'; import type { Message } from './message/Message'; import type { Parser } from './util/util'; export interface IFIXParser { host: string | undefined; port: number | undefined; protocol: Protocol | undefined; sender: string | undefined; target: string | undefined; heartBeatInterval: number; fixVersion: string; connectionType: ConnectionType; parserName: Parser; fixParserBase?: FIXParserBase; messageCounter?: number; heartBeatIntervalId: ReturnType<typeof setInterval> | undefined; connected: boolean; messageStoreIn: IMessageStore<Message>; messageStoreOut: IMessageStore<Message>; fixParser?: FIXParser; isLoggedIn?: boolean; requestedLogout?: boolean; logger: Logger; proxy?: ProxyAgent; tlsKey?: string | Buffer | Array<string | Buffer | KeyObject>; tlsCert?: string | Buffer | Array<string | Buffer>; tlsUseSNI?: boolean; tlsSkipStdInPipe?: boolean; skipValidation?: boolean; /** * Connect to a remote FIX server/gateway. * @param options - Connection options. */ connect?(options: FIXParserOptions | FIXParserBrowserOptions): void; /** * Get the next outgoing message sequence number. * * @returns The next outgoing message sequence number. */ getNextTargetMsgSeqNum(): number; /** * Set the next outgoing message sequence number. * * @param nextMsgSeqNum - The next message sequence number. * @returns The next outgoing message sequence number. */ setNextTargetMsgSeqNum(nextMsgSeqNum: number): number; /** * Get current timestamp. * * @param dateObject - An instance of a Date class. * @returns The current timestamp. */ getTimestamp(dateObject: Date): string; /** * Create an instance of a FIX Message. * * @param fields - An array of Fields. * @returns A FIX Message class instance. */ createMessage(...fields: Field[]): Message; /** * Parse a FIX message string into Message instance(s). * * @param data - FIX message string. * @returns FIX Message class instance(s). */ parse(data: string): Message[]; /** * Send a FIX message. * * @param message - FIX Message class instance. */ send(message: Message): void; /** * Get connection status. * * @returns Current connection status. */ isConnected(): boolean; /** * Close current connection. */ close(): void; /** * Stop heartbeat interval. */ stopHeartbeat(): void; /** * Restart heartbeat interval. */ restartHeartbeat(): void; /** * Start heartbeat interval. * * @param heartBeatInterval - Heartbeat interval in seconds. * @param disableLog - Whether to disable heartbeat logs. */ startHeartbeat(heartBeatInterval: number, disableLog?: boolean): void; }