Esempio n. 1
0
 public BillManager(ApplicationDbContext dbContext, ICurrencyConverter currencyConverter,
                    IPurseManager purseManager)
 {
     _dbContext         = dbContext;
     _currencyConverter = currencyConverter;
     _purseManager      = purseManager;
 }
 public TransactionService(
     ICurrencyConverter converter,
     IEnumerable <IBonusCalculator> calculators)
 {
     Converter   = converter;
     Calculators = calculators;
 }
Esempio n. 3
0
		static Currency()
		{
			Currency.Converter = new CurrencyConverter();
			Currency.ARS = new Currency("ARS", "Argentine peso");
			Currency.ATS = new Currency("ATS", "Austrian Schilling");
			Currency.AUD = new Currency("AUD", "Australian dollar");
			Currency.BEF = new Currency("BEF", "Belgian Francs");
			Currency.BRL = new Currency("BRL", "Brazilian real");
			Currency.CAD = new Currency("CAD", "Canadian dollar");
			Currency.CHF = new Currency("CHF", "Swiss franc");
			Currency.DEM = new Currency("DEM", "German Mark");
			Currency.ESP = new Currency("ESP", "Spanish Peseta");
			Currency.EUR = new Currency("EUR", "EU euro");
			Currency.FRF = new Currency("FRF", "French Franc");
			Currency.GBP = new Currency("GBP", "British pound");
			Currency.HKD = new Currency("HKD", "Hong Kong SAR dollar");
			Currency.INR = new Currency("INR", "Indian rupee");
			Currency.ITL = new Currency("ITL", "Italian Lira");
			Currency.JPY = new Currency("JPY", "Japanese yen");
			Currency.KRW = new Currency("KRW", "South Korean won");
			Currency.NLG = new Currency("NLG", "Dutch Guilder");
			Currency.PTE = new Currency("PTE", "Portuguese Escudo");
			Currency.RUR = new Currency("RUR", "Russian Ruble");
			Currency.SGD = new Currency("SGD", "Singapore dollar");
			Currency.USD = new Currency("USD", "US dollar");
			Currency.XBA = new Currency("XBA", "European Composite Unit");
			Currency.XEU = new Currency("XEU", "European Currency Unit");
			Currency.PLN = new Currency("PLN", "Polish zloty");
			Currency.NOK = new Currency("NOK", "Norwegian krone");
			Currency.DKK = new Currency("DKK", "Danish krone");
			Currency.SEK = new Currency("SEK", "Swedish krona");
			Currency.CNY = new Currency("CNY", "Chinese yuan renminbi");
		}
Esempio n. 4
0
        protected override Money <T> EvaluateInner(ICurrencyConverter <T> currencyConverter, Currency toCurrency)
        {
            var leftEquivalent  = this.Left.Evaluate(currencyConverter, toCurrency);
            var rightEquivalent = this.Right.Evaluate(currencyConverter, toCurrency);

            return(this.BinaryOperation.Operate(leftEquivalent, rightEquivalent));
        }
 public PlaceOrderCommandHandler(
     IEcommerceUnitOfWork unitOfWork,
     ICurrencyConverter converter)
 {
     _unitOfWork        = unitOfWork;
     _currencyConverter = converter;
 }
Esempio n. 6
0
        public IEnumerable <CurrencyConversionResult> GetExchangeRates(string moduleName)
        {
            if (string.IsNullOrWhiteSpace(moduleName))
            {
                return(null);
            }

            Type type = Type.GetType(moduleName);

            if (type == null)
            {
                return(null);
            }

            object             instance  = Activator.CreateInstance(type);
            ICurrencyConverter converter = (ICurrencyConverter)instance;

            if (converter == null)
            {
                return(null);
            }

            CurrencyData         currencyData = new CurrencyData();
            IEnumerable <string> currencies   = currencyData.GetExchangeCurrencies().Select(c => c.CurrencyCode);

            converter.BaseCurrency  = AppUsers.GetCurrent().View.CurrencyCode;
            converter.CurrencyCodes = currencies.ToList();
            return(converter.GetResult());
        }
Esempio n. 7
0
 /// <summary>
 /// Constructor for the Future security
 /// </summary>
 /// <param name="exchangeHours">Defines the hours this exchange is open</param>
 /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
 /// <param name="config">The subscription configuration for this security</param>
 /// <param name="symbolProperties">The symbol properties for this security</param>
 /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
 /// instances into units of the account currency</param>
 /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
 public Future(SecurityExchangeHours exchangeHours,
               SubscriptionDataConfig config,
               Cash quoteCurrency,
               SymbolProperties symbolProperties,
               ICurrencyConverter currencyConverter,
               IRegisteredSecurityDataTypesProvider registeredTypes
               )
     : base(config,
            quoteCurrency,
            symbolProperties,
            new FutureExchange(exchangeHours),
            new FutureCache(),
            new SecurityPortfolioModel(),
            new ImmediateFillModel(),
            new InteractiveBrokersFeeModel(),
            new ConstantSlippageModel(0),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            null,
            new SecurityDataFilter(),
            new SecurityPriceVariationModel(),
            currencyConverter,
            registeredTypes
            )
 {
     BuyingPowerModel = new FutureMarginModel(0, this);
     // for now all futures are cash settled as we don't allow underlying (Live Cattle?) to be posted on the account
     SettlementType    = SettlementType.Cash;
     Holdings          = new FutureHolding(this, currencyConverter);
     _symbolProperties = symbolProperties;
     SetFilter(TimeSpan.Zero, TimeSpan.FromDays(35));
 }
Esempio n. 8
0
 /// <summary>
 /// Constructor for the CFD security
 /// </summary>
 /// <param name="symbol">The security's symbol</param>
 /// <param name="exchangeHours">Defines the hours this exchange is open</param>
 /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
 /// <param name="symbolProperties">The symbol properties for this security</param>
 /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
 /// instances into units of the account currency</param>
 /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
 /// <param name="securityCache">Cache for storing Security data</param>
 public Cfd(Symbol symbol,
            SecurityExchangeHours exchangeHours,
            Cash quoteCurrency,
            SymbolProperties symbolProperties,
            ICurrencyConverter currencyConverter,
            IRegisteredSecurityDataTypesProvider registeredTypes,
            SecurityCache securityCache)
     : base(symbol,
            quoteCurrency,
            symbolProperties,
            new CfdExchange(exchangeHours),
            securityCache,
            new SecurityPortfolioModel(),
            new ImmediateFillModel(),
            new ConstantFeeModel(0),
            new ConstantSlippageModel(0),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            new SecurityMarginModel(50m),
            new CfdDataFilter(),
            new SecurityPriceVariationModel(),
            currencyConverter,
            registeredTypes
            )
 {
     Holdings = new CfdHolding(this, currencyConverter);
 }
Esempio n. 9
0
 /// <summary>
 /// Constructor for the index option security
 /// </summary>
 /// <param name="symbol">Symbol of the index option</param>
 /// <param name="exchangeHours">Exchange hours of the index option</param>
 /// <param name="quoteCurrency">Quoted currency of the index option</param>
 /// <param name="symbolProperties">Symbol properties of the index option</param>
 /// <param name="currencyConverter">Currency converter</param>
 /// <param name="registeredTypes">Provides all data types registered to the algorithm</param>
 /// <param name="securityCache">Cache of security objects</param>
 /// <param name="underlying">Future underlying security</param>
 /// <param name="settlementType">Settlement type for the index option. Most index options are cash-settled.</param>
 public IndexOption(Symbol symbol,
                    SecurityExchangeHours exchangeHours,
                    Cash quoteCurrency,
                    IndexOptionSymbolProperties symbolProperties,
                    ICurrencyConverter currencyConverter,
                    IRegisteredSecurityDataTypesProvider registeredTypes,
                    SecurityCache securityCache,
                    Security underlying,
                    SettlementType settlementType = SettlementType.Cash)
     : base(symbol,
            quoteCurrency,
            symbolProperties,
            new OptionExchange(exchangeHours),
            securityCache,
            new OptionPortfolioModel(),
            new ImmediateFillModel(),
            new InteractiveBrokersFeeModel(),
            new ConstantSlippageModel(0),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            new OptionMarginModel(),
            new OptionDataFilter(),
            new SecurityPriceVariationModel(),
            currencyConverter,
            registeredTypes,
            underlying
            )
 {
     ExerciseSettlement = settlementType;
 }
Esempio n. 10
0
 /// <summary>
 /// Construct a new security vehicle based on the user options.
 /// </summary>
 public Security(Symbol symbol,
                 SecurityExchangeHours exchangeHours,
                 Cash quoteCurrency,
                 SymbolProperties symbolProperties,
                 ICurrencyConverter currencyConverter,
                 IRegisteredSecurityDataTypesProvider registeredTypesProvider
                 )
     : this(symbol,
            quoteCurrency,
            symbolProperties,
            new SecurityExchange(exchangeHours),
            new SecurityCache(),
            new SecurityPortfolioModel(),
            new ImmediateFillModel(),
            new InteractiveBrokersFeeModel(),
            new ConstantSlippageModel(0),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            new SecurityMarginModel(),
            new SecurityDataFilter(),
            new SecurityPriceVariationModel(),
            currencyConverter,
            registeredTypesProvider
            )
 {
 }
Esempio n. 11
0
 public CurrencyProvider(IPreviousDayCalculator previousDayCalculator, ICurrencyConverter currencyConverter, IServiceWrapper serviceWrapper, IArchivedDataProvider archivedDataProvider)
 {
     _previousDayCalculator = previousDayCalculator;
     _currencyConverter = currencyConverter;
     _serviceWrapper = serviceWrapper;
     _archivedDataProvider = archivedDataProvider;
 }
Esempio n. 12
0
 public SaveCartCommandHandler(
     IEcommerceUnitOfWork unitOfWork,
     ICurrencyConverter converter)
 {
     _unitOfWork        = unitOfWork;
     _currencyConverter = converter;
 }
Esempio n. 13
0
 /// <summary>
 /// Construct the Equity Object
 /// </summary>
 public Equity(Symbol symbol,
               SecurityExchangeHours exchangeHours,
               Cash quoteCurrency,
               SymbolProperties symbolProperties,
               ICurrencyConverter currencyConverter,
               IRegisteredSecurityDataTypesProvider registeredTypes,
               SecurityCache securityCache,
               Exchange primaryExchange = null)
     : base(symbol,
            quoteCurrency,
            symbolProperties,
            new EquityExchange(exchangeHours),
            securityCache,
            new SecurityPortfolioModel(),
            new EquityFillModel(),
            new InteractiveBrokersFeeModel(),
            new ConstantSlippageModel(0m),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            new SecurityMarginModel(2m),
            new EquityDataFilter(),
            new AdjustedPriceVariationModel(),
            currencyConverter,
            registeredTypes
            )
 {
     Holdings        = new EquityHolding(this, currencyConverter);
     PrimaryExchange = primaryExchange ?? QuantConnect.Exchange.UNKNOWN;
 }
Esempio n. 14
0
 public GeoCurrency(IQuerySender querySender, IMemoryCache memoryCache, ICurrencyConverter currencyConverter, FIL.Logging.ILogger logger)
 {
     _querySender       = querySender;
     _memoryCache       = memoryCache;
     _currencyConverter = currencyConverter;
     _logger            = logger;
 }
Esempio n. 15
0
 /// <summary>
 /// Constructor for the option security
 /// </summary>
 /// <param name="symbol">The symbol of the security</param>
 /// <param name="exchangeHours">Defines the hours this exchange is open</param>
 /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
 /// <param name="symbolProperties">The symbol properties for this security</param>
 /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
 /// instances into units of the account currency</param>
 /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
 public Option(Symbol symbol,
               SecurityExchangeHours exchangeHours,
               Cash quoteCurrency,
               OptionSymbolProperties symbolProperties,
               ICurrencyConverter currencyConverter,
               IRegisteredSecurityDataTypesProvider registeredTypes)
     : base(symbol,
            quoteCurrency,
            symbolProperties,
            new OptionExchange(exchangeHours),
            new OptionCache(),
            new OptionPortfolioModel(),
            new ImmediateFillModel(),
            new InteractiveBrokersFeeModel(),
            new ConstantSlippageModel(0),
            new ImmediateSettlementModel(),
            Securities.VolatilityModel.Null,
            new OptionMarginModel(),
            new OptionDataFilter(),
            new SecurityPriceVariationModel(),
            currencyConverter,
            registeredTypes
            )
 {
     ExerciseSettlement = SettlementType.PhysicalDelivery;
     SetDataNormalizationMode(DataNormalizationMode.Raw);
     OptionExerciseModel = new DefaultExerciseModel();
     PriceModel          = new CurrentPriceOptionPriceModel();
     Holdings            = new OptionHolding(this, currencyConverter);
     _symbolProperties   = symbolProperties;
     SetFilter(-1, 1, TimeSpan.Zero, TimeSpan.FromDays(35));
 }
Esempio n. 16
0
        /// <summary>
        /// Constructor for the Crypto security
        /// </summary>
        /// <param name="symbol">The security's symbol</param>
        /// <param name="exchangeHours">Defines the hours this exchange is open</param>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="symbolProperties">The symbol properties for this security</param>
        /// <param name="currencyConverter">Currency converter used to convert <see cref="CashAmount"/>
        /// instances into units of the account currency</param>
        /// <param name="registeredTypes">Provides all data types registered in the algorithm</param>
        public Crypto(Symbol symbol,
                      SecurityExchangeHours exchangeHours,
                      Cash quoteCurrency,
                      SymbolProperties symbolProperties,
                      ICurrencyConverter currencyConverter,
                      IRegisteredSecurityDataTypesProvider registeredTypes)
            : base(symbol,
                   quoteCurrency,
                   symbolProperties,
                   new CryptoExchange(exchangeHours),
                   new ForexCache(),
                   new SecurityPortfolioModel(),
                   new ImmediateFillModel(),
                   new GDAXFeeModel(),
                   new ConstantSlippageModel(0),
                   new ImmediateSettlementModel(),
                   Securities.VolatilityModel.Null,
                   new CashBuyingPowerModel(),
                   new ForexDataFilter(),
                   new SecurityPriceVariationModel(),
                   currencyConverter,
                   registeredTypes
                   )
        {
            Holdings = new CryptoHolding(this, currencyConverter);

            // decompose the symbol into each currency pair
            string quoteCurrencySymbol, baseCurrencySymbol;

            DecomposeCurrencyPair(symbol, symbolProperties, out baseCurrencySymbol, out quoteCurrencySymbol);
            BaseCurrencySymbol = baseCurrencySymbol;
        }
Esempio n. 17
0
 /// <summary>
 /// Construct the Equity Object
 /// </summary>
 public Equity(SecurityExchangeHours exchangeHours,
               SubscriptionDataConfig config,
               Cash quoteCurrency,
               SymbolProperties symbolProperties,
               ICurrencyConverter currencyConverter,
               IRegisteredSecurityDataTypesProvider registeredTypes)
     : base(
         config,
         quoteCurrency,
         symbolProperties,
         new EquityExchange(exchangeHours),
         new EquityCache(),
         new SecurityPortfolioModel(),
         new EquityFillModel(),
         new InteractiveBrokersFeeModel(),
         new ConstantSlippageModel(0m),
         new ImmediateSettlementModel(),
         Securities.VolatilityModel.Null,
         new SecurityMarginModel(2m),
         new EquityDataFilter(),
         new AdjustedPriceVariationModel(),
         currencyConverter,
         registeredTypes
         )
 {
     Holdings = new EquityHolding(this, currencyConverter);
 }
Esempio n. 18
0
        public ExchangePoint(ICalulatingMachine calulatingMachine, ICurrencyConverter currencyConverter, int comissionPercent)
        {
            _calulatingMachine = calulatingMachine;
            _currencyConverter = currencyConverter;

            ComissionPercent = comissionPercent;
        }
Esempio n. 19
0
 /// <summary>
 /// Create a new holding class instance setting the initial properties to $0.
 /// </summary>
 /// <param name="security">The security being held</param>
 /// <param name="currencyConverter">A currency converter instance</param>
 public SecurityHolding(Security security, ICurrencyConverter currencyConverter)
 {
     _security = security;
     //Total Sales Volume for the day
     _totalSaleVolume   = 0;
     _lastTradeProfit   = 0;
     _currencyConverter = currencyConverter;
 }
Esempio n. 20
0
 public OrderLine(Guid orderId, Guid productId, Money productPrice,
                  int quantity, Currency currency, ICurrencyConverter currencyConverter)
 {
     OrderId   = orderId;
     ProductId = productId;
     Quantity  = quantity;
     CalculateProductPrices(productPrice, currency, currencyConverter);
 }
 public BinaryOperationWithConverterTest()
 {
     var mock = new MockCurrencyConverter();
     mock.RegisterConversionRate(Currency.USD, Currency.AUD, 1.3m);
     mock.RegisterConversionRate(Currency.EUR, Currency.AUD, 1.8m);
     
     this.currencyConverter = mock;
 }
Esempio n. 22
0
 private Order(Cart cart, Currency currency, ICurrencyConverter converter)
 {
     CreatedAt = DateTime.Now;
     Status    = OrderStatus.Placed;
     Customer  = cart.Customer;
     BuildOrderLines(cart, currency, converter);
     AddDomainEvent(new OrderPlacedEvent(Id));
 }
Esempio n. 23
0
 public Framework(string name = "", bool createServers = true)
 {
     this.name = name;
     this.LoadConfiguration();
     this.eventBus = new EventBus(this, EventBusMode.Realtime);
     this.clock    = new Clock(this, ClockMode.Realtime, false);
     this.eventBus.reminderQueue = this.clock.reminderQueue;
     this.eventServer            = new EventServer(this, this.eventBus);
     this.eventManager           = new EventManager(this, this.eventBus);
     this.streamerManager        = new StreamerManager();
     this.streamerManager.Add(new DataObjectStreamer());
     this.streamerManager.Add(new InstrumentStreamer());
     this.streamerManager.Add(new BidStreamer());
     this.streamerManager.Add(new AskStreamer());
     this.streamerManager.Add(new QuoteStreamer());
     this.streamerManager.Add(new TradeStreamer());
     this.streamerManager.Add(new BarStreamer());
     this.streamerManager.Add(new Level2SnapshotStreamer());
     this.streamerManager.Add(new Level2UpdateStreamer());
     this.streamerManager.Add(new NewsStreamer());
     this.streamerManager.Add(new FundamentalStreamer());
     this.streamerManager.Add(new DataSeriesStreamer());
     if (createServers)
     {
         if (this.configuration.IsInstrumentFileLocal)
         {
             this.instrumentServer = new FileInstrumentServer(this, this.configuration.InstrumentFileName, null);
         }
         else
         {
             this.instrumentServer = new FileInstrumentServer(this, "instruments.quant", this.configuration.InstrumentFileHost);
         }
         this.instrumentManager = new InstrumentManager(this, this.InstrumentServer);
         if (this.configuration.IsDataFileLocal)
         {
             this.dataServer = new FileDataServer(this, this.configuration.DataFileName, null);
         }
         else
         {
             this.dataServer = new FileDataServer(this, "data.quant", this.configuration.DataFileHost);
         }
         this.dataManager = new DataManager(this, this.dataServer);
     }
     this.providerManager     = new ProviderManager(this, null, new ExecutionSimulator(this));
     this.eventLoggerManager  = new EventLoggerManager();
     this.subscriptionManager = new SubscriptionManager(this);
     this.orderManager        = new OrderManager(this);
     this.portfolioManager    = new PortfolioManager(this);
     this.strategyManager     = new StrategyManager(this);
     this.groupManager        = new GroupManager(this);
     this.accountDataManager  = new AccountDataManager(this);
     this.currencyConverter   = new CurrencyConverter(this);
     this.dataFileManager     = new DataFileManager(Installation.DataDir.FullName);
     if (Framework.currentFramework == null)
     {
         Framework.currentFramework = this;
     }
 }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InitialMarginRequiredForOrderParameters"/> class
 /// </summary>
 /// <param name="currencyConverter">The currency converter</param>
 /// <param name="security">The security</param>
 /// <param name="order">The order</param>
 public InitialMarginRequiredForOrderParameters(
     ICurrencyConverter currencyConverter,
     Security security,
     Order order)
 {
     CurrencyConverter = currencyConverter;
     Security          = security;
     Order             = order;
 }
Esempio n. 25
0
        public BinaryOperationWithConverterTest()
        {
            var mock = new MockCurrencyConverter();

            mock.RegisterConversionRate(Currency.USD, Currency.AUD, 1.3m);
            mock.RegisterConversionRate(Currency.EUR, Currency.AUD, 1.8m);

            this.currencyConverter = mock;
        }
Esempio n. 26
0
 public AntiFraudCollector(
     IConnectionMultiplexer connectionMultiplexer,
     ICurrencyConverter currencyConverter,
     string redisInstanceName)
 {
     _currencyConverter = currencyConverter;
     _db           = connectionMultiplexer.GetDatabase();
     _instanceName = redisInstanceName;
 }
Esempio n. 27
0
        public Money <T> Evaluate(ICurrencyConverter <T> currencyConverter, Currency toCurrency)
        {
            if (currencyConverter == null)
            {
                throw new ArgumentNullException("currencyConverter");
            }

            return(this.EvaluateInner(currencyConverter, toCurrency));
        }
Esempio n. 28
0
        public Money <T> Evaluate(ICurrencyConverter <T> currencyConverter, string toCurrency)
        {
            if (string.IsNullOrWhiteSpace(toCurrency))
            {
                throw new ArgumentNullException("toCurrency");
            }

            return(this.Evaluate(currencyConverter, (Currency)Enum.Parse(typeof(Currency), toCurrency.ToUpperInvariant())));
        }
Esempio n. 29
0
 public DividendJOPPDGenerator(
     ICurrencyConverter currencyConverter,
     IDividendCalculator dividendCalculator,
     IPayment2DBarCodeGenerator payment2DBarCodeGenerator)
 {
     this.currencyConverter         = currencyConverter;
     this.dividendCalculator        = dividendCalculator;
     this.payment2DBarCodeGenerator = payment2DBarCodeGenerator;
 }
 public SalaryJOPPDGenerator(
     ICurrencyConverter currencyConverter,
     ISalaryCalculator salaryCalculator,
     IPayment2DBarCodeGenerator payment2DBarCodeGenerator)
 {
     this.currencyConverter         = currencyConverter;
     this.salaryCalculator          = salaryCalculator;
     this.payment2DBarCodeGenerator = payment2DBarCodeGenerator;
 }
Esempio n. 31
0
        /// <summary>
        /// Проставление полных стоимостей цены и её частей на основании подробностей цены с приведением к заданной валюте
        /// </summary>
        public void CalculateTotalPrices(string currency, ICurrencyConverter currencyConverter)
        {
            TotalPrice = new Money(0, currency, currencyConverter);

            foreach (var pricePart in GetPriceBreakdownsForCalculatingTotalPrice())
            {
                pricePart.CalculateTotalPrice();
                TotalPrice += currencyConverter.Convert(pricePart.TotalPrice, currency);
            }
        }
Esempio n. 32
0
        public MainWindowViewModel(ICurrencyConverter currencyConverter,
                                   ICurrencyProvider currencyProvider)
        {
            _currencyConverter = currencyConverter;
            ConvertCommand     = new RelayCommand(Convert, CanConvert);

            Currencies           = new ObservableCollection <CurrencyCodes>(currencyProvider.GetAvailableCurrencies());
            SelectedFromCurrency = Currencies.FirstOrDefault();
            SelectedToCurrency   = Currencies.LastOrDefault();
        }
Esempio n. 33
0
        public Money GetTotal(ICurrencyConverter currencyConverter, Currency currency)
        {
            var amount = _orderLines.Sum(ol =>
            {
                Money convertedProductPrice = currencyConverter.Convert(ol.Product.Price, currency);
                return(convertedProductPrice.Amount * ol.Quantity);
            });

            return(new Money(currency, amount));
        }
 protected ProductManagement(IDbProductRepository dbProductRepository, ICurrencyConverter currencyConverter,
     IUserGroup userGroup, ILangSetter langSetter, ICurrencyCultureService<HttpCookieCollection> currencyCultureService,
     IGridViewProductManagementManager<HttpSessionState> gridViewProductManagementManager)
 {
     _dbProductRepository = dbProductRepository;
     _currencyConverter = currencyConverter;
     _userGroup = userGroup;
     _langSetter = langSetter;
     _currencyCultureService = currencyCultureService;
     _gridViewProductManagementManager = gridViewProductManagementManager;
 }
Esempio n. 35
0
		public Framework(string name = "", bool createServers = true)
		{
			this.name = name;
			this.LoadConfiguration();
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			if (createServers)
			{
				if (this.configuration.IsInstrumentFileLocal)
				{
					this.instrumentServer = new FileInstrumentServer(this, this.configuration.InstrumentFileName, null);
				}
				else
				{
					this.instrumentServer = new FileInstrumentServer(this, "instruments.quant", this.configuration.InstrumentFileHost);
				}
				this.instrumentManager = new InstrumentManager(this, this.InstrumentServer);
				if (this.configuration.IsDataFileLocal)
				{
					this.dataServer = new FileDataServer(this, this.configuration.DataFileName, null);
				}
				else
				{
					this.dataServer = new FileDataServer(this, "data.quant", this.configuration.DataFileHost);
				}
				this.dataManager = new DataManager(this, this.dataServer);
			}
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.subscriptionManager = new SubscriptionManager(this);
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.accountDataManager = new AccountDataManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}
Esempio n. 36
0
 public CachedConverterTest()
 {
     this.mockCountingConverter = new MockCountingConverter();
     this.sut = new CachedCurrencyConverter<decimal>(this.mockCountingConverter);
 }
Esempio n. 37
0
		public Framework(string name, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer = null)
		{
			this.isExternalDataQueue = true;
			this.name = name;
			this.LoadConfiguration();
			this.clock = new Clock(this, ClockMode.Realtime, false);
			this.eventBus = new EventBus(this, EventBusMode.Realtime);
			this.eventBus.reminderQueue = this.clock.reminderQueue;
			externalBus.Attach(this.eventBus);
			this.eventServer = new EventServer(this, this.eventBus);
			this.eventManager = new EventManager(this, this.eventBus);
			this.streamerManager = new StreamerManager();
			this.streamerManager.Add(new DataObjectStreamer());
			this.streamerManager.Add(new InstrumentStreamer());
			this.streamerManager.Add(new BidStreamer());
			this.streamerManager.Add(new AskStreamer());
			this.streamerManager.Add(new QuoteStreamer());
			this.streamerManager.Add(new TradeStreamer());
			this.streamerManager.Add(new BarStreamer());
			this.streamerManager.Add(new Level2SnapshotStreamer());
			this.streamerManager.Add(new Level2UpdateStreamer());
			this.streamerManager.Add(new NewsStreamer());
			this.streamerManager.Add(new FundamentalStreamer());
			this.streamerManager.Add(new DataSeriesStreamer());
			this.instrumentServer = instrumentServer;
			this.instrumentManager = new InstrumentManager(this, instrumentServer);
			this.dataServer = dataServer;
			this.dataManager = new DataManager(this, dataServer);
			this.providerManager = new ProviderManager(this, null, new ExecutionSimulator(this));
			this.eventLoggerManager = new EventLoggerManager();
			this.orderManager = new OrderManager(this);
			this.portfolioManager = new PortfolioManager(this);
			this.strategyManager = new StrategyManager(this);
			this.groupManager = new GroupManager(this);
			this.currencyConverter = new CurrencyConverter(this);
			this.dataFileManager = new DataFileManager(Installation.DataDir.FullName);
			if (Framework.currentFramework == null)
			{
				Framework.currentFramework = this;
			}
		}
Esempio n. 38
0
		public Money(Money money)
		{
			Value = money.Value;
			Currency = money.Currency;
			CurrencyConverter = money.CurrencyConverter;
		}
Esempio n. 39
0
 public CurrencyConverterService(ICurrencyConverter converter)
 {
     _converter = converter;
 }
Esempio n. 40
0
		/// <summary>
		/// Создаёт новый объект денег
		/// </summary>
		/// <param name="amount">Сумма денег</param>
		/// <param name="currency">Код валюты</param>
		/// <param name="currencyConverter">Объект для осуществления конвертации валют</param>
		public Money(double amount, string currency, ICurrencyConverter currencyConverter = null)
		{
			Value = amount;
			Currency = currency;
			CurrencyConverter = currencyConverter;
		}