Beispiel #1
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")
     });
 }
Beispiel #2
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")
     });
 }
Beispiel #3
0
        public TradeAnswer Trade(BtcePair pair, TradeType type, decimal rate, decimal amount)
        {
            var args = new Dictionary <string, string>()
            {
                { "method", "Trade" },
                { "pair", BtcePairHelper.ToString(pair) },
                { "type", TradeTypeHelper.ToString(type) },
                { "rate", DecimalToString(rate) },
                { "amount", DecimalToString(amount) }
            };
            var result = JObject.Parse(Query(args));

            if (result.Value <int>("success") == 0)
            {
                throw new Exception(result.Value <string>("error"));
            }
            return(TradeAnswer.ReadFromJObject(result["return"] as JObject));
        }