Exemplo n.º 1
0
 public void TestMDSBloomberg()
 {
     // test basic start, request snapshot, and stop functions
     // - create a MDS client with direct connection to provider
     using (Reference <ILogger> loggerRef = Reference <ILogger> .Create(new TraceLogger(true)))
     {
         IModuleInfo clientInfo = new V131ModuleInfo(new V131ClientInfo());
         using (ICoreClient client = new CoreClientFactory(loggerRef).SetEnv(BuildConst.BuildEnv).Create())
         {
             const string curveName  = "Orion.V5r3.Configuration.PricingStructures.QR_LIVE.RateCurve.AUD-BBR-BBSW-3M";
             ICoreItem    marketItem = client.LoadItem <Market>(curveName);
             if (marketItem == null)
             {
                 throw new ApplicationException("Market '" + curveName + "' not found!");
             }
             var market = (Market)marketItem.Data;
             //PricingStructure ps = market.Items[0];
             PricingStructureValuation psv            = market.Items1[0];
             QuotedAssetSet            quotedAssetSet = ((YieldCurveValuation)psv).inputs;
             using (IMarketDataClient mdc = new MarketDataRealtimeClient(
                        loggerRef, null, client,
                        MDSProviderId.Bloomberg))//MDSProviderId.GlobalIB
             {
                 QuotedAssetSet data = mdc.GetMarketQuotes(
                     MDSProviderId.Bloomberg, clientInfo, Guid.NewGuid(), true,
                     null,
                     quotedAssetSet).Result;
                 Assert.IsNotNull(data);
             }
         }
     }
 }
Exemplo n.º 2
0
        public V131SessionReply BeginSessionV131(V131SessionHeader header, V131ClientInfo clientInfo)
        {
            // validate new client
            // - ensure configured client/server environments are the same
            if (CoreHelper.ToEnvId(clientInfo.ConfigEnv) != _serverCfg.ModuleInfo.ConfigEnv)
            {
                // not valid
                string msg =
                    $"Client environment ({clientInfo.ConfigEnv}) <> server environment ({_serverCfg.ModuleInfo.ConfigEnv})!";
                Logger.LogWarning(msg);
                return(new V131SessionReply(msg));
            }
            // - ensure build environment is backward compatible
            if (CoreHelper.ToEnvId(clientInfo.BuildEnv) < _serverCfg.ModuleInfo.BuildEnv)
            {
                // not valid
                string msg =
                    $"Client build environment ({clientInfo.BuildEnv}) < server build environment ({_serverCfg.ModuleInfo.BuildEnv})!";
                Logger.LogWarning(msg);
                return(new V131SessionReply(msg));
            }
            // - ensure STG/PRD environment servers only accessed by valid clients
            if ((_serverCfg.ModuleInfo.ConfigEnv >= EnvId.Stg_StagingLive) && (clientInfo.CompInfo.AssmPTok != _serverCfg.ModuleInfo.CorePTok))
            {
                Logger.LogDebug("Client signature ({0}) <> server signature ({1})!",
                                clientInfo.CompInfo.AssmPTok, _serverCfg.ModuleInfo.CorePTok);
            }
            // check client version
            const string requiredVersion = "2.2.1815.1";

            if (!V131Helpers.CheckRequiredFileVersion(Logger, requiredVersion, clientInfo.CompInfo.AssmFVer))
            {
                // not valid
                string msg = $"Client version ({clientInfo.CompInfo.AssmFVer}) < required version ({requiredVersion})!";
                Logger.LogWarning(msg);
                return(new V131SessionReply(msg));
            }
            // valid client
            Guid sessionId = Guid.NewGuid();

            _connectionIndex.Locked(connections =>
            {
                // - update the connection
                connections[sessionId] = new V131ModuleInfo(clientInfo);
                if (header.DebugRequest)
                {
                    Logger.LogDebug("Connection (auto)");
                    Logger.LogDebug("  Identity   : {0} ({1})", clientInfo.UserInfo.UserIdentityName, clientInfo.UserInfo.UserFullName);
                    Logger.LogDebug("  Application: {0} V{1}/{2} ({3}/{4})", clientInfo.ApplInfo.AssmName, clientInfo.ApplInfo.AssmNVer, clientInfo.ApplInfo.AssmFVer, clientInfo.ApplInfo.AssmPTok, clientInfo.ApplInfo.AssmHash);
                    Logger.LogDebug("  Component  : {0} V{1}/{2} ({3}/{4})", clientInfo.CompInfo.AssmName, clientInfo.CompInfo.AssmNVer, clientInfo.CompInfo.AssmFVer, clientInfo.CompInfo.AssmPTok, clientInfo.CompInfo.AssmHash);
                    Logger.LogDebug("  Client Env.: {0} ({1} build)", clientInfo.ConfigEnv, clientInfo.BuildEnv);
                    Logger.LogDebug("  Other Addrs: {0} ({1},{2})", clientInfo.HostName, clientInfo.HostIpV4, String.Join(",", clientInfo.NetAddrs.ToArray()));
                    Logger.LogDebug("  Session Id.: {0}/{1}", sessionId, clientInfo.NodeGuid);
                }
            });
            return(new V131SessionReply(sessionId, null));
        }