Exemple #1
0
        /// <summary>
        /// Called when a quant fund is terminated.
        /// </summary>
        public void OnTermination()
        {
            //Process each on termination event handler
            bool isliquidate = true;

            Modules.ForEach(x =>
            {
                x.OnTermination(out bool liquidate);
                if (!liquidate)
                {
                    isliquidate = false;
                }
            });

            //Check if we need to liquidate
            if (isliquidate)
            {
                //Cancel all pending orders
                var po = PendingOrders.Cancel();
                po.ForEach(o => _log.Info($"Cancelled the following pending order on terminate: {o.OrderId} for fund with id {o.FundId}"));

                //Liquidate current quant fund
                Liquidate();
            }
        }