Exemple #1
0
 private static void HandleNotify(string stockCode, CandleDTO candle)
 {
     if (candle != null)
     {
         Console.WriteLine("Stock " + stockCode + ", High = " + candle.High + ", Time = " + candle.RepDate.ToString("HH:mm:ss:fff"));
     }
 }
Exemple #2
0
 public void AddCandle(CandleDTO candle)
 {
     _candles.Add(candle);
     if (_candles.Count == Time)
     {
         _candles.Add(candle);
         CalculateQuality();
         Closed = true;
     }
 }
Exemple #3
0
 public Stake(float price, int time, Direction direction, CandleDTO firstCandle, float onePip)
 {
     Price     = price;
     Time      = time;
     Direction = direction;
     _onePip   = onePip;
     _candles  = new List <CandleDTO> {
         firstCandle
     };
 }
 private void BroadcastStockRate(string stockCode, CandleDTO candle)
 {
     foreach (var cs in ClientStockes)
     {
         if (cs.Value.Contains(stockCode))
         {
             Clients.Client(cs.Key).updateStockRate(stockCode, candle);
         }
     }
 }
Exemple #5
0
        public float AddCandle(CandleDTO candle)
        {
            _candles.Add(candle);
            if (CalculateEMAs(candle))
            {
                CheckActiveStakes();
                AddStakes();
            }

            return(OverallQuality.Value);
        }
        public IEnumerable <CandleDTO> Candles()
        {
            //var candlesLoader = new CandlesLoader("HistoryData/EURUSD_201810.csv");
            //var candles = candlesLoader.LoadAll();
            var candles    = CandlesAggregator.Inst.Candles["EURUSD"];
            var analyzer   = new TrendStateAnalyzer();
            var candlesDto = new List <CandleDTO>();

            foreach (var candle in candles)
            {
                var candleDto = new CandleDTO(candle);
                //candlesDto.Add(candleDto);
                var volume = analyzer.AddCandle(candleDto);
                if (volume > 0.5)
                {
                    candleDto.Volume = volume;
                }
                candlesDto.Add(candleDto);
            }

            return(candlesDto);
        }
Exemple #7
0
 private bool CalculateEMAs(CandleDTO candle)
 {
     _ma8.AddValue(candle.Close);
     _ma21.AddValue(candle.Close);
     return(_candles.Count >= _ma21.MinReadyCount);
 }