Пример #1
0
        public CompositeScoreResult GetCompositeScoreAV(string symbol)
        {
            string  adxResponse         = AlphaVantage.CompleteAlphaVantageRequest("ADX", symbol).Result;
            decimal adxCompositeScore   = AlphaVantage.GetCompositeScore("ADX", adxResponse, 7);
            string  aroonResponse       = AlphaVantage.CompleteAlphaVantageRequest("AROON", symbol).Result;
            decimal aroonCompositeScore = AlphaVantage.GetCompositeScore("AROON", aroonResponse, 7);
            string  macdResponse        = AlphaVantage.CompleteAlphaVantageRequest("MACD", symbol).Result;
            decimal macdCompositeScore  = AlphaVantage.GetCompositeScore("MACD", macdResponse, 7);

            ShortInterestResult shortResult = new ShortInterestResult(); //FINRA.GetShortInterest(symbol, 7);

            return(new CompositeScoreResult
            {
                Symbol = symbol,
                DataProviders = "AlphaVantage",
                ADXComposite = adxCompositeScore,
                AROONComposite = aroonCompositeScore,
                MACDComposite = macdCompositeScore,
                CompositeScoreValue = (adxCompositeScore + aroonCompositeScore + macdCompositeScore + shortResult.ShortInterestCompositeScore) / 4,
                ShortInterest = shortResult
            });
        }
Пример #2
0
        public static CompositeScoreResult GetCompositeScoreResult(string symbol, Security quote)
        {
            string  adxResponse       = CompleteTwelveDataRequest("ADX", symbol).Result;
            decimal adxCompositeScore = GetCompositeScore(symbol, "ADX", adxResponse, 7);
            //string obvResponse = CompleteTwelveDataRequest("OBV", symbol).Result;
            //decimal obvCompositeScore = GetCompositeScore("OBV", obvResponse, 7);
            string  aroonResponse       = CompleteTwelveDataRequest("AROON", symbol).Result;
            decimal aroonCompositeScore = GetCompositeScore(symbol, "AROON", aroonResponse, 7);
            string  macdResponse        = CompleteTwelveDataRequest("MACD", symbol).Result;
            decimal macdCompositeScore  = GetCompositeScore(symbol, "MACD", macdResponse, 7);

            ShortInterestResult shortResult = new ShortInterestResult(); //FINRA.GetShortInterest(symbol, 7);

            FundamentalsResult fundResult = Indicators.GetFundamentals(symbol, quote);

            TipRanksResult trResult = TipRanks.GetTipRanksResult(symbol);

            CompositeScoreResult scoreResult = new CompositeScoreResult
            {
                Symbol        = symbol,
                DataProviders = "TwelveData, FINRA, YahooFinance, TipRanks",
                ADXComposite  = adxCompositeScore,
                //OBVComposite = obvCompositeScore,
                AROONComposite         = aroonCompositeScore,
                MACDComposite          = macdCompositeScore,
                RatingsComposite       = trResult.RatingsComposite,
                ShortInterestComposite = shortResult.ShortInterestCompositeScore,
                FundamentalsComposite  = fundResult.FundamentalsComposite,
                CompositeScoreValue    = (adxCompositeScore + /*obvCompositeScore +*/ aroonCompositeScore + macdCompositeScore +
                                          shortResult.ShortInterestCompositeScore + fundResult.FundamentalsComposite + trResult.RatingsComposite) / 6,
                ShortInterest = shortResult,
                Fundamentals  = fundResult,
                TipRanks      = trResult
            };

            string rank = string.Empty;

            if (scoreResult.Fundamentals.IsBlacklisted)
            {
                rank = "DISQUALIFIED";
            }
            else if (scoreResult.CompositeScoreValue > 0 && scoreResult.CompositeScoreValue < 60)
            {
                rank = "BAD";
            }
            else if (scoreResult.CompositeScoreValue >= 60 && scoreResult.CompositeScoreValue < 70)
            {
                rank = "FAIR";
            }
            else if (scoreResult.CompositeScoreValue >= 70 && scoreResult.CompositeScoreValue < 80)
            {
                rank = "GOOD";
            }
            else if (scoreResult.CompositeScoreValue >= 80)
            {
                rank = "PRIME";
            }
            scoreResult.CompositeRank = rank;

            return(scoreResult);
        }