Пример #1
0
        // Display realized volatility for top-ranked (by market cap) cryptos from CoinMarketCap
        private void DisplayRealizedVolatility(int limit = 50)
        {
            int numberOfBars = 12;
            var top          = m_cmc.GetRankings(limit);

            foreach (var t in top)
            {
                var      exchange = "BINANCE";
                string   symbol;
                string[] mainSymbols = { "ADA", "BCC", "BNB", "BTC", "EOS", "ETH", "IOTA", "LTC", "NEO", "QTUM", "TUSD", "XLM", "XRP" };
                if (mainSymbols.Contains(t.symbol))
                {
                    symbol = t.symbol + "USDT";
                }
                else
                {
                    symbol = t.symbol + "BTC";
                }
                var xs      = new XSymbol(exchange, symbol);
                var candles = m_maker.GetCandles(xs, 1440, 1);
                if (candles.Count < numberOfBars)
                {
                    continue;
                }
                var rvol = new RealizedVolatility(candles, numberOfBars);
                //var mr = CoinMarketCapApi.GetMarkets(t.name);
                //var marketExchanges = mr.Select(m => m.exchange).Distinct();
                Console.WriteLine("{0,4} {1,-7}  {2,6:0.00}", t.rank, t.symbol, rvol.Value);
            }
        }
Пример #2
0
        // where exchange like "BINANCE"
        public void DisplayBetaCalcs(string exchange, bool convertCandlesToUsd)
        {
            var cBtc    = m_maker.GetCandles(new XSymbol(exchange, "BTCUSDT"), (int)Minutes.Day);
            var cLtc    = m_maker.GetCandles(new XSymbol(exchange, "LTCUSDT"), (int)Minutes.Day);
            var cEth    = m_maker.GetCandles(new XSymbol(exchange, "ETHUSDT"), (int)Minutes.Day);
            var betaLtc = GMath.Beta(cLtc, cBtc);
            var betaEth = GMath.Beta(cEth, cBtc);

            Console.WriteLine("beta_LTCUSDT:{0:0.00}", betaLtc);
            Console.WriteLine("beta_ETHUSDT:{1:0.00}", betaEth);
            foreach (var ts in m_activeTradeSymbols)    //  m_tradeSymbols)
            {
                var symbol = m_api[exchange].GlobalSymbolToExchangeSymbol(ts.GlobalSymbol);
                var cX     = m_maker.GetCandles(new XSymbol(exchange, symbol), (int)Minutes.Day);
                var beta   = GMath.Beta(cX, cBtc, convertCandlesToUsd);
                Console.WriteLine("beta_{0}:{1:0.00}", symbol, beta);
            }
        }