Beispiel #1
0
        private async Task <Dictionary <string, TransforfField> > GetOrderBookAsync()
        {
            return(await new Task <Dictionary <string, TransforfField> >(delegate {
                YobitCoinIdenteti Ident = new YobitCoinIdenteti();
                Dictionary <string, TransforfField> temp = new Dictionary <string, TransforfField>();
                foreach (var i in Ident.Data)
                {
                    string site = String.Format("https://yobit.net/api/2/{0}/depth", i.Key);
                    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(site);
                    WebResponse resp = req.GetResponse();

                    using (StreamReader stream = new StreamReader(
                               resp.GetResponseStream(), Encoding.UTF8))
                    {
                        string str = stream.ReadToEnd();
                        var res = JsonConvert.DeserializeObject <Field>(str);
                        if (res.bids != null && res.asks != null)
                        {
                            temp.Add(FormatString(i.Key), new TransforfField(res.asks, res.bids));
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                return temp;
            }));
        }
Beispiel #2
0
        private Dictionary <string, TransforfField> GetOrderBook(YobitCoinIdenteti coins)
        {
            YobitCoinIdenteti Ident = coins;
            Dictionary <string, TransforfField> temp = new Dictionary <string, TransforfField>();
            String end  = @"?ignore_invalid=1&limit=20";
            string site = "https://yobit.net/api/3/depth/";

            foreach (var i in Ident.Data)
            {
                site += "-" + i.Key;
            }
            site += end;
            foreach (var i in Ident.Data)
            {
                HttpWebRequest req  = (HttpWebRequest)HttpWebRequest.Create(site);
                WebResponse    resp = req.GetResponse();

                using (StreamReader stream = new StreamReader(
                           resp.GetResponseStream(), Encoding.UTF8))
                {
                    string str = stream.ReadToEnd();
                    var    res = JsonConvert.DeserializeObject <Field>(str);
                    if (res.bids != null && res.asks != null)
                    {
                        temp.Add(FormatString(i.Key), new TransforfField(res.asks, res.bids));
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            return(temp);
        }
Beispiel #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            LiveCoinInfo      LiveInfo  = new LiveCoinInfo();
            PoloniexCoinsInfo PolInfo   = new PoloniexCoinsInfo();
            CryptoCoinInfo    CryptInfo = new CryptoCoinInfo();
            BittrexCoinInfo   BitInfo   = new BittrexCoinInfo();
            YobitCoinIdenteti YouInfo   = new YobitCoinIdenteti();

            Console.WriteLine("get info");
            CheakCoinsInfo(ref CryptInfo.Data, LiveInfo.Data, PolInfo.Data, BitInfo.Data, YouInfo.Data);
            CheakCoinsInfo(ref BitInfo.Data, LiveInfo.Data, PolInfo.Data, CryptInfo.Data, YouInfo.Data);
            CheakCoinsInfo(ref YouInfo.Data, LiveInfo.Data, PolInfo.Data, CryptInfo.Data, BitInfo.Data);


            LiveCoinCoins live     = new LiveCoinCoins();
            PoloniexCoins poloniex = new PoloniexCoins();
            CryptoCoins   crypto   = new CryptoCoins(CryptInfo.Data);
            BittrexCoin   bittrex  = new BittrexCoin(BitInfo.Data);
            YobitCoins    Youibit  = new YobitCoins(YouInfo);

            //Дописать сравнение по имеющеййся на бирже валюте и констрктор
            List <MainStrategy> t   = CoinCompare(live.Data, poloniex.Data, "live", "poloniex");
            List <MainStrategy> t2  = CoinCompare(live.Data, crypto.Data, "live", "crypto");
            List <MainStrategy> t3  = CoinCompare(live.Data, bittrex.Data, "live", "bittrex");
            List <MainStrategy> t4  = CoinCompare(bittrex.Data, poloniex.Data, "bittrex", "poloniex");
            List <MainStrategy> t5  = CoinCompare(crypto.Data, poloniex.Data, "crypto", "poloniex");
            List <MainStrategy> t6  = CoinCompare(crypto.Data, bittrex.Data, "crypto", "bittrex");
            List <MainStrategy> t7  = CoinCompare(Youibit.Data, live.Data, "Youibit", "live");
            List <MainStrategy> t8  = CoinCompare(Youibit.Data, poloniex.Data, "Youibit", "poloniex");
            List <MainStrategy> t9  = CoinCompare(Youibit.Data, crypto.Data, "live", "crypto");
            List <MainStrategy> t10 = CoinCompare(Youibit.Data, bittrex.Data, "live", "bittrex");

            AddToColums(t);
            AddToColums(t2);
            AddToColums(t3);
            AddToColums(t4);
            AddToColums(t5);
            AddToColums(t6);
            AddToColums(t7);
            AddToColums(t8);
            AddToColums(t9);
            AddToColums(t10);
        }
Beispiel #4
0
 public YobitCoins(YobitCoinIdenteti coins)
 {
     Data = GetOrderBook(coins);
 }