UNPKG

metaapi.cloud-sdk

Version:

SDK for MetaApi, a professional cloud forex API which includes MetaTrader REST API and MetaTrader websocket API. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). CopyFactory copy trading API included. (https://metaapi.cloud)

59 lines (58 loc) 1.6 kB
import type AsyncProcess from './asyncProcess'; import { Scheduler } from '../../types/lrap'; import AsyncProcessPool from './asyncProcessPool'; /** * Process context */ declare class ProcessContext { private _context; private _scheduler; private _runChildren?; private _process; /** * Constructs instance * @param poolContext context from pool * @param scheduler process scheduler * @param childPoolConstructor child pool constructor */ constructor(poolContext: AsyncProcessPool.Context, scheduler: Scheduler<AsyncProcess>); /** * Returns process ID * @returns process ID */ get processId(): string; /** * Returns current process stage * @returns process stage */ get stage(): ProcessContext.ProcessStage; /** * Whether the process was scheduled to cancel by external command (cancel or restart) * @returns whether canceled */ get canceled(): boolean; /** * Returns process IDs chain from root process * @returns process IDs chain */ getProcessIdChain(): string[]; /** * Process this context relates to. Called automatically by async pool * @param process current process */ initialize(process: AsyncProcess): void; /** * Releases internal resources. Called automatically by async pool */ release(): void; } declare namespace ProcessContext { /** Process stage */ enum ProcessStage { STARTING = 0, RUNNING = 1, STOPPING = 2, STOPPED = 3 } } export default ProcessContext;