Beispiel #1
0
        public Orders MyOrders(PairType pair)
        {
            try {
                System.Threading.Thread.Sleep(WAIT);
                string qString = "pair=" + pair.ToString() + "&nonce=" + nonce;
                var    sign    = ComputeHash(this.secret, qString);
                var    url     = URL + "Order/MyOrders";
                if (DIAGNOS)
                {
                    System.Diagnostics.Debug.WriteLine("nonce={0} qString={1} url={2} Key={3}", nonce, qString, url, Key);
                }
                string result = Query(qString, url, Key, sign, "GET");
                if (!string.IsNullOrEmpty(result))
                {
                    JObject orders = JObject.Parse(result);
                    if (orders["error"] != null)
                    {
                        throw new Exception(orders["error"].ToString());
                    }
                    if (orders != null)
                    {
                        var    pairOrders = orders[pair.ToString()].ToString();
                        Orders response   = Serializer.Deserialize <Orders>(pairOrders);
                        return(response);
                    }
                }

                return(null);
            }
            catch (Exception ex) {
                throw;
            }
        }
Beispiel #2
0
 public void ClearMyOrders(PairType pair)
 {
     try {
         System.Threading.Thread.Sleep(WAIT);
         string qString = "nonce=" + nonce + "&pair=" + pair.ToString();
         var    sign    = ComputeHash(this.secret, qString);
         var    url     = URL + "Order/MyOrders";
         if (DIAGNOS)
         {
             System.Diagnostics.Debug.WriteLine("nonce={0} qString={1} url={2} Key={3}", nonce, qString, url, Key);
         }
         string result   = Query(qString, url, Key, sign, "POST");
         Orders myOrders = Serializer.Deserialize <Orders>(result);
         foreach (var item in myOrders.ask)
         {
             CancelOrder(item.id);
         }
         foreach (var item in myOrders.bid)
         {
             CancelOrder(item.id);
         }
     }
     catch (Exception ex) {
         throw;
     }
 }
Beispiel #3
0
 public List <ExchangesTrade> GetTrades(PairType Pair = PairType.BtcNis, long since = 0, double date = 0)
 {
     using (WebClient client = new WebClient()) {
         System.Threading.Thread.Sleep(WAIT);
         string result = client.DownloadString(URL + "Exchanges/" + Pair.ToString() + "/trades.json");
         List <ExchangesTrade> response = Serializer.Deserialize <List <ExchangesTrade> >(result);
         return(response);
     }
 }
Beispiel #4
0
 public Ticker GetTicker(PairType Pair = PairType.BtcNis)
 {
     using (WebClient client = new WebClient()) {
         System.Threading.Thread.Sleep(WAIT);
         var    urlTicker = URL + "Exchanges/" + Pair.ToString() + "/Ticker.json";
         string result    = client.DownloadString(urlTicker);
         Ticker response  = Serializer.Deserialize <Ticker>(result);
         return(response);
     }
 }
Beispiel #5
0
 public OrderBook GetOrderBook(PairType Pair = PairType.BtcNis)
 {
     using (WebClient client = new WebClient()) {
         System.Threading.Thread.Sleep(WAIT);
         string result = client.DownloadString(URL + "Exchanges/" + Pair.ToString() + "/orderbook.json");
         if (DIAGNOS)
         {
             System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("mm:ss"));
         }
         OrderBook response = Serializer.Deserialize <OrderBook>(result);
         return(response);
     }
 }
Beispiel #6
0
            public String GetHandDescription()
            {
                switch (this.hand)
                {
                case HandType.HighCard:
                    return("High card, " + kicker.ToString() + " kicker");

                case HandType.Pair:
                    return(pair.ToString() + " pair, " + kicker.ToString() + " kicker");

                case HandType.TwoPair:
                    return("Two pair");

                case HandType.ThreeOfAKind:
                    return("Three of a kind");

                case HandType.Straight:
                    return("Straight");

                case HandType.Flush:
                    return("Flush");

                case HandType.FullHouse:
                    return("Full house");

                case HandType.FourOfAKind:
                    return("Four of a kind");

                case HandType.RoyalFlush:
                    return("Royal flush");

                case HandType.Unknown:
                    return("Unknown");
                }
                return("<invalid>");
            }