示例#1
0
        public static MetaFormulaItem Create(FormulaItem argument)
        {
            if (argument == null)
            {
                return(null);
            }

            return(new MetaFormulaItem(argument));
        }
示例#2
0
        public MetaFormulaItem(FormulaItem arg)
        {
            Substream         = arg.Substream;
            Value             = arg.Value;
            PeriodShift       = Util.ReplaceParameter(arg.PeriodShift);
            PeriodShiftSource = arg.PeriodShiftSource;
            switch (arg.ValueType)
            {
            case FormulaItem.STREAM_VALUE:
                ValueType = FormulaItemType.StreamValue;
                break;

            case FormulaItem.STREAM:
                ValueType = FormulaItemType.Stream;
                break;

            case FormulaItem.VALUE:
                ValueType = FormulaItemType.Value;
                break;

            case FormulaItem.OPERAND:
                ValueType = FormulaItemType.Operand;
                break;

            case FormulaItem.PARAM:
                ValueType = FormulaItemType.Parameter;
                break;

            default:
                throw new NotImplementedException();
            }

            switch (arg.StreamType)
            {
            case FormulaItem.NOT_USED:
                StreamType = ValueType == FormulaItemType.Stream ? StreamType.Indicator : StreamType.NotUsed;
                break;

            case FormulaItem.INDICATOR:
                StreamType = StreamType.Indicator;
                break;

            case FormulaItem.INSTRUMENT:
                StreamType = StreamType.Instrument;
                break;

            default:
                throw new NotImplementedException();
            }
        }