/// <summary>
 /// Generic constructor
 /// </summary>
 /// <param name="loggerRef"></param>
 /// <param name="cache"></param>
 /// <param name="nameSpace"></param>
 public PricingStructures(Reference <ILogger> loggerRef, ICoreCache cache, string nameSpace)
 {
     Logger    = loggerRef;
     NameSpace = nameSpace;
     if (cache != null)
     {
         Cache = cache;
     }
     else if (Cache == null)
     {
         try
         {
             CoreClientFactory factory = new CoreClientFactory(Logger)
                                         .SetEnv(BuildEnv.ToString())
                                         .SetApplication(Assembly.GetExecutingAssembly())
                                         .SetProtocols(WcfConst.AllProtocolsStr)
                                         .SetServers("localhost");
             Cache = factory.Create();
         }
         catch (Exception excp)
         {
             Logger.Target.Log(excp);
         }
     }
 }
示例#2
0
        private void StartUp()
        {
            try
            {
                var factory = new CoreClientFactory(_loggerRef)
                              .SetEnv("Dev")
                              .SetApplication(Assembly.GetExecutingAssembly())
                              .SetProtocols(WcfConst.AllProtocolsStr)
                              .SetServers("localhost");
                var client = factory.Create();
                _clientRef = Reference <ICoreClient> .Create(client);

                _cache = _clientRef.Target.CreateCache();
                // init controls
                // - form title
                var env = _clientRef.Target.ClientInfo.ConfigEnv;
                Text += String.Format(" ({0})", EnvHelper.EnvName(env));
                // - server port
                int defaultPort = EnvHelper.SvcPort(env, SvcId.GridSwitch);
                chkChangePort.Text = String.Format("Change server port from default ({0}) to:", defaultPort);
                _syncContext.Post(OnClientStateChange, new CoreStateChange(CoreStateEnum.Initial, _clientRef.Target.CoreState));
                _clientRef.Target.OnStateChange += _Client_OnStateChange;
            }
            catch (Exception excp)
            {
                _loggerRef.Target.Log(excp);
            }
        }
 private void StartUp()
 {
     _loggerRef.Target.Clear();
     ClearTree();
     try
     {
         CoreClientFactory factory = new CoreClientFactory(_loggerRef)
                                     .SetEnv(cbEnvId.Text)
                                     .SetApplication(Assembly.GetExecutingAssembly())
                                     .SetProtocols(WcfConst.AllProtocolsStr);
         if (rbDefaultServers.Checked)
         {
             _client = factory.Create();
         }
         else if (rbLocalhost.Checked)
         {
             _client = factory.SetServers("localhost").Create();
         }
         else
         {
             _client = factory.SetServers(txtSpecificServers.Text).Create();
         }
         _syncContext.Post(OnClientStateChange, new CoreStateChange(CoreStateEnum.Initial, _client.CoreState));
         _client.OnStateChange += _Client_OnStateChange;
     }
     catch (Exception excp)
     {
         _loggerRef.Target.Log(excp);
     }
 }
示例#4
0
        // This method is used to connect to Core API with specific credentials
        public static ICoreClient GetFullCoreClient(string host, int port, string username, string password)
        {
            var networkCreds = new NetworkCredential(username, password);
            var factory = new CoreClientFactory();
            var coreClient = factory.Create(CreateApiUri(host, port));
            coreClient.UseSpecificCredentials(networkCreds);

            return coreClient;
        }
示例#5
0
        // This method used to connect to Core API with creds from current active seesion
        public static ICoreClient GetDefaultCoreClient(string host, int port)
        {
            var coreClientFactory = new CoreClientFactory();

            var coreClient = coreClientFactory.Create(CreateApiUri(host, port));
            coreClient.UseDefaultCredentials();

            return coreClient;
        }
        // This method is used to connect to Core API with specific credentials
        public static ICoreClient GetFullCoreClient(CoreConnectionCredentials coreCredentials)
        {
            var networkCreds = new NetworkCredential(coreCredentials.Username, coreCredentials.Password);
            var factory = new CoreClientFactory();
            var coreClient = factory.Create(CreateApiUri(coreCredentials.Hostname, coreCredentials.Port));
            coreClient.UseSpecificCredentials(networkCreds);

            return coreClient;
        }
        // This method used to connect to Core API with creds from current active seesion
        public static ICoreClient GetDefaultCoreClient(CoreConnectionCredentials coreCredentials)
        {
            var coreClientFactory = new CoreClientFactory();

            var coreClient = coreClientFactory.Create(CreateApiUri(coreCredentials.Hostname, coreCredentials.Port));
            coreClient.UseDefaultCredentials();

            return coreClient;
        }
示例#8
0
        // This method is used to connect to Core API with specific credentials
        private static ICoreClient GetFullCoreClient(CoreConnectionCredentials coreCredentials)
        {
            var networkCreds = new NetworkCredential(coreCredentials.Username, coreCredentials.Password);
            var factory      = new CoreClientFactory();
            var coreClient   = factory.Create(CreateApiUri(coreCredentials.Hostname, coreCredentials.Port));

            coreClient.UseSpecificCredentials(networkCreds);

            return(coreClient);
        }
示例#9
0
        // This method used to connect to Core API with creds from current active seesion
        public static ICoreClient GetDefaultCoreClient(CoreConnectionCredentials coreCredentials)
        {
            var coreClientFactory = new CoreClientFactory();

            var coreClient = coreClientFactory.Create(CreateApiUri(coreCredentials.Hostname, coreCredentials.Port));

            coreClient.UseDefaultCredentials();

            return(coreClient);
        }
        /// <summary>
        /// Simplest constructor
        /// </summary>
        public PricingStructures()
        {
            Logger = Reference <ILogger> .Create(new TraceLogger(true));

            NameSpace = EnvironmentProp.DefaultNameSpace;
            CoreClientFactory factory = new CoreClientFactory(Logger)
                                        .SetEnv(BuildEnv.ToString())
                                        .SetApplication(Assembly.GetExecutingAssembly())
                                        .SetProtocols(WcfConst.AllProtocolsStr)
                                        .SetServers("localhost");

            Cache = factory.Create();
        }
示例#11
0
        private void StartUp()
        {
            try
            {
                var factory = new CoreClientFactory(_loggerRef)
                              .SetEnv("Dev")
                              .SetApplication(Assembly.GetExecutingAssembly())
                              .SetProtocols(WcfConst.AllProtocolsStr)
                              .SetServers("localhost");
                var client = factory.Create();
                _clientRef = Reference <ICoreClient> .Create(client);

                _cache = _clientRef.Target.CreateCache();
                // init controls
                // - form title
                EnvId env = _clientRef.Target.ClientInfo.ConfigEnv;
                Text += String.Format(" ({0})", EnvHelper.EnvName(env));
                // - server port
                int defaultPort = EnvHelper.SvcPort(env, SvcId.GridSwitch);
                _qasDefViewHelper = new QASDefViewHelper();
                _qasDefDataHelper = new QASDefDataHelper();
                _qasDefFilters    = new ComboxBoxFilterGroup(panelQASDef, _qasDefViewHelper, QASDefSelectionChanged);
                _qasDefSelecter   = new QASDefSelecter(
                    _qasDefFilters, _qasDefViewHelper, _qasDefDataHelper);
                _qasDefView = new ListViewManager <RatesObj>(
                    _loggerRef.Target, lvQASDef, _qasDefViewHelper,
                    _qasDefSelecter, _qasDefFilters, new QASDefSorter(), _qasDefDataHelper);
                //Get the starting configuration
                //
                chkChangePort.Text = String.Format("Change server port from default ({0}) to:", defaultPort);
                //Set up the timer and the random number generator.
                //
                _timer = new System.Timers.Timer(10000);
                _rand  = new Random();
            }
            catch (Exception excp)
            {
                _loggerRef.Target.Log(excp);
            }
        }
示例#12
0
        private void Form1Load(object sender, EventArgs e)
        {
            // create loggers
            _loggerRef = Reference <ILogger> .Create(new TextBoxLogger(txtMainLog));

            // create client factory and client
            _clientFactory = new CoreClientFactory(_loggerRef);
            _clientFactory.SetEnv(BuildConst.BuildEnv);
            _clientFactory.SetApplication(Assembly.GetExecutingAssembly());
            _client = _clientFactory.Create();
            // - form title
            WinFormHelper.SetAppFormTitle(this, EnvHelper.EnvName(BuildEnv));
            // setup the AlertRule view
            _alertRuleViewHelper = new AlertRuleViewHelper();
            _alertRuleDataHelper = new AlertRuleDataHelper();
            _alertRuleFilters    = new ComboxBoxFilterGroup(
                panelAlertRule, _alertRuleViewHelper, AlertRuleSelectionChanged);
            _alertRuleSelecter = new AlertRuleSelecter(
                _alertRuleFilters, _alertRuleViewHelper, _alertRuleDataHelper);
            _alertRuleView = new ListViewManager <AlertRule>(
                _loggerRef.Target, lvAlertRule, _alertRuleViewHelper,
                _alertRuleSelecter, _alertRuleFilters, new AlertRuleSorter(), _alertRuleDataHelper);

            ICoreCache alertRuleCache = _client.CreateCache(
                update => _alertRuleView.UpdateData(new ViewChangeNotification <AlertRule>
            {
                Change  = update.Change,
                OldData =
                    (AlertRule)update.OldItem?.Data,
                NewData =
                    (AlertRule)update.NewItem?.Data
            }), SynchronizationContext.Current);

            alertRuleCache.SubscribeNoWait <AlertRule>(Expr.ALL, null, null);
            // setup the AlertSignal view
            _alertSignalViewHelper = new AlertSignalViewHelper();
            _alertSignalDataHelper = new AlertSignalDataHelper();
            _alertSignalFilters    = new ComboxBoxFilterGroup(
                panelAlertSignal, _alertSignalViewHelper, AlertSignalSelectionChanged);
            _alertSignalSelecter = new AlertSignalSelecter(
                _alertSignalFilters, _alertSignalViewHelper, _alertSignalDataHelper);
            _alertSignalView = new ListViewManager <AlertSignal>(
                _loggerRef.Target, lvAlertSignal, _alertSignalViewHelper,
                _alertSignalSelecter, _alertSignalFilters, new AlertSignalSorter(), _alertSignalDataHelper);
            ICoreCache alertSignalCache = _client.CreateCache(
                update => _alertSignalView.UpdateData(new ViewChangeNotification <AlertSignal>
            {
                Change  = update.Change,
                OldData =
                    (AlertSignal)update.OldItem?.Data,
                NewData =
                    (AlertSignal)update.NewItem?.Data
            }), SynchronizationContext.Current);

            alertSignalCache.SubscribeNoWait <AlertSignal>(Expr.ALL, null, null);
            // setup the LogEvent view
            _logEventViewHelper = new LogEventViewHelper();
            _logEventDataHelper = new LogEventDataHelper();
            _logEventFilters    = new ComboxBoxFilterGroup(
                panelLogEvent, _logEventViewHelper, LogEventSelectionChanged);
            _logEventSelecter = new LogEventSelecter(
                _logEventFilters, _logEventViewHelper, _logEventDataHelper);
            _logEventView = new ListViewManager <DebugLogEvent>(
                _loggerRef.Target, lvLogEvent, _logEventViewHelper,
                _logEventSelecter, _logEventFilters, new LogEventSorter(), _logEventDataHelper);
            ICoreCache logEventCache = _client.CreateCache(
                update => _logEventView.UpdateData(new ViewChangeNotification <DebugLogEvent>
            {
                Change  = update.Change,
                OldData =
                    (DebugLogEvent)update.OldItem?.Data,
                NewData =
                    (DebugLogEvent)update.NewItem?.Data
            }), SynchronizationContext.Current);

            logEventCache.SubscribeNoWait <DebugLogEvent>(Expr.ALL, null, null);
            // init controls
            // server 0
            _serverAddress[0] = txtServer0Address;
            _ping[0]          = chkServer0Ping;
            _lastChecked[0]   = txtServer0LastChecked;
            _lastReplied[0]   = txtServer0LastReplied;
            _serverStatus[0]  = txtServer0Status;
            _serverReason[0]  = txtServer0OtherInfo;
            // server 1
            _serverAddress[1] = txtServer1Address;
            _ping[1]          = chkServer1Ping;
            _lastChecked[1]   = txtServer1LastChecked;
            _lastReplied[1]   = txtServer1LastReplied;
            _serverStatus[1]  = txtServer1Status;
            _serverReason[1]  = txtServer1OtherInfo;
            // server 2
            _serverAddress[2] = txtServer2Address;
            _ping[2]          = chkServer2Ping;
            _lastChecked[2]   = txtServer2LastChecked;
            _lastReplied[2]   = txtServer2LastReplied;
            _serverStatus[2]  = txtServer2Status;
            _serverReason[2]  = txtServer2OtherInfo;
            // server 3
            _serverAddress[3] = txtServer3Address;
            _ping[3]          = chkServer3Ping;
            _lastChecked[3]   = txtServer3LastChecked;
            _lastReplied[3]   = txtServer3LastReplied;
            _serverStatus[3]  = txtServer3Status;
            _serverReason[3]  = txtServer3OtherInfo;
            // server 4
            _serverAddress[4] = txtServer4Address;
            _ping[4]          = chkServer4Ping;
            _lastChecked[4]   = txtServer4LastChecked;
            _lastReplied[4]   = txtServer4LastReplied;
            _serverStatus[4]  = txtServer4Status;
            _serverReason[4]  = txtServer4OtherInfo;
            // server 5
            _serverAddress[5] = txtServer5Address;
            _ping[5]          = chkServer5Ping;
            _lastChecked[5]   = txtServer5LastChecked;
            _lastReplied[5]   = txtServer5LastReplied;
            _serverStatus[5]  = txtServer5Status;
            _serverReason[5]  = txtServer5OtherInfo;
            for (int i = 0; i < NServers; i++)
            {
                _lastChecked[i].BackColor  = Color.FromKnownColor(KnownColor.Window);
                _lastReplied[i].BackColor  = Color.FromKnownColor(KnownColor.Window);
                _serverStatus[i].BackColor = Color.FromKnownColor(KnownColor.Window);
                _serverReason[i].BackColor = Color.FromKnownColor(KnownColor.Window);
            }
        }
示例#13
0
        private void BtnLoadSelectedClick(object sender, EventArgs e)
        {
            _logRef.Target.Clear();
            _logRef.Target.LogDebug("Loading commenced...");
            var nameSpace = cBoxNameSpaces.Text;

            using (ICoreClient client = _factory.Create())
            {
                if (chkDeleteAllConfig.Checked)
                {
                    chkDeleteAllConfig.Checked = false;
                    client.DeleteTypedObjects(null, Expr.StartsWith(Expr.SysPropItemName, nameSpace + ".Configuration."));
                }
                if (chkDeleteAllStatus.Checked)
                {
                    chkDeleteAllStatus.Checked = false;
                    client.DeleteTypedObjects(null, Expr.StartsWith(Expr.SysPropItemName, nameSpace + ".Status."));
                }
                if (chkDeleteAllAppSettings.Checked)
                {
                    chkDeleteAllAppSettings.Checked = false;
                    client.DeleteObjects <AppCfgRuleV2>(Expr.ALL);
                }
                if (chkMDSProviderMaps.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.MarketDataConfigHelper.LoadProviderRules(_logRef.Target, client);
                    }
                    else
                    {
                        MarketDataConfigHelper.LoadProviderRules(_logRef.Target, client, nameSpace);
                    }
                    chkMDSProviderMaps.Checked = false;
                }
                if (chkPricingStructureDefs.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.PricingStructureLoader.LoadPricingStructures(_logRef.Target, client);
                    }
                    else
                    {
                        PricingStructureLoader.LoadPricingStructures(_logRef.Target, client, nameSpace);
                    }
                    chkPricingStructureDefs.Checked = false;
                }
                if (chkAlertMonitorRules.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.AlertRulesLoader.Load(_logRef.Target, client);
                    }
                    else
                    {
                        AlertRulesLoader.Load(_logRef.Target, client, nameSpace);
                    }
                    chkAlertMonitorRules.Checked = false;
                }
                if (chkFileImportRules.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.FileImportRuleLoader.Load(_logRef.Target, client);
                    }
                    else
                    {
                        FileImportRuleLoader.Load(_logRef.Target, client, nameSpace);
                    }
                    chkFileImportRules.Checked = false;
                }
                if (chkTradeImportRules.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.TradeImportRuleLoader.Load(_logRef.Target, client);
                    }
                    else
                    {
                        TradeImportRuleLoader.Load(_logRef.Target, client, nameSpace);
                    }
                    chkTradeImportRules.Checked = false;
                }
                if (chkStressRules.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.StressDefinitionLoader.LoadStressDefinitions(_logRef.Target, client);
                        //Orion.Configuration.StressDefinitionLoader.LoadScenarioDefinitions(_logRef.Target, client);
                    }
                    else
                    {
                        StressDefinitionLoader.LoadStressDefinitions(_logRef.Target, client, nameSpace);
                        StressDefinitionLoader.LoadScenarioDefinitions(_logRef.Target, client, nameSpace);
                    }
                    chkStressRules.Checked = false;
                }
                if (chkAppSettings.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.AppSettingsLoader.Load(_logRef.Target, client);
                    }
                    else
                    {
                        AppSettingsLoader.Load(_logRef.Target, client, nameSpace);
                    }
                    chkAppSettings.Checked = false;
                }
                if (chkInstrumentsConfig.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.ConfigDataLoader.LoadInstrumentsConfig(_logRef.Target, client);
                    }
                    else
                    {
                        ConfigDataLoader.LoadInstrumentsConfig(_logRef.Target, client, nameSpace);
                    }
                    chkInstrumentsConfig.Checked = false;
                }
                if (chkAlgorithmConfig.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.ConfigDataLoader.LoadPricingStructureAlgorithm(_logRef.Target, client);
                    }
                    else
                    {
                        ConfigDataLoader.LoadPricingStructureAlgorithm(_logRef.Target, client, nameSpace);
                    }
                    chkAlgorithmConfig.Checked = false;
                }
                if (chkDateRules.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.ConfigDataLoader.LoadDateRules(_logRef.Target, client);
                    }
                    else
                    {
                        ConfigDataLoader.LoadDateRules(_logRef.Target, client, nameSpace);
                    }
                    chkDateRules.Checked = false;
                }
                if (bondDataCheckBox.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.MarketLoader.LoadFixedIncomeData(_logRef.Target, client);
                    }
                    else
                    {
                        MarketLoader.LoadFixedIncomeData(_logRef.Target, client, nameSpace);
                    }
                    bondDataCheckBox.Checked = false;
                }
                if (checkBoxMarkets.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.MarketLoader.Load(_logRef.Target, client);
                    }
                    else
                    {
                        MarketLoader.Load(_logRef.Target, client, nameSpace);
                    }
                    checkBoxMarkets.Checked = false;
                }
                if (checkBoxFpML.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.ConfigDataLoader.LoadFpml(_logRef.Target, client);
                        //Orion.Configuration.ConfigDataLoader.LoadGwml(_logRef.Target, client);
                    }
                    else
                    {
                        ConfigDataLoader.LoadFpMLCodes(_logRef.Target, client, nameSpace);
                    }
                    checkBoxFpML.Checked = false;
                }
                if (checkBoxHolidayDates.Checked)
                {
                    if (nameSpace == "FpML.V4r7")
                    {
                        //Orion.Configuration.ConfigDataLoader.LoadNewHolidayDates(_logRef.Target, client);
                    }
                    else
                    {
                        ConfigDataLoader.LoadNewHolidayDates(_logRef.Target, client, nameSpace);
                    }
                    checkBoxHolidayDates.Checked = false;
                }
            }
            _logRef.Target.LogDebug("Load completed.");
        }