Пример #1
0
        /// <summary>
        /// Just a private helper method that calls the appropriate DetectAndExecuteRollupTransfers of the TransferManager depending on the arbitration
        /// mode of the current run. If the current run is in simulation mode, the created transfers are added to the _transfersInProcess list.
        /// </summary>
        /// <param name="rollupNumber">Number of trades to roll up on.</param>
        /// <returns></returns>
        private void DetectAndExecuteRollupTransfer(int rollupNumber)
        {
            List <Transfer> transferList = null;

            switch (_currentRun.ArbitrationMode)
            {
            case ArbitrationMode.Live:

                transferList = TransferManager.DetectAndExecuteRollupTransfers_Live(rollupNumber, _currentRun.Id.Value, _currentRun.ExchangeList, log);
                break;

            case ArbitrationMode.Simulation:

                transferList = TransferManager.DetectAndExecuteRollupTransfers_Simulate(rollupNumber, _currentRun.Id.Value, _currentRun.ExchangeList, log);

                if (transferList != null)
                {
                    _transfersInProcess.AddRange(transferList);
                }

                break;
            }

            //If some transfers occured, display them to the output window
            if (transferList != null && transferList.Count > 0)
            {
                DisplayTransferList(transferList);
            }
        }
Пример #2
0
        public bool CompleteTransfersFromPreviousRun(int arbitrationRunId)
        {
            //Get arbitration run record from the db:
            ArbitrationRun previousRun = ArbitrationRun.GetArbitrationRunFromDbById(arbitrationRunId);

            //Ensure the given was in live mode, as this is to poin to completing transfers from a simulated run
            if (previousRun.ArbitrationMode == ArbitrationMode.Simulation)
            {
                ArbitrationManagerFailureEventHandler handler = ErrorOccured;

                //Only  throw the event is there is a listener
                if (handler != null)
                {
                    handler(this, new ArbitrationManagerFailureEventArgs("Arbitration run " + arbitrationRunId + " was ran in simulation mode; no point in completing transfers for it."));
                    return(false);
                }
            }

            //First need to build up the exchange list, as it is needed by the transfer manager.
            List <BaseExchange> previousRunExchangeList = BuildExchangeListFromPreviousRun(previousRun);

            TransferManager.DetectAndExecuteRollupTransfers_Live(1, previousRun.Id.Value, previousRunExchangeList);

            return(true);
        }