示例#1
0
 public static SubscribeMessage ToFundingTicker(FundingSymbols symbol)
 {
     return(new SubscribeMessage
     {
         ChannelName = @"fticker",
         Symbol = EnumStringValueAttribute.GetValue(symbol)
     });
 }
示例#2
0
 public static SubscribeMessage ToTrades(TradingSymbols symbol)
 {
     return(new SubscribeMessage
     {
         ChannelName = @"trades",
         Symbol = EnumStringValueAttribute.GetValue(symbol)
     });
 }
示例#3
0
 public static SubscribeMessage ToTradingCandles(TradingSymbols symbol, CandlesTimeFrame timeFrame)
 {
     return(new SubscribeMessage
     {
         ChannelName = @"candles",
         Key =
             $"trade:{EnumStringValueAttribute.GetValue(timeFrame)}:{EnumStringValueAttribute.GetValue(symbol)}"
     });
 }
        /// <summary>
        /// Converts a value.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var enumObject = value as ObservableCollection <MealTypes>;

            if (enumObject != null)
            {
                return(enumObject.Select(x => EnumStringValueAttribute.GetStringValue(x)));
            }
            return(null);
        }
示例#5
0
 public static SubscribeMessage ToRawOrderBook(FundingSymbols symbol, BooksLimit limit)
 {
     return(new SubscribeMessage
     {
         ChannelName = @"book",
         Symbol = EnumStringValueAttribute.GetValue(symbol),
         Precision = EnumStringValueAttribute.GetValue(BooksPrecision.NoAggregation),
         Length = ((int)limit).ToString()
     });
 }
示例#6
0
 public static SubscribeMessage ToOrderBook(FundingSymbols symbol, BooksPrecision precision, BooksFrequency frequency,
                                            BooksLimit limit)
 {
     return(new SubscribeMessage
     {
         ChannelName = @"book",
         Symbol = EnumStringValueAttribute.GetValue(symbol),
         Precision = EnumStringValueAttribute.GetValue(precision),
         Frequency = EnumStringValueAttribute.GetValue(frequency),
         Length = ((int)limit).ToString()
     });
 }
        /// <summary>
        /// Converts a value.
        /// </summary>
        /// <param name="value">The value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var mealType = value as MealTypes?;

            return(mealType.HasValue ? EnumStringValueAttribute.GetStringValue(mealType) : String.Empty);
        }
 public void Ctor_CallWithNullText_ThrowsException()
 {
     var _ = new EnumStringValueAttribute(null);
 }
        public void Ctor_CallWithString_Succeeds()
        {
            var attr = new EnumStringValueAttribute("Text");

            Assert.Equal("Text", attr.Text);
        }
        public void Ctor_CallWithStringEmpty_Succeeds()
        {
            var attr = new EnumStringValueAttribute(string.Empty);

            Assert.Equal(string.Empty, attr.Text);
        }