Esempio n. 1
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);
        }
Esempio n. 2
0
        private async Task <Dictionary <string, TransforfField> > GetBittrexOrderBook()
        {
            return(await new Task <Dictionary <string, TransforfField> >(delegate
            {
                BittrexIdenteti Ident = new BittrexIdenteti();
                BittrexCoinInfo CoinInfo = new BittrexCoinInfo();
                Dictionary <string, TransforfField> temp = new Dictionary <string, TransforfField>();
                bool flag;
                foreach (var i in Ident.Data.result)
                {
                    try
                    {
                        flag = CoinInfo.Data[i.MarketName.Split('-')[1]].Data.Status;
                    }
                    catch (KeyNotFoundException)
                    {
                        continue;
                    }
                    if (flag == false)
                    {
                        continue;
                    }
                    string site = String.Format("https://bittrex.com/api/v1.1/public/getorderbook?market={0}&type=both&depth=10", i.MarketName);
                    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(site);
                    WebResponse resp = req.GetResponse();

                    using (StreamReader stream = new StreamReader(
                               resp.GetResponseStream(), Encoding.UTF8))
                    {
                        string str = stream.ReadToEnd();
                        var a = JsonConvert.DeserializeObject <Field>(str);
                        temp.Add(i.MarketName, new TransforfField(a.result.sell, a.result.buy));
                    }
                }
                return temp;
            }));
        }