Exemplo n.º 1
0
    // the quote system constructor
    public QuoteSystem(Logger l, ConsorsGate cg)
    {
        //setting the local variables
        _log = l;
        _cg = cg;

        _log.info("QuoteSystem::QuoteSystem", "constructing quote system");

        //initialize the consors system.
        // Create the session facade
        try{

            sf = new SessionFacade();

            // Login
            sf.LoginWithAddOnName("Ulrich Staudinger");

            _log.info("QuoteSystem::QuoteSystem", "logged in.");

            //registering for now, the plain dax values.

            // Create the parameters that you need for the quote subscription, here the QuoteKey
            QuoteKey qk = sf.CreateQuoteKey();

            // Set all necessary parameters
            qk.SecurityCode = "846900";
            qk.StockexchangeId = "ETR";

            // Acquire the subscription with this QuoteKey
            QuoteSubscription qs = sf.GetQuoteSubscription(qk);

            // Register your event handler on the subscription
            CallbackQuote cbQuote = new CallbackQuote(quoteHandler);
            qs.OnQuoteUpdate += cbQuote;

            _log.info("QuoteSystem::QuoteSystem", "subscribed to dax.");

        }
        catch (Exception ex)
        {
            _log.fatal("QuoteSystem::QuoteSystem", "Exception while starting QuoteSystem:");
            _log.fatal("QuoteSystem::QuoteSystem", ex.Message);
        }

        Thread constantRunner = new Thread(new ThreadStart(Run));
        constantRunner.Start();
    }