コード例 #1
0
ファイル: BtceApi.cs プロジェクト: wishhhmaster/CoinTNet
        public OrderList GetOpenOrders(BtcePair?pair)
        {
            var args = new Dictionary <string, string>()
            {
                { "method", "ActiveOrders" }
            };

            if (pair.HasValue)
            {
                args["pair"] = BtcePairHelper.ToString(pair.Value);
            }

            var result = JObject.Parse(Query(args));

            if (result.Value <int>("success") == 0)
            {
                if (result.Value <string>("error") != "no orders")
                {
                    throw new Exception(result.Value <string>("error"));
                }
                else
                {
                    return(new OrderList());
                }
            }
            return(OrderList.ReadFromJObject(result["return"] as JObject));
        }
コード例 #2
0
 public TradeHistory GetTradeHistory(
     int?from       = null,
     int?count      = null,
     int?fromId     = null,
     int?endId      = null,
     bool?orderAsc  = null,
     DateTime?since = null,
     DateTime?end   = null,
     BtcePair?pair  = null)
 {
     return(_apiv2.GetTradeHistory(from, count, fromId, endId, orderAsc, since, end, pair));
 }
コード例 #3
0
 public OrderList GetOrderList(
     int?from       = null,
     int?count      = null,
     int?fromId     = null,
     int?endId      = null,
     bool?orderAsc  = null,
     DateTime?since = null,
     DateTime?end   = null,
     BtcePair?pair  = null,
     bool?active    = null)
 {
     throw new BtceException(
               "GetOrderList() is depricated and will no longer be supported as of Nov. 1st 2013. Please use GetActiveOrders() instead.");
 }
コード例 #4
0
        public OrderList GetActiveOrders(BtcePair?pair = null)
        {
            var args = new Dictionary <string, string>()
            {
                { "method", "ActiveOrders" }
            };

            if (pair != null)
            {
                args.Add("pair", BtcePairHelper.ToString(pair.Value));
            }
            var result = JObject.Parse(Query(args));

            if (result.Value <int>("success") == 0)
            {
                throw new Exception(result.Value <string>("error"));
            }
            return(OrderList.ReadFromJObject(result["return"] as JObject));
        }
コード例 #5
0
        public TradeHistory GetTradeHistory(
            int?from       = null,
            int?count      = null,
            int?fromId     = null,
            int?endId      = null,
            bool?orderAsc  = null,
            DateTime?since = null,
            DateTime?end   = null,
            BtcePair?pair  = null)
        {
            var args = new Dictionary <string, string> {
                { "method", "TradeHistory" }
            };

            if (from != null)
            {
                args.Add("from", from.Value.ToString());
            }

            if (count != null)
            {
                args.Add("count", count.Value.ToString());
            }

            if (fromId != null)
            {
                args.Add("from_id", fromId.Value.ToString());
            }

            if (endId != null)
            {
                args.Add("end_id", endId.Value.ToString());
            }

            if (orderAsc != null)
            {
                args.Add("order", orderAsc.Value ? "ASC" : "DESC");
            }

            if (since != null)
            {
                args.Add("since", UnixTime.GetFromDateTime(since.Value).ToString());
            }

            if (end != null)
            {
                args.Add("end", UnixTime.GetFromDateTime(end.Value).ToString());
            }

            if (pair != null)
            {
                args.Add("pair", BtcePairHelper.ToString(pair.Value));
            }

            JObject result = JObject.Parse(Query(args));

            if (result.Value <int>("success") == 0)
            {
                throw new BtceException(result.Value <string>("error"));
            }
            return(TradeHistory.ReadFromJObject(result["return"] as JObject));
        }
コード例 #6
0
 public OrderList GetActiveOrders(BtcePair?pair = null)
 {
     return(_apiv2.GetActiveOrders(pair));
 }
コード例 #7
0
        public OrderList GetOrderList(
            int?from       = null,
            int?count      = null,
            int?fromId     = null,
            int?endId      = null,
            bool?orderAsc  = null,
            DateTime?since = null,
            DateTime?end   = null,
            BtcePair?pair  = null,
            bool?active    = null
            )
        {
            var args = new Dictionary <string, string>()
            {
                { "method", "OrderList" }
            };

            if (from != null)
            {
                args.Add("from", from.Value.ToString());
            }
            if (count != null)
            {
                args.Add("count", count.Value.ToString());
            }
            if (fromId != null)
            {
                args.Add("from_id", fromId.Value.ToString());
            }
            if (endId != null)
            {
                args.Add("end_id", endId.Value.ToString());
            }
            if (orderAsc != null)
            {
                args.Add("order", orderAsc.Value ? "ASC" : "DESC");
            }
            if (since != null)
            {
                args.Add("since", UnixTime.GetFromDateTime(since.Value).ToString());
            }
            if (end != null)
            {
                args.Add("end", UnixTime.GetFromDateTime(end.Value).ToString());
            }
            if (pair != null)
            {
                args.Add("pair", BtcePairHelper.ToString(pair.Value));
            }
            if (active != null)
            {
                args.Add("active", active.Value ? "1" : "0");
            }

            var resultStr = Query(args);
            var result    = JObject.Parse(resultStr);

            if (result.Value <int>("success") == 0)
            {
                throw new Exception(result.Value <string>("error"));
            }

            return(OrderList.ReadFromJObject(result["return"] as JObject));
        }