@barfinex/types
Version:
Shared TypeScript interfaces for Barfinex — an open-source standard for digital asset trading by Barfin Network.
73 lines (72 loc) • 2.65 kB
TypeScript
import { Detector, DetectorEventType } from "./detector.interface";
import { Connector } from "./connector.interface";
import { AccountEvent } from "./account.interface";
import { ConnectorType, MarketType } from "./connector.interface";
import { Order } from "./order.interface";
import { OrderBook } from "./orderbook.interface";
import { SymbolPrice, Symbol } from "./symbol.interface";
import { Trade } from "./trade.interface";
/**
* Enum representing the types of subscriptions available in the system.
*/
export declare enum SubscriptionType {
/** Subscription for market trade data. */
PROVIDER_MARKETDATA_TRADE = "PROVIDER_MARKETDATA_TRADE",
/** Subscription for market order book updates. */
PROVIDER_MARKETDATA_ORDERBOOK = "PROVIDER_MARKETDATA_ORDERBOOK",
/** Subscription for market candle data (e.g., OHLC data). */
PROVIDER_MARKETDATA_CANDLE = "PROVIDER_MARKETDATA_CANDLE",
/** Subscription for user account events (e.g., balance updates). */
PROVIDER_ACCOUNT_EVENT = "PROVIDER_ACCOUNT_EVENT",
/** Subscription for order updates. */
PROVIDER_ORDER_CREATE = "PROVIDER_ORDER_CREATE",
/** Subscription for order updates. */
PROVIDER_ORDER_CLOSE = "PROVIDER_ORDER_CLOSE",
/** Subscription for symbol price updates. */
PROVIDER_SYMBOLS = "PROVIDER_SYMBOLS",
PROVIDER_SYMBOL_PRICES = "PROVIDER_SYMBOL_PRICES",
INSPECTOR_EVENT = "INSPECTOR_EVENT",
DETECTOR_EVENT = "DETECTOR_EVENT",
ADVISOR_EVENT = "ADVISOR_EVENT"
}
export interface SubscriptionValue {
value: AccountEvent | Order | OrderBook | Trade | Symbol[] | SymbolPrice[] | {
eventType: DetectorEventType;
payload: any;
};
options: {
key?: string;
connectorType?: ConnectorType;
marketType?: MarketType;
};
}
/**
* Interface representing a subscription configuration.
*/
export interface Subscription {
/**
* The type of subscription (e.g., market data, account events).
*/
type: SubscriptionType;
/**
* The symbol or trading pair for the subscription (optional).
* Example: BTC/USD, AAPL.
*/
symbols?: Symbol[];
/**
* Options related to the connector for this subscription (optional).
*/
connector?: Connector;
/**
* Options related to the detector for this subscription (optional).
*/
detector?: Detector;
/**
* The timestamp (Unix time) of the last update for this subscription.
*/
updateMoment?: number;
/**
* Whether the subscription is active.
*/
active: boolean;
}