/// <summary>
        /// Get existing or create a new position.
        /// </summary>
        public Position ObtainPositionBySymbol(Symbol symbol)
        {
            Position position = GetPositionBySymbol(symbol, true);

            if (position == null)
            {
                if (_delivery == null)
                {
                    SystemMonitor.Warning("Failed to get required delivery to compose a position.");
                    return(null);
                }

                if (_provider.SupportsActiveOrderManagement)
                {
                    position = new ActivePosition();
                }
                else
                {
                    position = new PassivePosition();
                }

                if (position.SetInitialParameters(_manager, _provider, _delivery, symbol) == false)
                {
                    SystemMonitor.Warning("Failed to create a position due to set initial error.");
                    return(null);
                }

                if (position.Initialize() == false)
                {
                    SystemMonitor.Warning("Failed to initialize a position.");
                    return(null);
                }

                if (AddPosition(position) == false)
                {// For some reason adding failed, so dispose the current position
                    // and try again to return one, maybe it was added in the mean time.
                    position.UnInitialize();
                    position.Dispose();
                    position = null;

                    return(GetPositionBySymbol(symbol, true));
                }
            }

            return(position);
        }
        /// <summary>
        /// Get existing or create a new position.
        /// </summary>
        public Position ObtainPositionBySymbol(Symbol symbol)
        {
            Position position = GetPositionBySymbol(symbol, true);
            if (position == null)
            {
                if (_delivery == null)
                {
                    SystemMonitor.Warning("Failed to get required delivery to compose a position.");
                    return null;
                }

                if (_provider.SupportsActiveOrderManagement)
                {
                    position = new ActivePosition();
                }
                else
                {
                    position = new PassivePosition();
                }

                if (position.SetInitialParameters(_manager, _provider, _delivery, symbol) == false)
                {
                    SystemMonitor.Warning("Failed to create a position due to set initial error.");
                    return null;
                }

                if (position.Initialize() == false)
                {
                    SystemMonitor.Warning("Failed to initialize a position.");
                    return null;
                }

                if (AddPosition(position) == false)
                {// For some reason adding failed, so dispose the current position
                    // and try again to return one, maybe it was added in the mean time.
                    position.UnInitialize();
                    position.Dispose();
                    position = null;

                    return GetPositionBySymbol(symbol, true);
                }
            }

            return position;
        }