Пример #1
0
        /// <summary>
        /// Adds extra info to the order for later analysis. Things like indicator values
        /// or anything can be added. Using a delegate function so that we can have one
        /// option to turn off the calculations so that users of this function don't have
        /// to worry if the calculation is expensive and turn it off there too if the option
        /// is disabled.
        /// </summary>
        /// <param name="getFn">Function that returns the key/value to be added</param>
        public void AddExtraInfo(GetExtraInfoFunction getFn)
        {
            if (Simulator.Config.AddExtraOrderInfo == true)
            {
                KeyValuePair <string, object> extraValue = getFn();
                if (ExtraInfo.ContainsKey(extraValue.Key))
                {
                    throw new Exception("Attempting to add a duplicate key for extra info (key=" + extraValue.Key);
                }

                ExtraInfo[extraValue.Key] = extraValue.Value;
            }
        }