Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string USAGE = "SampleMD adm_cnnct_pt " +
                           "user password md_cnnct_pt ts_cnnct_pt " +
                           "exchange symbol flags";

            if (args.Length < 8)
            {
                System.Console.Out.WriteLine(USAGE);
                return;
            }

            /*   -----------------------------------------------------------   */

            string sAdmCnnctPt = args[0];
            string sUser       = args[1];
            string sPassword   = args[2];
            string sMdCnnctPt  = args[3];
            string sTsCnnctPt  = args[4];
            string sExchange   = args[5];
            string sSymbol     = args[6];
            string sFlags      = args[7];

            /*   -----------------------------------------------------------   */

            MyAdmCallbacks oAdmCallbacks = new MyAdmCallbacks();
            MyCallbacks    oCallbacks    = new MyCallbacks();
            REngineParams  oParams       = new REngineParams();
            REngine        oEngine;

            /*   ----------------------------------------------------------   */
            /*   You may need to change some values, such as the CertFile     */
            /*   ----------------------------------------------------------   */

            oParams.AdmCnnctPt   = sAdmCnnctPt;
            oParams.AppName      = "SampleMD.NET";
            oParams.AppVersion   = "1.0.0.0";
            oParams.AdmCallbacks = oAdmCallbacks;
            oParams.CertFile     = "c:\\data\\rithmiccerts\\RithmicCertificate.pk12";
            oParams.DmnSrvrAddr  = "rituz01000.01.rithmic.com:65000";
            oParams.DomainName   = "rithmic_uat_01_dmz_domain";
            oParams.LicSrvrAddr  = "rituz01000.01.rithmic.com:56000";
            oParams.LocBrokAddr  = "rituz01000.01.rithmic.com:64100";
            oParams.LoggerAddr   = "rituz01000.01.rithmic.com:45454";

            /*   -----------------------------------------------------------   */

            try
            {
                /*   ------------------------------------------------------   */
                /*   Instantiate the REngine.                                 */
                /*   ------------------------------------------------------   */

                oEngine = new REngine(oParams);

                /*   ------------------------------------------------------   */
                /*   Initiate the login.                                      */
                /*   ------------------------------------------------------   */

                oEngine.login(oCallbacks,
                              sUser,
                              sPassword,
                              sMdCnnctPt,
                              sTsCnnctPt,
                              string.Empty,
                              string.Empty);

                /*   ------------------------------------------------------   */
                /*   After calling REngine::login, RCallbacks::Alert will be  */
                /*   called a number of times.  Wait for when the login to    */
                /*   the MdCnnctPt and TsCnnctPt is complete.  (See           */
                /*   MyCallbacks::Alert() for details).                       */
                /*   ------------------------------------------------------   */

                while (!oCallbacks.LoggedIntoMd)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                /*   ------------------------------------------------------   */
                /*   Subscribe to the instrument of interest.  To express     */
                /*   interest in different types of updates, see              */
                /*   SubscriptionFlags.                                       */
                /*   ------------------------------------------------------   */

                oEngine.subscribe(sExchange,
                                  sSymbol,
                                  (SubscriptionFlags)Convert.ToInt32(sFlags),
                                  null);

                /*   ------------------------------------------------------   */
                /*   At this point the callback routines will start firing    */
                /*   on a different thread.  This main thread will wait       */
                /*   until a key is pressed before continuing.                */
                /*   ------------------------------------------------------   */

                Console.Read();

                /*   ------------------------------------------------------   */
                /*   We are done, so log out...                               */
                /*   ------------------------------------------------------   */

                oEngine.logout();

                /*   ------------------------------------------------------   */
                /*   and shutdown the REngine instance.                       */
                /*   ------------------------------------------------------   */

                oEngine.shutdown();
            }
            catch (OMException oEx)
            {
                System.Console.Out.WriteLine("error : {0}", oEx.Message);
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("exception : {0}", e.Message);
            }

            /*   -----------------------------------------------------------   */

            return;
        }
Ejemplo n.º 2
0
     static void Main(string[] args)
          {
          string USAGE = "SampleMD adm_cnnct_pt " +
                         "user password md_cnnct_pt ts_cnnct_pt " +
                         "exchange symbol flags";

          if (args.Length < 8)
               {
               System.Console.Out.WriteLine(USAGE);
               return;
               }

          /*   -----------------------------------------------------------   */

          string sAdmCnnctPt = args[0];
          string sUser       = args[1];
          string sPassword   = args[2];
          string sMdCnnctPt  = args[3];
          string sTsCnnctPt  = args[4];
          string sExchange   = args[5];
          string sSymbol     = args[6];
          string sFlags      = args[7];

          /*   -----------------------------------------------------------   */

          MyAdmCallbacks oAdmCallbacks = new MyAdmCallbacks();
          MyCallbacks    oCallbacks    = new MyCallbacks();
          REngineParams  oParams       = new REngineParams();
          REngine        oEngine;

          /*   ----------------------------------------------------------   */
          /*   You may need to change some values, such as the CertFile     */
          /*   ----------------------------------------------------------   */

          oParams.AdmCnnctPt = sAdmCnnctPt;
          oParams.AppName      = "SampleMD.NET";
          oParams.AppVersion   = "1.0.0.0";
          oParams.AdmCallbacks = oAdmCallbacks;
          oParams.CertFile     = "c:\\data\\rithmiccerts\\RithmicCertificate.pk12";
          oParams.DmnSrvrAddr  = "rituz01000.01.rithmic.com:65000";
          oParams.DomainName   = "rithmic_uat_01_dmz_domain";
          oParams.LicSrvrAddr  = "rituz01000.01.rithmic.com:56000";
          oParams.LocBrokAddr  = "rituz01000.01.rithmic.com:64100";
          oParams.LoggerAddr   = "rituz01000.01.rithmic.com:45454";

          /*   -----------------------------------------------------------   */

          try
               {
               /*   ------------------------------------------------------   */
               /*   Instantiate the REngine.                                 */
               /*   ------------------------------------------------------   */

               oEngine = new REngine(oParams);

               /*   ------------------------------------------------------   */
               /*   Initiate the login.                                      */
               /*   ------------------------------------------------------   */

               oEngine.login(oCallbacks, 
                    sUser, 
                    sPassword, 
                    sMdCnnctPt, 
                    sTsCnnctPt, 
                    string.Empty,
                    string.Empty);

               /*   ------------------------------------------------------   */
               /*   After calling REngine::login, RCallbacks::Alert will be  */
               /*   called a number of times.  Wait for when the login to    */
               /*   the MdCnnctPt and TsCnnctPt is complete.  (See           */
               /*   MyCallbacks::Alert() for details).                       */
               /*   ------------------------------------------------------   */

               while (!oCallbacks.LoggedIntoMd)
                    {
                    System.Threading.Thread.Sleep(1000);
                    }

               /*   ------------------------------------------------------   */
               /*   Subscribe to the instrument of interest.  To express     */
               /*   interest in different types of updates, see              */
               /*   SubscriptionFlags.                                       */
               /*   ------------------------------------------------------   */

               oEngine.subscribe(sExchange, 
                    sSymbol, 
                    (SubscriptionFlags)Convert.ToInt32(sFlags), 
                    null);

               /*   ------------------------------------------------------   */
               /*   At this point the callback routines will start firing    */
               /*   on a different thread.  This main thread will wait       */
               /*   until a key is pressed before continuing.                */
               /*   ------------------------------------------------------   */

               Console.Read();

               /*   ------------------------------------------------------   */
               /*   We are done, so log out...                               */
               /*   ------------------------------------------------------   */

               oEngine.logout();

               /*   ------------------------------------------------------   */
               /*   and shutdown the REngine instance.                       */
               /*   ------------------------------------------------------   */

               oEngine.shutdown();
               }
          catch (OMException oEx)
               {
               System.Console.Out.WriteLine("error : {0}", oEx.Message);
               }
          catch (Exception e)
               {
               System.Console.Out.WriteLine("exception : {0}", e.Message);
               }

          /*   -----------------------------------------------------------   */

          return;
          }