public static void StartPositionDisplayThread()
        {
            GetBalances(out decimal initTotalBtc, out decimal initTotalUsdt, true);
            Console.WriteLine("\n{0}    {1} BTC   {2} USDT\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), initTotalBtc, initTotalUsdt);

            int n = 0;

            while (true)
            {
                Thread.Sleep(30000);

                ++n;

                decimal totalBtc, totalUsdt;
                if (n % 10 == 0)
                {
                    TradeBinanceArbs.GetBalances(out totalBtc, out totalUsdt, true);
                }
                else
                {
                    TradeBinanceArbs.GetBalances(out totalBtc, out totalUsdt);
                }

                Console.WriteLine("{0}    {1} BTC   {2} USDT            change: {3} BTC   {4} USDT", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), totalBtc, totalUsdt, totalBtc - initTotalBtc, totalUsdt - initTotalUsdt);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("\n*** WELCOME TO AGGREGATOR ***\n");

            var apiXS = new ExchangeSharpRestApi();

            //apiXS.Gator("ETH-USD", amountRequested: 200, bips:125);
            apiXS.Test();

            //CryptoWebSocketApis.GeminiWebSocket.TestGeminiTickers_marketdata();
            Console.WriteLine("(Back in MAIN)");
            Console.ReadKey();
            return;

            //CryptoTools.Cryptography.Cryptography.EncryptFile("X:/Users/Trader/Documents/hat_apis.json", "/Users/michael/Documents/hat_apis.enc", pw);    // encrypt api key file
            m_credentialsFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "system.apis.enc");   // read ".enc" file from application path
            m_pw = @"myKey123";

            m_factory = new ApiFactory(m_credentialsFile, m_pw);


            /*TradeBittrexArbs.InitializeApi(credentialsFile, pw);
             * TradeBittrexArbs.Test();
             * TradeBinanceArbs.InitializeApi(credentialsFile, pw);
             * TradeBinanceArbs.Test();
             * TradeGdaxArbs.InitializeApi(credentialsFile, pw);
             * TradeGdaxArbs.Test();
             * TradeKraken.InitializeApi(credentialsFile, pw);
             * TradeKraken.Test();
             * TradeGemini.InitializeApi(credentialsFile, pw);
             * TradeGemini.Test();*/

            // Get CoinMarketCap rankings
            var cmcap = new CoinMarketCapApi();

            cmcap.Test();

            /*var rank = cmcap.GetRankings();
             * var gainers1h = rank.OrderByDescending(t => t.percent_change_1h);
             * var gainers24h = rank.OrderByDescending(t => t.percent_change_24h);
             * var gainers7d = rank.OrderByDescending(t => t.percent_change_7d);
             * var losers1h = rank.OrderBy(t => t.percent_change_1h);
             * var losers24h = rank.OrderBy(t => t.percent_change_24h);
             * var losers7d = rank.OrderBy(t => t.percent_change_7d);*/

            //BinanceTotals();
            //var mgr = new CryptoTools.SymbolManager();
            //SellBinance(0.50M, "bnb");

            /*DisplayBalances("KRAKEN", "btcusd");
             * DisplayBalances("BITFINEX", "btcusd");
             * DisplayBalances("BINANCE", "btcusdt");
             * DisplayBalances("BITTREX", "btcusdt");
             * DisplayBalances("POLONIEX", "btcusdt");
             * DisplayBalances("GDAX", "btcusd");
             *
             * try
             * {
             *  GdaxRestApi api = m_factory.Get("GDAX") as GdaxRestApi;
             *  api.PrintCoinbaseAccounts().Wait();
             * }
             * catch (Exception ex)
             * {
             *  Console.WriteLine("\nGDAX Coinbase Error: {0}", ex.Message);
             * }*/



            Console.Write("\n\nPress any key to exit... ");
            Console.ReadKey();
            return;

            //BinanceArbs.InitializeApi();

            TradeBinanceArbs.GetBalances(out decimal initTotalBtc, out decimal initTotalUsdt, true);
            Console.WriteLine("\n{0}    {1} BTC   {2} USDT\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), initTotalBtc, initTotalUsdt);

            // [LocalTime, exch1UpdateTime, exch1BitCoinPrice, exch2UpdateTime, exch2BitCoinPrice]

            List <string> symbols = new List <string>();

            symbols.AddRange(new List <string>()
            {
                "ethusdt", "btcusdt"
            });
            symbols.AddRange(new List <string>()
            {
                "neousdt", "neoeth", "neobtc"
            });
            symbols.AddRange(new List <string>()
            {
                "bnbusdt", "bnbeth", "bnbbtc"
            });
            symbols.AddRange(new List <string>()
            {
                "qtumusdt", "qtumeth", "qtumbtc"
            });
            symbols.AddRange(new List <string>()
            {
                "ltcusdt", "ltceth", "ltcbtc"
            });
            symbols.AddRange(new List <string>()
            {
                "bccusdt", "bcceth", "bccbtc"
            });
            symbols.AddRange(new List <string>()
            {
                "adausdt", "adaeth", "adabtc"
            });

            List <string> streams = new List <string>();

            streams.Add("ticker");
            streams.Add("aggTrade");
            TradeBinanceArbs.BinanceStreams(streams.ToArray(), symbols.ToArray());

            //GdaxTickers();
            //GeminiTickers();
            //BinanceTickers();
            //BitfinexTickers();
        }