コード例 #1
0
ファイル: BetFactory.cs プロジェクト: mishadev/XOracle
        private async Task <BetRateCalculator> GetBetRateCalculator(BetRateAlgorithm betRateAlgorithm)
        {
            var           factory       = new BetRateCalculatorFactory(betRateAlgorithm.LocusRage);
            AlgorithmType algorithmType = await this._repositoryAlgorithmType.Get(betRateAlgorithm.AlgorithmTypeId);

            return(factory.Create(algorithmType.Name));
        }
コード例 #2
0
ファイル: BetFactory.cs プロジェクト: mishadev/XOracle
        private async Task <BetRateCalculatorDateTime> GetBetRateCalculator(BetRateAlgorithm betRateAlgorithm, Event @event)
        {
            var           factory       = new BetRateCalculatorFactory(betRateAlgorithm.LocusRage);
            AlgorithmType algorithmType = await this._repositoryAlgorithmType.Get(betRateAlgorithm.AlgorithmTypeId);

            return(factory.CreateDateTime(algorithmType.Name, @event.StartDate, @event.EndDate));
        }
コード例 #3
0
ファイル: BetFactory.cs プロジェクト: mishadev/XOracle
        public async Task <byte[]> CalculateBetConditionChartData(BetRateAlgorithm betRateAlgorithm)
        {
            ICalculator <double, double> calculator = await this.GetBetRateCalculator(betRateAlgorithm);

            byte[] data = Enumerable.Range(0, 100)
                          .Select(p => (byte)(calculator.Calculate(p / 100.0) * byte.MaxValue))
                          .ToArray();

            return(data);
        }
コード例 #4
0
        public async Task <BetRateAlgorithm> CreateEventBetRateAlgorithm(Account account, AlgorithmType algorithmType, double startRate, double endRate, double locusRage)
        {
            using (this._scopeableFactory.Create())
            {
                var betRateAlgorithm = new BetRateAlgorithm
                {
                    AccountId       = account.Id,
                    AlgorithmTypeId = algorithmType.Id,
                    StartRate       = startRate,
                    EndRate         = endRate,
                    LocusRage       = locusRage
                };

                await this._repositoryBetRateAlgorithm.Add(betRateAlgorithm);

                return(betRateAlgorithm);
            }
        }
コード例 #5
0
        public async Task <EventBetCondition> CreateEventBetCondition(Account account, CurrencyType currencyType, BetRateAlgorithm betRateAlgorithm, DateTime closeDate)
        {
            using (this._scopeableFactory.Create())
            {
                var eventBetCondition = new EventBetCondition
                {
                    AccountId               = account.Id,
                    CloseDate               = closeDate,
                    CurrencyTypeId          = currencyType.Id,
                    EventBetRateAlgorithmId = betRateAlgorithm.Id,
                };

                await this._repositoryEventBetCondition.Add(eventBetCondition);

                return(eventBetCondition);
            }
        }