Ejemplo n.º 1
0
        private void GenerateTradeIdeasForSymbol(string symbol)
        {
            List <HistoricalQuote> historicalQuotes1YearsResponse = _marketDataService.GetHistoricalQuotes(symbol, "1y");

            if (historicalQuotes1YearsResponse.Count == 0)
            {
                return;
            }
            HistoricalData historicalData1Year = null;

            if (!historicalQuotes1YearsResponse.IsNullOrEmpty())
            {
                historicalData1Year = new HistoricalData(historicalQuotes1YearsResponse);
            }
            List <Signal> signals = _signalsProxyService.GetSignals(historicalData1Year, _indicatorsToCalculate, _lastSignalsCountForTradeIdeas);

            _tradeIdeasGenerator.GenerateTradeIdeas(signals, historicalQuotes1YearsResponse);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets syrah term signals (short and long)
        /// </summary>
        /// <returns>Item1 - syrah short term signals, Item2 - syrah long term signals</returns>
        public Tuple <List <Signal>, List <Signal> > GetSentiments(List <HistoricalQuote> historicalQuotes2Years)
        {
            IIndicator     syrahSentimentShortTerm = new SyrahSentiment(SyrahSentiment.TermValue.ShortTerm);
            IIndicator     syrahSentimenLongTerm   = new SyrahSentiment(SyrahSentiment.TermValue.LongTerm);
            HistoricalData historicalData2Years    = new HistoricalData(historicalQuotes2Years);

            List <Signal> signals = _signalsProxyService.GetSignals(historicalData2Years,
                                                                    new List <IIndicator>
            {
                syrahSentimentShortTerm, syrahSentimenLongTerm
            }, null);
            List <Signal> syrahShortTermSignals = signals.ForIndicator(syrahSentimentShortTerm).OrderBy(signal => signal.Date).ToList();
            List <Signal> syrahLongTermSignals  = signals.ForIndicator(syrahSentimenLongTerm).OrderBy(signal => signal.Date).ToList();

            Tuple <List <Signal>, List <Signal> > result = new Tuple <List <Signal>, List <Signal> >(syrahShortTermSignals, syrahLongTermSignals);

            return(result);
        }