Beispiel #1
0
 public static UserInfo ReadFromJObject(JObject o)
 {
     return(new UserInfo()
     {
         Funds = Funds.ReadFromJObject(o["funds"] as JObject),
         Rights = Rights.ReadFromJObject(o["rights"] as JObject),
         TransactionCount = o.Value <int>("transaction_count"),
         OpenOrders = o.Value <int>("open_orders"),
         ServerTime = UnixTime.ConvertToDateTime(o.Value <UInt32>("server_time"))
     });
 }
Beispiel #2
0
        public static InfoAnswer ReadFromJObject(JObject o)
        {
            var pair_info_reader = new Func <JContainer, PairInfo>(
                x => PairInfo.ReadFromJObject(x as JObject)
                );

            return(new InfoAnswer()
            {
                ServerTime = UnixTime.ConvertToDateTime(
                    o.Value <UInt32>("server_time")),
                Pairs = JsonHelpers.ReadPairDict <PairInfo>(
                    o.Value <JObject>("pairs"), pair_info_reader)
            });
        }
Beispiel #3
0
        public static TradeInfoV3 ReadFromJObject(JObject o)
        {
            if (o == null)
            {
                return(null);
            }

            return(new TradeInfoV3
            {
                Amount = o.Value <decimal>("amount"),
                Price = o.Value <decimal>("price"),
                Timestamp = UnixTime.ConvertToDateTime(o.Value <UInt32>("timestamp")),
                Tid = o.Value <UInt32>("tid"),
                TradeType = TradeInfoTypeHelper.FromString(o.Value <string>("type"))
            });
        }
 public static Transaction ReadFromJObject(JObject o)
 {
     if (o == null)
     {
         return(null);
     }
     return(new Transaction()
     {
         Type = (TransType)o.Value <int>("type"),
         Amount = o.Value <decimal>("amount"),
         Currency = WexCurrencyHelper.FromString(o.Value <string>("currency")),
         Description = o.Value <string>("desc"),
         Status = (TransStatus)o.Value <int>("status"),
         Timestamp = UnixTime.ConvertToDateTime(o.Value <UInt32>("timestamp"))
     });
 }
Beispiel #5
0
        public static Order ReadFromJObject(JObject o)
        {
            if (o == null)
            {
                return(null);
            }

            return(new Order()
            {
                Pair = WexPairHelper.FromString(o.Value <string>("pair")),
                Type = TradeTypeHelper.FromString(o.Value <string>("type")),
                Amount = o.Value <decimal>("amount"),
                StartAmount = o.Value <decimal>("start_amount"),
                Rate = o.Value <decimal>("rate"),
                TimestampCreated = UnixTime.ConvertToDateTime(
                    o.Value <UInt32>("timestamp_created")),
                Status = o.Value <int>("status"),
            });
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }

            if (reader.TokenType == JsonToken.Integer)
            {
                var instance = (UInt32)serializer.Deserialize(reader, typeof(UInt32));
                return(UnixTime.ConvertToDateTime(instance));
            }

            throw new WexApiException("UnixTimeJsonConverter: Unexpected reader.TokenType=" + reader.TokenType);
        }
Beispiel #7
0
        public static TickerAnswer ReadFromJObject(JObject o)
        {
            if (o == null)
            {
                return(null);
            }

            return(new TickerAnswer()
            {
                High = o.Value <decimal>("high"),
                Low = o.Value <decimal>("low"),
                Average = o.Value <decimal>("avg"),
                Volume = o.Value <decimal>("vol"),
                VolumeCurrent = o.Value <decimal>("vol_cur"),
                Last = o.Value <decimal>("last"),
                Buy = o.Value <decimal>("buy"),
                Sell = o.Value <decimal>("sell"),
                Updated = UnixTime.ConvertToDateTime(o.Value <UInt32>("updated")),
            });
        }
Beispiel #8
0
 public override string ToString() => $"[{Status}] {Pair}: {TradeType} {Amount} by {Rate} on {UnixTime.ConvertToDateTime(TimestampCreated)}";