Ejemplo n.º 1
0
 private static Dictionary <BtcePair, T> ReadPairDict <T>(JObject o, Func <JContainer, T> valueReader)
 {
     return
         (o.OfType <JProperty>()
          .Select(
              x =>
              new KeyValuePair <BtcePair, T>(BtcePairHelper.FromString(x.Name), valueReader(x.Value as JContainer)))
          .ToDictionary(x => x.Key, x => x.Value));
 }
Ejemplo n.º 2
0
 public static Order ReadFromJObject(JObject o)
 {
     if (o == null)
     {
         return(null);
     }
     return(new Order()
     {
         Pair = BtcePairHelper.FromString(o.Value <string>("pair")),
         Type = TradeTypeHelper.FromString(o.Value <string>("type")),
         Amount = o.Value <decimal>("amount"),
         Rate = o.Value <decimal>("rate"),
         TimestampCreated = o.Value <UInt32>("timestamp_created"),
         Status = o.Value <int>("status")
     });
 }
Ejemplo n.º 3
0
 public static Trade ReadFromJObject(JObject o)
 {
     if (o == null)
     {
         return(null);
     }
     return(new Trade
     {
         Pair = BtcePairHelper.FromString(o.Value <string>("pair")),
         Type = TradeTypeHelper.FromString(o.Value <string>("type")),
         Amount = o.Value <decimal>("amount"),
         Rate = o.Value <decimal>("rate"),
         Timestamp = o.Value <uint>("timestamp"),
         IsYourOrder = o.Value <int>("is_your_order") == 1,
         OrderId = o.Value <int>("order_id")
     });
 }
Ejemplo n.º 4
0
        public static TradeInfo ReadFromJObject(JObject o)
        {
            if (o == null)
            {
                return(null);
            }

            return(new TradeInfo
            {
                Amount = o.Value <decimal>("amount"),
                Price = o.Value <decimal>("price"),
                Date = UnixTime.ConvertToDateTime(o.Value <uint>("date")),
                Item = BtceCurrencyHelper.FromString(o.Value <string>("item")),
                PriceCurrency = BtceCurrencyHelper.FromString(o.Value <string>("price_currency")),
                Tid = o.Value <uint>("tid"),
                Type = TradeInfoTypeHelper.FromString(o.Value <string>("trade_type")),
                CurrencyPair =
                    BtcePairHelper.FromString(o.Value <string>("item") + "_" + o.Value <string>("price_currency"))
            });
        }