Beispiel #1
0
        /// <inheritdoc/>
        public IQuik Create(QuikClientOptions options)
        {
            var pendingResultContainer = new PendingResultContainer();
            var eventTypeProvider      = new EventTypeProvider();
            var serializer             = new QuikJsonSerializer(pendingResultContainer, eventTypeProvider);
            var typeConverter          = new CachingQuikTypeConverter();
            var idProvider             = new UniqueIdProvider();
            var dateTimeProvider       = new CurrentDateTimeProvider();
            var messageFactory         = new MessageFactory(idProvider, dateTimeProvider);

            var quikEvents   = new QuikEvents();
            var eventHandler = new EventInvoker(quikEvents);
            var quikClient   = new QuikClient(eventHandler, serializer, pendingResultContainer, options,
                                              _loggerFactory.CreateLogger <QuikClient>());

            var quik = new Quik(
                quikClient,
                new Functions.QuikFunctions(
                    new ServiceFunctions(messageFactory, quikClient, typeConverter),
                    new TableRowFunctions(messageFactory, quikClient, typeConverter),
                    new ClassFunctions(messageFactory, quikClient, typeConverter),
                    new WorkstationFunctions(messageFactory, quikClient, typeConverter),
                    new CandleFunctions(messageFactory, quikClient, typeConverter),
                    new LabelFunctions(messageFactory, quikClient, typeConverter),
                    new OrderBookFunctions(messageFactory, quikClient, typeConverter),
                    new QuotesTableParametersFunctions(messageFactory, quikClient, typeConverter),
                    new DebugFunctions(messageFactory, quikClient, typeConverter),
                    new CustomFunctions(messageFactory, quikClient, typeConverter)),
                quikEvents);

            quikClient.SetEventSender(quik);
            quikEvents.SetEventSender(quik);

            return(quik);
        }
        public void SetUp()
        {
            var pendingResultContainer = new PendingResultContainer();
            var eventTypeProvider      = new EventTypeProvider();

            _serializer = new QuikJsonSerializer(pendingResultContainer, eventTypeProvider);
        }
        public void QuikJsonSerializer_Serialize_Deserialize()
        {
            var results = new List <string>(_roundCount * (_endIndex - _startIndex + 1));

            var pendingResultContainer = new PendingResultContainer();
            var eventTypeProvider      = new EventTypeProvider();
            var serializer             = new QuikSharp.Serialization.Json.QuikJsonSerializer(pendingResultContainer, eventTypeProvider);

            var t = new Transaction();

            t.PRICE = 123.456m;

            for (var r = 0; r < _roundCount; r++)
            {
                for (var i = _startIndex; i <= _endIndex; i++)
                {
                    var j  = serializer.Serialize(t);
                    var t2 = serializer.Deserialize <Transaction>(j);

                    //if (t.PRICE != t2.PRICE)
                    //{
                    //    throw new Exception("Deserialization problem with PRICE property!");
                    //}

                    results.Add(j);
                }
            }
        }
Beispiel #4
0
        protected void SetUpQuik()
        {
            QuikFactory = new QuikFactory();

            var quikClientOptions = QuikClientOptions.GetDefault();

            Quik = QuikFactory.Create(quikClientOptions);

            Quik.Client.Start();

            var pendingResultContainer = new PendingResultContainer();
            var eventTypeProvider      = new EventTypeProvider();

            Serializer = new QuikJsonSerializer(pendingResultContainer, eventTypeProvider);

            var transactionManagerFactory = new TransactionManagerFactory();

            TransactionManager = transactionManagerFactory.Create(Quik, TransactionManagerOptions.GetDefault());
        }