Exemplo n.º 1
0
        public static DataType ToDataType(this MessageTypes type, object arg)
        {
            switch (type)
            {
            case MessageTypes.Security:
                return(DataType.Securities);

            case MessageTypes.Board:
                return(DataType.Board);

            case MessageTypes.Portfolio:
            case MessageTypes.PositionChange:
                return(DataType.PositionChanges);

            case MessageTypes.News:
                return(DataType.News);

            case MessageTypes.BoardState:
                return(DataType.Board);

            case MessageTypes.Level1Change:
                return(DataType.Level1);

            case MessageTypes.QuoteChange:
                return(DataType.MarketDepth);

            case MessageTypes.Execution:
                return(((ExecutionTypes)arg).ToDataType());

            case MessageTypes.TimeFrameInfo:
                return(DataType.TimeFrames);

            case MessageTypes.UserInfo:
                return(DataType.Users);

            default:
            {
                if (type.IsCandle())
                {
                    return(DataType.Create(type.ToCandleMessage(), arg));
                }

                throw new ArgumentOutOfRangeException(nameof(type), type, LocalizedStrings.Str1219);
            }
            }
        }