@barfinex/types
Version:
Core TypeScript type definitions and shared interfaces for the Barfinex ecosystem. Provides strongly-typed contracts for modules, services, and plugins.
52 lines • 1.28 kB
TypeScript
import { MarketType } from './connector.interface';
import { Instrument } from '.';
/**
* Enum representing the type of trade (buy or sell).
*/
export declare enum TradeSide {
/** Long position (buy). */
LONG = "LONG",
/** Short position (sell). */
SHORT = "SHORT"
}
/**
* Interface representing a single trade.
*/
export interface Trade {
/**
* Timestamp of the trade (Unix time).
*/
time: number;
/**
* Symbol or trading pair for the trade (e.g., BTC/USD).
*/
instrument: Instrument;
/**
* Price at which the trade occurred.
*/
price: number;
/**
* Volume of the asset traded.
*/
volume: number;
/**
* Type of the trade (buy or sell).
*/
side: TradeSide;
/**
* Exchange trade id (when available; e.g. Binance lastTradeId).
*/
tradeId?: string;
/**
* True if buyer was maker (seller was aggressor).
*/
isBuyerMaker?: boolean;
}
/**
* Type representing a handler function for processing a trade.
*
* @param marketType - Type of the market (e.g., spot, futures).
* @param trade - The trade data to process.
*/
export type TradeHandler = (marketType: MarketType, trade: Trade) => void;
//# sourceMappingURL=trade.interface.d.ts.map