コード例 #1
0
        // Вызов поиска экстремумов и вызов поиска экстремумов с дистанцией
        private string CalculationExtremumPrice(MarketTradesRepository _mTR, decimal _otkat, decimal _distance, decimal _profit, bool _write_trades)
        {
            ExtremumPrice _extPrice = new ExtremumPrice();

            _extPrice.CreateExtrem(_mTR, _otkat);
            return(_extPrice.CreateExtremDistance(_mTR, _otkat, _distance, _profit, _write_trades));
        }
コード例 #2
0
        // Просто по экстремумам
        private void CalculationExtremumPrice(MarketTradesRepository _mTR, decimal _otkat, string _filename)
        {
            ExtremumPrice extPrice = new ExtremumPrice();

            decimal exchange_fee         = 0.47m; // биржевой сбор SBRF 0.47
            decimal brokerage_commission = 0.59m; // комиссия брокера 0.59
            decimal spred = 3m;

            // находим екстремумы
            extPrice.CreateExtrem(_mTR, _otkat);
            //StaticService.LogFileWrite("----------------Extremums--------------------", _filename, true);
            //foreach (var item in extPrice.Extremums)
            //{
            //    StaticService.LogFileWriteNotDateTime(item.Date_Time + "\t" + item.PriceHigh + "\t" + item.PriceLow, _filename, true);
            //}

            // считаем между ними дельту
            //StaticService.LogFileWrite("\n", filename, true);
            //StaticService.LogFileWriteNotDateTime("----------------считаем между ними дельту--------------------", _filename, true);
            extPrice.DeltaExtr();
            foreach (var item in extPrice.DeltaExtremums)
            {
                StaticService.LogFileWriteNotDateTime(Math.Abs(item).ToString(), "delta_log.txt", true);
            }

            StaticService.LogFileWriteNotDateTime("****************ОТКАТ <" + _otkat + ">****************", _filename, true);

            //&??????????????????
            for (decimal i = _otkat * 2; i <= _otkat * 8; i++)
            {
                decimal criticalSum = 0;

                // фильтруeм дельты
                StaticService.LogFileWriteNotDateTime("----------------фильтруeм дельты <" + i + ">--------------------", _filename, true);
                extPrice.FiltrDelta(i);
                foreach (var item in extPrice.FiltrDeltas)
                {
                    StaticService.LogFileWriteNotDateTime(Math.Abs(item).ToString(), _filename, true);

                    criticalSum += Math.Abs(item) - (_otkat * 2 + TransactionCosts(exchange_fee, brokerage_commission, spred) * 2);
                }
                StaticService.LogFileWriteNotDateTime(criticalSum.ToString(), _filename, true);
            }
        }