UNPKG

@copytrade/unified-broker

Version:

Unified broker interface library for Indian stock market brokers with plugin architecture

55 lines 1.59 kB
"use strict"; /** * Generic Broker Service Interface * This interface defines the contract that all broker services must implement * to eliminate hardcoded broker-specific checks throughout the codebase * * NOTE: This interface is being deprecated in favor of IUnifiedBrokerService * which provides standardized responses and better business logic encapsulation */ Object.defineProperty(exports, "__esModule", { value: true }); exports.IBrokerService = void 0; /** * Abstract base class for all broker services * Provides common functionality and enforces interface implementation */ class IBrokerService { constructor(brokerName) { this.isConnected = false; this.brokerName = brokerName; } // Common methods with default implementations getBrokerName() { return this.brokerName; } isLoggedIn() { return this.isConnected; } getAccountId() { return this.accountId; } setConnected(connected, accountId) { this.isConnected = connected; if (accountId) { this.accountId = accountId; } } // Helper method to standardize error responses createErrorResponse(message, error) { return { success: false, message, data: error }; } // Helper method to standardize success responses createSuccessResponse(message, data) { return { success: true, message, data }; } } exports.IBrokerService = IBrokerService; //# sourceMappingURL=IBrokerService.js.map