Example #1
0
        private void UpdateStrategyAdjustment(ContractKeyVM contract, StrategyVM.Model model, double adjust)
        {
            var strategy = _otcOptionHandler.StrategyVMCollection.FirstOrDefault(s => s.Equals(contract));

            if (strategy != null)
            {
                PricingContractParamVM pricingContract = null;
                switch (model)
                {
                case StrategyVM.Model.PM:
                    pricingContract = strategy.PricingContractParams.FirstOrDefault();
                    break;

                case StrategyVM.Model.IVM:
                    pricingContract = strategy.IVMContractParams.FirstOrDefault();
                    break;

                case StrategyVM.Model.VM:
                    pricingContract = strategy.VMContractParams.FirstOrDefault();
                    break;
                }

                if (pricingContract != null)
                {
                    pricingContract.Adjust = adjust;
                    _otcOptionHandler.UpdateStrategyPricingContracts(strategy, model);
                }
            }
        }
Example #2
0
        private async void contract1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (contract1.SelectedItem != null)
            {
                var uexchange = exchange1.SelectedValue?.ToString();
                var uc        = contract1.SelectedItem?.ToString();
                var handler   = MessageHandlerContainer.DefaultInstance.Get <MarketDataHandler>();
                QuoteVMCollection1.Clear();

                var mktDataVM = await handler.SubMarketDataAsync(uc);

                if (mktDataVM != null)
                {
                    QuoteVMCollection1.Add(mktDataVM);
                }

                var contract = SubbedContracts?.FirstOrDefault();
                if (contract != null)
                {
                    var strategy =
                        _otcOptionHandler.StrategyVMCollection.FirstOrDefault(s => s.Exchange == contract.Exchange && s.Contract == contract.Contract);
                    var pricingContract = strategy.IVMContractParams.FirstOrDefault();
                    if (pricingContract != null && pricingContract.Exchange == uexchange && pricingContract.Contract == uc)
                    {
                        return;
                    }

                    if (pricingContract == null)
                    {
                        pricingContract = new PricingContractParamVM();
                        strategy.IVMContractParams.Add(pricingContract);
                    }
                    pricingContract.Exchange = uexchange;
                    pricingContract.Contract = uc;
                    _otcOptionHandler.UpdateStrategyPricingContracts(strategy, StrategyVM.Model.IVM);
                }
            }
        }