コード例 #1
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out OrderCanceledMessage response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                AccountSubscriptionType.Orders.ToTopicId(),
                OrderEventType.Cancellation.ToString().ToLower()
            },
                out response);

            return(result && response?.Data?.OrderId > 0);
        }
コード例 #2
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out MarketBestBidOfferUpdateMessage response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"tick\"",
                SubscriptionType.MarketBestBidOffer.ToTopicId()
            },
                out response);

            return(result && !string.IsNullOrEmpty(response?.Tick?.Symbol));
        }
コード例 #3
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out MarketByPricePullResponse response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"rep\"",
                SubscriptionType.MarketByPrice.ToTopicId()
            },
                out response);

            return(result && response?.Data?.SeqNum > 0);
        }
コード例 #4
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out MarketCandlestickPullResponse response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"rep\"",
                SubscriptionType.MarketCandlestick.ToTopicId()
            },
                out response);

            return(result && response?.Data?.FirstOrDefault()?.Id > 0);
        }
コード例 #5
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out AccountErrorMessage response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"code\"",
                "\"message\""
            },
                out response);

            return(result && response?.Code != 200);
        }
コード例 #6
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out MarketDepthUpdateMessage response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"tick\"",
                SubscriptionType.MarketDepth.ToTopicId()
            },
                out response);

            return(result && response?.Tick?.Timestamp.Ticks > 0);
        }
コード例 #7
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out AuthenticationResponse response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"req\"",
                "\"auth\""
            },
                out response);

            return(result);
        }
コード例 #8
0
        internal static bool TryParse(
            IHuobiSerializer serializer,
            string input,
            [MaybeNullWhen(false)] out AccountSubscribeResponse response)
        {
            var result = serializer.TryDeserializeIfContains(
                input,
                new[]
            {
                "\"sub\"",
                "\"code\""
            },
                new[]
            {
                "\"message\""
            },
                out response);

            return(result);
        }
コード例 #9
0
        internal static bool TryParse(IHuobiSerializer serializer, string input, [MaybeNullWhen(false)] out ErrorMessage response)
        {
            var result = serializer.TryDeserializeIfContains(input, "\"err-code\"", out response);

            return(result && !string.IsNullOrEmpty(response?.ErrorCode));
        }