예제 #1
0
        public KunaOrder CancelOrder(string orderId)
        {
            var response = UserQuery("order/delete", "POST", new Dictionary <string, string>()
            {
                { "id", orderId }
            });

            return(KunaOrder.FromJson(JObject.Parse(response)));
        }
예제 #2
0
        public KunaOrder PlaceOrder(string market, string side, double volume, double price)
        {
            var response = UserQuery("orders", "POST", new Dictionary <string, string>()
            {
                { "side", side },
                { "volume", volume.ToString(CultureInfo.InvariantCulture) },
                { "market", market },
                { "price", price.ToString(CultureInfo.InvariantCulture) }
            });

            return(KunaOrder.FromJson(JObject.Parse(response)));
        }
예제 #3
0
        public static KunaOrderBook FromJson(JObject json)
        {
            var res = new KunaOrderBook();

            foreach (JObject orderJson in (json["asks"] as JArray))
            {
                res.Asks.Add(KunaOrder.FromJson(orderJson));
            }

            foreach (JObject orderJson in (json["bids"] as JArray))
            {
                res.Bids.Add(KunaOrder.FromJson(orderJson));
            }
            return(res);
        }
예제 #4
0
        public List <KunaOrder> ActiveOrders(string market)
        {
            var response = UserQuery("orders", "GET", new Dictionary <string, string>()
            {
                { "market", market }
            });
            var json = JArray.Parse(response);

            var orders = new List <KunaOrder>();

            foreach (var jsonOrder in json)
            {
                orders.Add(KunaOrder.FromJson(jsonOrder as JObject));
            }
            return(orders);
        }
예제 #5
0
 public KunaOrder CancelOrder(KunaOrder order)
 {
     return(CancelOrder(order.Id));
 }