public static Thread ChangeEventThread(this Framework framework, ParameterizedThreadStart threadRun)
        {
            if (ThreadExitField != null)
            {
                ThreadExitField.Setter(framework.EventManager, true);
                var queue = new EventQueue(size: 10);
                queue.IsSynched = true;
                queue.Enqueue(new OnQueueOpened(queue));
                queue.Enqueue(new OnQueueClosed(queue));
                framework.EventBus.ServicePipe.Add(queue);

                var thread = (Thread)EventManagerThreadField.GetValue(framework.EventManager);
                while (thread.IsAlive)
                {
                    Thread.Sleep(10);
                }
                thread.Join();
                ThreadExitField.Setter(framework.EventManager, false);
                var ret = StartEventThread();
                EventManagerThreadField.SetValue(framework.EventManager, ret);
                return(ret);
            }

            return(null);

            Thread StartEventThread()
            {
                var thread = new Thread(threadRun);

                thread.Name         = "Event Manager Thread";
                thread.IsBackground = true;
                thread.Start(framework);
                return(thread);
            }
        }
        public static Portfolio ToPortfolio(BsonValue value)
        {
            var doc = (BsonDocument)value;
            var p   = new Portfolio(doc["name"].AsString);

            p.Description = doc["description"].AsString;
            id.Setter(p, doc["_id"].AsInt32 - 1);
            parentId.Setter(p, doc["parentId"].AsInt32);
            isLoaded.Setter(p, true);
            return(p);
        }
        public ExecutionReport ToReport(BsonValue v)
        {
            var doc = (BsonDocument)v;
            var cmd = new ExecutionReport();

            account.Setter(cmd, doc["account"].AsString);
            algoId.Setter(cmd, doc["algoId"].AsInt32);
            avgPx.Setter(cmd, doc["avgPx"].AsDouble);
            clId.Setter(cmd, doc["clId"].AsInt32);
            clientId.Setter(cmd, doc["clientId"].AsInt32);
            clientID.Setter(cmd, doc["clientID"].AsString);
            clOrderId.Setter(cmd, doc["clOrderId"].AsString);
            commission.Setter(cmd, doc["commission"].AsDouble);
            cumQty.Setter(cmd, doc["cumQty"].AsDouble);
            currencyId.Setter(cmd, (byte)doc["currencyId"].AsInt32);
            dateTime.Setter(cmd, doc["dateTime"].AsDateTime);
            execId.Setter(cmd, doc["execId"].AsString);
            execInst.Setter(cmd, doc["execInst"].AsString);
            execType.Setter(cmd, (ExecType)doc["execType"].AsInt32);
            expireTime.Setter(cmd, doc["expireTime"].AsDateTime);
            id.Setter(cmd, doc["id"].AsInt32);
            instrumentId.Setter(cmd, doc["instrumentId"].AsInt32);
            isLoaded.Setter(cmd, doc["isLoaded"].AsBoolean);
            lastPx.Setter(cmd, doc["lastPx"].AsDouble);
            lastQty.Setter(cmd, doc["lastQty"].AsDouble);
            leavesQty.Setter(cmd, doc["leavesQty"].AsDouble);
            minQty.Setter(cmd, doc["minQty"].AsDouble);
            oCA.Setter(cmd, doc["oCA"].AsString);
            orderId.Setter(cmd, doc["orderId"].AsInt32);
            ordQty.Setter(cmd, doc["ordQty"].AsDouble);
            ordStatus.Setter(cmd, (OrderStatus)doc["ordStatus"].AsInt32);
            ordType.Setter(cmd, (OrderType)doc["ordType"].AsInt32);
            pegDifference.Setter(cmd, doc["pegDifference"].AsDouble);
            portfolioId.Setter(cmd, doc["portfolioId"].AsInt32);
            price.Setter(cmd, doc["price"].AsDouble);
            providerId.Setter(cmd, (byte)doc["providerId"].AsInt32);
            providerOrderId.Setter(cmd, doc["providerOrderId"].AsString);
            routeId.Setter(cmd, (byte)doc["routeId"].AsInt32);
            side.Setter(cmd, (OrderSide)doc["side"].AsInt32);
            stopPx.Setter(cmd, doc["stopPx"].AsDouble);
            strategyId.Setter(cmd, doc["strategyId"].AsInt32);
            subSide.Setter(cmd, (SubSide)doc["subSide"].AsInt32);
            text.Setter(cmd, doc["text"].AsString);
            timeInForce.Setter(cmd, (TimeInForce)doc["timeInForce"].AsInt32);
            transactTime.Setter(cmd, doc["transactTime"].AsDateTime);
            typeId.Setter(cmd, (byte)doc["typeId"].AsInt32);
            return(cmd);
        }
        public ExecutionCommand ToCommand(BsonValue v)
        {
            var doc = (BsonDocument)v;
            var cmd = new ExecutionCommand();

            account.Setter(cmd, doc["account"].AsString);
            algoId.Setter(cmd, doc["algoId"].AsInt32);
            clId.Setter(cmd, doc["clId"].AsInt32);
            clientId.Setter(cmd, doc["clientId"].AsInt32);
            clientID.Setter(cmd, doc["clientID"].AsString);
            clOrderId.Setter(cmd, doc["clOrderId"].AsString);
            currencyId.Setter(cmd, (byte)doc["currencyId"].AsInt32);
            dateTime.Setter(cmd, doc["dateTime"].AsDateTime);
            execInst.Setter(cmd, doc["execInst"].AsString);
            executionCommandType.Setter(cmd, (ExecutionCommandType)doc["executionCommandType"].AsInt32);
            expireTime.Setter(cmd, doc["expireTime"].AsDateTime);
            id.Setter(cmd, doc["id"].AsInt32);
            instrumentId.Setter(cmd, doc["instrumentId"].AsInt32);
            isLoaded.Setter(cmd, doc["isLoaded"].AsBoolean);
            minQty.Setter(cmd, doc["minQty"].AsDouble);
            oCA.Setter(cmd, doc["oCA"].AsString);
            orderId.Setter(cmd, doc["orderId"].AsInt32);
            ordType.Setter(cmd, (OrderType)doc["ordType"].AsInt32);
            pegDifference.Setter(cmd, doc["pegDifference"].AsDouble);
            portfolioId.Setter(cmd, doc["portfolioId"].AsInt32);
            price.Setter(cmd, doc["price"].AsDouble);
            providerId.Setter(cmd, (byte)doc["providerId"].AsInt32);
            providerOrderId.Setter(cmd, doc["providerOrderId"].AsString);
            qty.Setter(cmd, doc["qty"].AsDouble);
            routeId.Setter(cmd, (byte)doc["routeId"].AsInt32);
            side.Setter(cmd, (OrderSide)doc["side"].AsInt32);
            stopPx.Setter(cmd, doc["stopPx"].AsDouble);
            strategyId.Setter(cmd, doc["strategyId"].AsInt32);
            subSide.Setter(cmd, (SubSide)doc["subSide"].AsInt32);
            symbol.Setter(cmd, doc["symbol"].AsString);
            text.Setter(cmd, doc["text"].AsString);
            timeInForce.Setter(cmd, (TimeInForce)doc["timeInForce"].AsInt32);
            transactTime.Setter(cmd, doc["transactTime"].AsDateTime);
            typeId.Setter(cmd, (byte)doc["typeId"].AsInt32);
            ReadTable(doc, cmd);
            return(cmd);
        }
Пример #5
0
 public static void SetOrderStatus(this Order order, SmartQuant.OrderStatus status)
 {
     StatusField.Setter(order, status);
 }
Пример #6
0
 public static void SetOrderType(this Order order, SmartQuant.OrderType type)
 {
     TypeField.Setter(order, type);
 }
Пример #7
0
 public static void SetSubSide(this Order order, SubSide side)
 {
     SubSideField.Setter(order, side);
 }
Пример #8
0
 public static void SetCreationTime(this Stop s, DateTime dateTime)
 {
     CreationTimeField?.Setter(s, dateTime);
 }
Пример #9
0
 public static void SetStrategy(this Stop s, Strategy strategy)
 {
     StrategyField?.Setter(s, strategy);
 }
Пример #10
0
 public static void SetQty(this Stop s, double qty)
 {
     QtyField?.Setter(s, qty);
 }
 public static void SetClock(this Reminder reminder, Clock clock)
 {
     ReminderClockFiled.Setter(reminder, clock);
 }
 public static void SetMode(this Clock clock, ClockMode mode)
 {
     ClockModeFiled.Setter(clock, mode);
 }
 public static void SetFramework(this Strategy s, Framework f)
 {
     StrategyFrameworkField?.Setter(s, f);
 }