public PrivateCoreTests()
        {
            _client = new PrivateCore(new TraceLogger(false));
            Dictionary <string, object> properties = new Dictionary <string, object>();
            NamedValueSet namedValueSet            = new NamedValueSet(properties);
            Market        market0 = new Market {
                id = "Market0"
            };

            _client.SaveObject(market0, market0.id, namedValueSet, TimeSpan.MaxValue);
            Market market1 = new Market {
                id = "Market1"
            };

            _client.SaveObject(market1, market1.id, namedValueSet, TimeSpan.MaxValue);
            Market market2 = new Market {
                id = "Market2"
            };

            _client.SaveObject(market2, market2.id, namedValueSet, TimeSpan.MaxValue);
            Market market3 = new Market {
                id = "Market3"
            };

            _client.SaveObject(market3, market3.id, namedValueSet, TimeSpan.MaxValue);
        }
示例#2
0
 public XmlTreeDisplay(ICoreClient client, ICoreItem coreItem)
 {
     Client   = client;
     CoreItem = coreItem;
     InitializeComponent();
     LoadData();
 }
示例#3
0
        /// <summary>
        /// Application start
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ApplicationStart(object sender, EventArgs e)
        {
            const string fullAppName = "FpML.V5r3.PublisherWebService";

            LoggerRef.Target.LogInfo("Starting up...");
            try
            {
                //var stopwatch = new Stopwatch();
                //stopwatch.Start();
                CoreClientFactory factory = new CoreClientFactory(LoggerRef)
                                            .SetEnv("DEV")
                                            .SetApplication(Assembly.GetExecutingAssembly())
                                            .SetProtocols(WcfConst.AllProtocolsStr);
                _client = factory.SetServers("localhost").Create();
                _cache  = _client.CreateCache();
                //LoadConfigDataHelper.LoadConfigurationData(LogRef.Target, _Cache);//TODO get rid of this
                //stopwatch.Stop();
                //Debug.Print("Initialized test environment, in {0} seconds", stopwatch.Elapsed.TotalSeconds);
                LoggerRef.Target.LogInfo("Loaded..." + fullAppName);
            }
            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);
     }
 }
示例#5
0
        private static void PublishWorkerResponse(ICoreClient client, InternalRequest internalRequest, string hostInstance)
        {
            if (internalRequest.Status == RequestStatusEnum.Undefined)
            {
                throw new ArgumentNullException("status");
            }
            WorkerResponse response = new WorkerResponse()
            {
                RequestId          = internalRequest.RequestId.ToString(),
                WorkerHostComputer = Environment.MachineName,
                WorkerHostInstance = hostInstance,
                Status             = internalRequest.Status,
                FaultDetail        = internalRequest.FaultDetail
            };
            UserIdentity requesterId = null;

            if (internalRequest.ExternalRequest != null)
            {
                requesterId = internalRequest.ExternalRequest.RequesterId;
            }
            if ((requesterId == null) && (internalRequest.Cancellation != null))
            {
                requesterId = internalRequest.Cancellation.RequesterId;
            }
            response.RequesterId = requesterId;
            if ((response.Status == RequestStatusEnum.Cancelled) && (internalRequest.Cancellation != null))
            {
                response.CancelReason = internalRequest.Cancellation.CancelReason;
            }
            client.SaveObject <WorkerResponse>(response);
        }
示例#6
0
        private static void PublishManagerResponse(ICoreClient client, InternalRequest internalRequest)
        {
            if (internalRequest.Status == RequestStatusEnum.Undefined)
            {
                throw new ArgumentNullException("status");
            }
            ManagerResponse response = new ManagerResponse()
            {
                RequestId   = internalRequest.RequestId.ToString(),
                Status      = internalRequest.Status,
                FaultDetail = internalRequest.FaultDetail
            };
            UserIdentity requesterId = null;

            if (internalRequest.ExternalRequest != null)
            {
                requesterId = internalRequest.ExternalRequest.RequesterId;
            }
            if ((requesterId == null) && (internalRequest.Cancellation != null))
            {
                requesterId = internalRequest.Cancellation.RequesterId;
            }
            response.RequesterId = requesterId;
            if ((response.Status == RequestStatusEnum.Cancelled) && (internalRequest.Cancellation != null))
            {
                response.CancelReason = internalRequest.Cancellation.CancelReason;
            }
            client.SaveObject <ManagerResponse>(response);
        }
示例#7
0
 public SettingsTracker(ICoreClient client, string applName)
 {
     _client   = client;
     _applName = applName;
     // load current settings
     _currentSettings = _client.LoadAppSettings(_applName);
     _unsavedSettings = new NamedValueSet();
 }
示例#8
0
 // base constructor
 public MdpBaseProvider(ILogger logger, ICoreClient client, MDSProviderId providerId, ConsumerDelegate consumer)
 {
     Logger           = new FilterLogger(logger, $"{providerId}: ");
     Client           = client;
     ProviderId       = providerId;
     _marketDataMap   = new MarketDataMap(logger, providerId);
     ConsumerCallback = consumer;
     SubsMapExternal  = new Dictionary <Guid, RealtimeRequestMap>();
 }
示例#9
0
 public MarketDataRealtimeServer(
     Reference <ILogger> loggerRef,
     AsyncThreadQueue threadQueue,
     ICoreClient client)
 {
     _loggerRef       = loggerRef?.Clone() ?? throw new ArgumentNullException(nameof(loggerRef));
     _threadQueue     = threadQueue;
     _client          = client;
     _subsDetailIndex = new Dictionary <Guid, SubscriptionDetail>();
 }
示例#10
0
        public void ConvertQuotedAssetSetsToRateCurveDefinition()
        {
            const string curveType = "RateCurve";

            using (var logger = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (ICoreClient client = (new CoreClientFactory(logger)).SetEnv(BuildConst.BuildEnv).Create())
                {
                    IterateCurveProperties((ccy, index, marketName, tenor) =>
                    {
                        string indexName   = $"{ccy}-{index}";
                        string curveName   = $"{indexName}-{tenor}";
                        string qasItemName = String.Format("Orion.V5r3.QuotedAssetSet.{0}.{4}.{1}-{2}-{3}",
                                                           marketName, ccy, index, tenor, curveType);
                        // outputs
                        string curveItemName = String.Format("Orion.V5r3.Configuration.PricingStructures.{0}.{4}.{1}-{2}-{3}",
                                                             marketName, ccy, index, tenor, curveType);
                        var marketData = client.LoadObject <QuotedAssetSet>(qasItemName);
                        if (marketData != null)
                        {
                            RemoveMarketQuoteValues(marketData);
                            var curveDef = new Market
                            {
                                id    = curveName,
                                Items = new PricingStructure[] { new YieldCurve {
                                                                     id = curveName
                                                                 } },
                                Items1 = new PricingStructureValuation[] {
                                    new YieldCurveValuation {
                                        id = curveName, inputs = marketData
                                    }
                                }
                            };
                            var curveProps = new NamedValueSet();
                            curveProps.Set(CurveProp.Market, marketName);
                            curveProps.Set(CurveProp.PricingStructureType, curveType);
                            curveProps.Set(CurveProp.IndexName, indexName);
                            curveProps.Set(CurveProp.IndexTenor, tenor);
                            curveProps.Set(CurveProp.CurveName, curveName);
                            curveProps.Set("Algorithm", "FastLinearZero");
                            curveProps.Set(CurveProp.Currency1, ccy);
                            curveProps.Set(CurveProp.DataGroup, "Orion.V5r3.Configuration.PricingStructureType");
                            curveProps.Set("SourceSystem", "Orion");
                            curveProps.Set("Function", "Configuration");
                            curveProps.Set("Type", CurveProp.PricingStructureType);
                            curveProps.Set(CurveProp.UniqueIdentifier, curveItemName);
                            client.SaveObject(curveDef, curveItemName, curveProps, TimeSpan.MaxValue);
                        }
                    });
                }
            }
        }
        public void SetUp()
        {
            _mockAuthenticationManager = Substitute.For<IAuthenticationManager>();
            _mockCoreClient = Substitute.For<ICoreClient>();

            SetupValidUser();

            _accountController = new AccountController(_mockAuthenticationManager, _mockCoreClient);

            var context = Substitute.For<HttpContextBase>();
            var requestContext = new RequestContext(context, new RouteData());
            _accountController.ControllerContext = new ControllerContext(requestContext, _accountController);
        }
示例#12
0
        public static void Load(ILogger logger, ICoreClient targetClient)
        {
            logger.LogDebug("Loading App Settings...");

            Assembly assembly = Assembly.GetExecutingAssembly();
            {
                const string prefix = "Orion.Configuration.AppSettings";
                Dictionary <string, string> chosenFiles = ResourceHelper.GetResources(assembly, prefix, "txt");

                int loadCount = 0;
                foreach (KeyValuePair <string, string> file in chosenFiles)
                {
                    string[] nameParts  = file.Key.Split('.');
                    var      properties = new NamedValueSet(file.Value);
                    string   name       = nameParts[5];
                    EnvId    env        = EnvHelper.ParseEnvName(nameParts[4]);
                    if (env == targetClient.ClientInfo.ConfigEnv)
                    {
                        targetClient.SaveAppSettings(properties, name, null, null, true, env);
                        loadCount++;
                    }
                }
                logger.LogDebug("Loaded {0} App Settings.", loadCount);
            }

            // load data exporter sql configs
            {
                // DEV default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, null, true, EnvId.Dev_Development);
                // SIT default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwddqur02", null, "PortfolioValuer_SIT"),
                    "DataExportServer", null, null, true, EnvId.Sit_SystemTest);
                // STG default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadbrl01", null, "PortfolioValuer_STG"),
                    "DataExportServer", null, null, true, EnvId.Stg_StagingLive);

                // -------------------- additional development machines --------------------
                // sydwcndb12s - Simon's machine
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, "sydwcndb12s", true, EnvId.Dev_Development);
                // sydw7jxjz1s - Mario's machine
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, "sydw7jxjz1s", true, EnvId.Dev_Development);
            }
        }
示例#13
0
        public void SetUp()
        {
            _mockAuthenticationManager = Substitute.For <IAuthenticationManager>();
            _mockCoreClient            = Substitute.For <ICoreClient>();

            SetupValidUser();

            _accountController = new AccountController(_mockAuthenticationManager, _mockCoreClient);

            var context        = Substitute.For <HttpContextBase>();
            var requestContext = new RequestContext(context, new RouteData());

            _accountController.ControllerContext = new ControllerContext(requestContext, _accountController);
        }
示例#14
0
        /// <inheritdoc />
        public void SendAuthentication(ICoreClient client, WorldConfiguration worldConfiguration)
        {
            using (var packet = new NetPacket())
            {
                packet.Write((uint)CorePacketType.Authenticate);
                packet.Write(worldConfiguration.Id);
                packet.Write(worldConfiguration.Name);
                packet.Write(worldConfiguration.Host);
                packet.Write(worldConfiguration.Port);
                packet.Write((byte)ServerType.World);
                packet.Write(worldConfiguration.ClusterId);

                // TODO: add more information to packet if needed.
                client.Send(packet);
            }
        }
示例#15
0
 public CoreCache(
     ILogger logger,
     ICoreClient client,
     CacheChangeHandler dataChangeHandler,
     SynchronizationContext syncContext)
 {
     _Logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     Client              = client ?? throw new ArgumentNullException(nameof(client));
     SyncContext         = syncContext;
     Cache               = new CoreItemCache(CacheId, Client);
     UserThreadQueue     = new AsyncThreadQueue(_Logger);
     CacheItemPurgeTimer = new Timer(CacheItemPurgeTimeout, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
     if (dataChangeHandler != null)
     {
         OnDataChange += dataChangeHandler;
     }
 }
示例#16
0
        public MarketDataRealtimeClient(
            Reference <ILogger> loggerRef,
            AsyncThreadQueue clientThreadQueue,
            ICoreClient client,
            MDSProviderId dataProvider)
        {
            if (dataProvider == MDSProviderId.Undefined)
            {
                throw new ArgumentNullException(nameof(dataProvider));
            }
            ProviderId        = dataProvider;
            _loggerRef        = loggerRef?.Clone() ?? throw new ArgumentNullException(nameof(loggerRef));
            ClientThreadQueue = clientThreadQueue ?? new AsyncThreadQueue(_loggerRef.Target);
            _mds = new MarketDataRealtimeServer(_loggerRef, clientThreadQueue, client);
            var serverSettings = new NamedValueSet();

            serverSettings.Set(MdpConfigName.ProviderId, (int)dataProvider);
            _mds.ApplySettings(serverSettings);
            _mds.Start();
        }
        public CurveUnitTestEnvironment(string nameSpace)
        {
            NameSpace = nameSpace;
            string env       = EnvHelper.EnvName(EnvId.Utt_UnitTest);
            var    stopwatch = new Stopwatch();

            stopwatch.Start();
            var random = new Random(Environment.TickCount);
            int port   = random.Next(8000, 8099);

            _server = new CoreServer(_logRef, env, NodeType.Router, port, WcfConst.NetTcp);
            _server.Start();
            _client = new CoreClientFactory(_logRef)
                      .SetEnv(env)
                      .SetServers("localhost:" + port.ToString(CultureInfo.InvariantCulture))
                      .SetProtocols(WcfConst.NetTcp)
                      .Create();
            Cache = _client.CreateCache();
            LoadConfigDataHelper.LoadCurveConfigurationData(_logRef.Target, Cache, nameSpace);
            stopwatch.Stop();
            Debug.Print("Initialized test environment, in {0} seconds", stopwatch.Elapsed.TotalSeconds);
        }
示例#18
0
        public RuntimeEnvironment(string nameSpace)
        {
            NameSpace = nameSpace;
            string fullAppName = $"ExcelAPI-{ApplicationHelper.Diagnostics("FileVersion")}";

            try
            {
                //var stopwatch = new Stopwatch();
                LogRef = Reference <ILogger> .Create(new TraceLogger(true));

                //stopwatch.Start();
                CoreClientFactory factory = new CoreClientFactory(LogRef)
                                            .SetEnv("DEV")
                                            .SetApplication(Assembly.GetExecutingAssembly())
                                            .SetProtocols(WcfConst.AllProtocolsStr);
                _client = factory.SetServers("localhost").Create();
                Cache   = _client.CreateCache();
                Log(LogRef.Target, "Starting...", fullAppName, "StartUp");
            }
            catch (System.Exception excp)
            {
                LogRef.Target.Log(excp);
            }
        }
示例#19
0
 public static IQRMarketDataProvider Create(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
 {
     return(new SimulatorPlugin(logger, client, consumer));
 }
示例#20
0
 public MdpNab(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
     : base(logger, client, MDSProviderId.nabCurveDb, consumer)
 {
 }
示例#21
0
        public void TestServerBridge()
        {
            // required environment:
            // - local env (eg. DEV) server
            // - lower env (eg. UTT) server
            // creates the bridge, and check all messages published
            //   in local env are re-published correctly in lower env
            EnvId  localEnvId   = EnvId.Dev_Development;
            string localEnvName = EnvHelper.EnvName(localEnvId);
            EnvId  lowerEnvId   = (localEnvId - 1);
            string lowerEnvName = EnvHelper.EnvName(lowerEnvId);
            int    localPort    = 9214;
            int    lowerPort    = 9114;

            using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                CoreClientFactory clientfactory = new CoreClientFactory(loggerRef);
                using (CoreServer localServer =
                           new CoreServer(loggerRef, localEnvName, NodeType.Router, localPort))
                    using (CoreServer lowerServer =
                               new CoreServer(loggerRef, lowerEnvName, NodeType.Router, lowerPort))
                    {
                        // start servers
                        localServer.Start();
                        lowerServer.Start();
                        // create clients
                        using (Reference <ICoreClient> localClientRef = Reference <ICoreClient> .Create(clientfactory.SetEnv(localEnvName).SetServers("localhost:" + localPort).Create()))
                            using (ICoreClient lowerClient = clientfactory.SetEnv(lowerEnvName).SetServers("localhost:" + lowerPort).Create())
                            {
                                using (ServerBridge bridge = new ServerBridge())
                                {
                                    bridge.LoggerRef    = loggerRef;
                                    bridge.Client       = localClientRef;
                                    bridge.TargetClient = lowerClient;
                                    // test begins here
                                    // - start the bridge
                                    bridge.Start();
                                    const int sendCount      = 500;
                                    const int maxWaitSeconds = 5;
                                    long      excpCount      = 0;
                                    long      recdCount      = 0;
                                    // subscribe to objects on downstream server
                                    ISubscription subs = lowerClient.Subscribe <TestData>(Expr.ALL,
                                                                                          delegate(ISubscription subscription, ICoreItem item)
                                    {
                                        // receiver
                                        long count = Interlocked.Increment(ref recdCount);
                                        try
                                        {
                                            TestData data = (TestData)item.Data;
                                            //loggerRef.Target.LogDebug("Recd[{0}]", data.field2);
                                            Assert.AreEqual <long>(count, data.field2);
                                        }
                                        catch (Exception)
                                        {
                                            Interlocked.Increment(ref excpCount);
                                        }
                                    }, null);

                                    long sentCount = 0;
                                    // publish n Server events
                                    for (int i = 1; i <= sendCount; i++)
                                    {
                                        Interlocked.Increment(ref sentCount);
                                        localClientRef.Target.SaveObject <TestData>(new TestData("Test", i), "Test", null, TimeSpan.MaxValue);
                                    }
                                    // wait for a short period
                                    DateTimeOffset waitStart  = DateTimeOffset.Now;
                                    DateTimeOffset waitExpiry = waitStart.AddSeconds(maxWaitSeconds);
                                    while ((Interlocked.Add(ref recdCount, 0) < Interlocked.Add(ref sentCount, 0)) &&
                                           (DateTimeOffset.Now < waitExpiry) &&
                                           (Interlocked.Add(ref excpCount, 0) == 0))
                                    {
                                        Thread.Sleep(TimeSpan.FromSeconds(1.0));
                                        loggerRef.Target.LogDebug("Recd/Sent: {0}/{1} items...", Interlocked.Add(ref recdCount, 0), Interlocked.Add(ref sentCount, 0));
                                    }
                                    loggerRef.Target.LogDebug("Duration: {0}", (DateTimeOffset.Now - waitStart));
                                    Assert.AreEqual <long>(0, excpCount);
                                    Assert.AreEqual <long>(sendCount, recdCount);
                                    // done
                                    Assert.IsTrue(true);
                                }
                            }
                    }
            }
        }
示例#22
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);
            }
        }
示例#23
0
 public NetworkLogger(ICoreClient client, string prefix)
     : base(prefix, null)
 {
     _client = client ?? throw new ArgumentNullException(nameof(client));
     Format  = "{prefix}{indent}{text}{suffix}";
 }
示例#24
0
        //private readonly IDictionary<Guid, BloombergRequestMap> _SubsMapExternal;

        public MdpBloomberg(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
            : base(logger, client, MDSProviderId.Bloomberg, consumer)
        {
        }
示例#25
0
        public void ConvertQuotedAssetSetsToDiscountCurveDefinition()
        {
            using (var logger = Reference <ILogger> .Create(new TraceLogger(true)))
            {
                using (ICoreClient client = (new CoreClientFactory(logger)).SetEnv(BuildConst.BuildEnv).Create())
                {
                    const string instrument = "LIBOR";
                    const string seniority  = "SENIOR";
                    foreach (string ccy in "AUD;USD;EUR;NZD;GBP".Split(';'))
                    {
                        foreach (string marketName in CurveConst.QR_LIVE.Split(';'))
                        {
                            //foreach (string tenor in "3M".Split(';'))
                            {
                                //string indexName = String.Format("{0}-{1}", ccy, index);
                                string curveName   = $"{ccy}-{instrument}-{seniority}";
                                string qasItemName = $"Orion.V5r3.MarketData.{marketName}.DiscountCurve.{curveName}";
                                // outputs
                                string curveItemName =
                                    $"Orion.V5r3.Configuration.PricingStructures.{marketName}.DiscountCurve.{curveName}";
                                var marketData = client.LoadObject <QuotedAssetSet>(qasItemName);
                                if (marketData != null)
                                {
                                    // strip out market quote values
                                    foreach (var tradeItem in marketData.assetQuote)
                                    {
                                        foreach (var quote in tradeItem.quote)
                                        {
                                            if (quote.measureType.Value == "MarketQuote")
                                            {
                                                quote.valueSpecified = false;
                                                quote.value          = 0.0m;
                                            }
                                        }
                                    }
                                    var curveDef = new Market
                                    {
                                        id    = curveName,
                                        Items = new PricingStructure[] { new YieldCurve {
                                                                             id = curveName
                                                                         } },
                                        Items1 = new PricingStructureValuation[] {
                                            new YieldCurveValuation {
                                                id = curveName, inputs = marketData
                                            }
                                        }
                                    };

                                    var curveProps = new NamedValueSet();
                                    curveProps.Set(CurveProp.Market, marketName);
                                    curveProps.Set(CurveProp.PricingStructureType, "DiscountCurve");
                                    //curveProps.Set(CurveProp.IndexName, indexName);
                                    //curveProps.Set(CurveProp.IndexTenor, tenor);
                                    curveProps.Set("CreditInstrumentId", instrument);
                                    curveProps.Set("CreditSeniority", seniority);
                                    curveProps.Set(CurveProp.CurveName, curveName);
                                    curveProps.Set("Algorithm", "FastLinearZero");
                                    curveProps.Set(CurveProp.Currency1, ccy);
                                    curveProps.Set(CurveProp.DataGroup, "Orion.V5r3.Configuration.PricingStructureType");
                                    curveProps.Set("SourceSystem", "Orion");
                                    curveProps.Set("Function", "Configuration");
                                    curveProps.Set("Type", CurveProp.PricingStructureType);
                                    curveProps.Set(CurveProp.UniqueIdentifier, curveItemName);
                                    client.SaveObject(curveDef, curveItemName, curveProps, TimeSpan.MaxValue);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#26
0
 public CoreItemCache(Guid cacheId, ICoreClient client)
 {
     _cacheId = cacheId;
     _client  = client;
 }
示例#27
0
 public MdpGlobalIB(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
     : base(logger, client, MDSProviderId.GlobalIB, consumer)
 {
 }
示例#28
0
 public UnitTestEnvironment(ILogger logger)
 {
     _client = new PrivateCore(logger);
     _cache  = _client.CreateCache();
 }
示例#29
0
 public TradeRevalServer(ILogger logger, ICoreClient client)
     : base(logger, client)
 {
 }
示例#30
0
 public SimulatorPlugin(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
     : base(logger, client, MDSProviderId.Simulator, consumer)
 {
 }
示例#31
0
文件: Form1.cs 项目: abezzubets/Stuff
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            try
            {
                StatusBar.Text = "Trying to connect to the Core...";
                AgentList.Items.Clear();
                if (String.IsNullOrEmpty(UserNameBox.Text) || String.IsNullOrEmpty(PasswordBox.Text))
                {
                    _coreClient = GetDefaultCoreClient(ServerBox.Text, 8006);
                }
                else
                {
                    _coreClient = GetFullCoreClient(ServerBox.Text, 8006, UserNameBox.Text, PasswordBox.Text);
                }
                StatusBar.Text = "Getting protected agents";
                var protectedAgents = _coreClient.AgentsManagement.GetProtectedAgents();
                StatusBar.Text = "Updating agents list";
                foreach (var Agent in protectedAgents)
                {
                    var agentInfo = _coreClient.AgentsManagement.GetAgentInfo(Agent.Id.ToString());
                   //var agentDetails = _coreClient.AgentsManagement.GetAgentDetails(Agent.Id.ToString());
                   // var agentDetails = _coreClient.AgentsManagement.GetAgentDetails(Agent.Id.ToString());
                    var hostName = agentInfo.Descriptor.HostUri.Host;
                    AgentList.Items.Add(hostName);
                }
                StatusBar.Text = "Connected to " + ServerBox.Text;
                RestartButton.Enabled = Enabled;
                UpdateButton.Enabled = Enabled;

            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong:\n\n"+ ex);
            }
        }
示例#32
0
 public static IQRMarketDataProvider Create(ILogger logger, ICoreClient client, ConsumerDelegate consumer)
 {
     return(new MdpBloomberg(logger, client, consumer));
 }
示例#33
0
 public AccountController(IAuthenticationManager authenticationManager, ICoreClient coreClient)
 {
     _authenticationManager = authenticationManager;
     _coreClient = coreClient;
 }