Inheritance: DataObject
コード例 #1
0
 public Fill(DateTime dateTime, Order order, Instrument instrument, byte currencyId, OrderSide side, double qty, double price, string text = "")
 {
     DateTime = dateTime;
     Order = order;
     Instrument = instrument;
     OrderId = order.Id;
     InstrumentId = instrument.Id;
     CurrencyId = currencyId;
     Side = side;
     Qty = qty;
     Price = price;
     Text = text;
 }
コード例 #2
0
 public ExecutionMessage(ExecutionMessage executionMessage) : base(executionMessage)
 {
     Id = executionMessage.Id;
     this.order = executionMessage.Order;
     OrderId = executionMessage.OrderId;
     ClOrderId = executionMessage.ClOrderId;
     ProviderOrderId = executionMessage.ProviderOrderId;
     this.instrument = executionMessage.Instrument;
     InstrumentId = executionMessage.InstrumentId;
     ClientId = executionMessage.ClientId;
     IsLoaded = executionMessage.IsLoaded;
     CurrencyId = executionMessage.CurrencyId;
     Fields = new ObjectTable(executionMessage.Fields);
 }
コード例 #3
0
        public void Register(Order order)
        {
            if (order.Id != -1)
            {
                Console.WriteLine($"OrderManager::Register Error Order is already registered : id = {order.Id}");
                return;
            }

            lock (this.obj)
                order.Id = this.counter++;

            if (this.framework.Mode == FrameworkMode.Realtime && string.IsNullOrEmpty(order.ClOrderId))
                order.ClOrderId = $"{this.framework.Clock.DateTime} {order.Id}";
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: fastquant/fastquant.dll
        public override void OnOrder(Order order)
        {
            if (order.Text == "TakeProfit")
                order.OCA = (++OCACount).ToString();

            if (order.Text == "StopLoss")
                order.OCA = OCACount.ToString();

            if (order.Text == "StopLoss")
                stopLossOrder = order;

            if (order.Text == "StopExit" || order.Text == "StopSession")
                framework.OrderManager.Cancel(stopLossOrder);

            base.OnOrder(order);
        }
コード例 #5
0
        public void Cancel(Order order)
        {
            if (order.IsNotSent)
                throw new ArgumentException($"Can not cancel order that is not sent {order}");

            var command = new ExecutionCommand(ExecutionCommandType.Cancel, order)
            {
                DateTime = this.framework.Clock.DateTime,
                OrderId = order.Id,
                ClOrderId = order.ClOrderId,
                ProviderOrderId = order.ProviderOrderId,
                ProviderId = order.ProviderId,
                RouteId = order.RouteId,
                PortfolioId = order.PortfolioId
            };
            command.DateTime = order.DateTime;
            command.Instrument = order.Instrument;
            command.InstrumentId = order.InstrumentId;
            command.Provider = order.Provider;
            command.Portfolio = order.Portfolio;
            command.Side = order.Side;
            command.OrdType = order.Type;
            command.TimeInForce = order.TimeInForce;
            command.Price = order.Price;
            command.StopPx = order.StopPx;
            command.Qty = order.Qty;
            command.OCA = order.OCA;
            command.Text = order.Text;
            command.Account = order.Account;
            command.ClientID = order.ClientID;
            command.ClientId = order.ClientId;
            Messages.Add(command);
            order.OnExecutionCommand(command);
            this.framework.EventServer.OnExecutionCommand(command);
            if (IsPersistent)
                Server?.Save(command, -1);
            order.Provider.Send(command);
        }
コード例 #6
0
 public void Replace(Order order, double price, double stopPx, double qty)
 {
     OrderManager.Replace(order, price, stopPx, qty);
 }
コード例 #7
0
 public void Replace(Order order, double price)
 {
     OrderManager.Replace(order, price);
 }
コード例 #8
0
 public ExecutionCommand(ExecutionCommandType type, Order order)
     : this()
 {
     Type = type;
     Order = order;
     OrderId = order.Id;
     ProviderId = order.ProviderId;
     RouteId = order.RouteId;
     AlgoId = order.AlgoId;
     PortfolioId = order.PortfolioId;
     InstrumentId = order.InstrumentId;
     TransactTime = order.TransactTime;
     DateTime = order.DateTime;
     Instrument = order.Instrument;
     Provider = order.Provider;
     Portfolio = order.Portfolio;
     Side = order.Side;
     OrdType = order.Type;
     TimeInForce = order.TimeInForce;
     ExpireTime = order.ExpireTime;
     Price = order.Price;
     StopPx = order.StopPx;
     Qty = order.Qty;
     MinQty = order.MinQty;
     PegDifference = order.PegDifference;
     ExecInst = order.ExecInst;
     OCA = order.OCA;
     Text = order.Text;
     Account = order.Account;
     ClientID = order.ClientID;
     Fields = new ObjectTable(order.Fields);
 }
コード例 #9
0
 public Order SellOrder(Instrument instrument, double qty, string text = "")
 {
     Order order = new Order(this.method_1(instrument), this.Portfolio, instrument, OrderType.Market, OrderSide.Sell, qty, 0.0, 0.0, TimeInForce.Day, 0, "");
     order.StrategyId = this.Id;
     order.Text = text;
     OrderManager.Register(order);
     return order;
 }
コード例 #10
0
 public Order SellPegged(IExecutionProvider provider, Instrument instrument, double qty, double offset, string text = "")
 {
     Order order = new Order(provider, this.Portfolio, instrument, OrderType.Pegged, OrderSide.Sell, qty, 0.0, 0.0, TimeInForce.Day, 0, "");
     order.StrategyId = this.Id;
     order.StopPx = offset;
     order.Text = text;
     this.Send(order);
     return order;
 }
コード例 #11
0
 protected virtual void OnOrderCancelRejected(Order order)
 {
 }
コード例 #12
0
 protected virtual void OnOrderExpired(Order order)
 {
 }
コード例 #13
0
 protected virtual void OnOrderPartiallyFilled(Order order)
 {
 }
コード例 #14
0
 protected virtual void OnOrderFilled(Order order)
 {
 }
コード例 #15
0
 protected virtual void OnOrderStatusChanged(Order order)
 {
 }
コード例 #16
0
 protected virtual void OnNewOrder(Order order)
 {
 }
コード例 #17
0
 protected virtual void OnPendingNewOrder(Order order)
 {
 }
コード例 #18
0
 public Order Buy(IExecutionProvider provider, Instrument instrument, double qty, string text = "")
 {
     Order order = new Order(provider, this.Portfolio, instrument, OrderType.Market, OrderSide.Buy, qty, 0.0, 0.0, TimeInForce.Day, 0, "");
     order.StrategyId = this.Id;
     order.Text = text;
     this.Send(order);
     return order;
 }
コード例 #19
0
 public Order Sell(IExecutionProvider provider, Instrument instrument, OrderType type, double qty, double price, double stopPx, string text = "")
 {
     Order order = new Order(provider, this.Portfolio, instrument, type, OrderSide.Sell, qty, price, stopPx, TimeInForce.Day, 0, "");
     order.StrategyId = Id;
     order.Text = text;
     this.Send(order);
     return order;
 }
コード例 #20
0
 protected virtual void OnOrderReplaceRejected(Order order)
 {
 }
コード例 #21
0
 public Order SellStopLimit(IExecutionProvider provider, Instrument instrument, double qty, double stopPx, double price, string text = "")
 {
     Order order = new Order(provider, this.Portfolio, instrument, OrderType.StopLimit, OrderSide.Sell, qty, 0.0, 0.0, TimeInForce.Day, 0, "");
     order.StrategyId = this.Id;
     order.Text = text;
     order.StopPx = stopPx;
     order.Price = price;
     this.Send(order);
     return order;
 }
コード例 #22
0
 protected virtual void OnOrderDone(Order order)
 {
 }
コード例 #23
0
 public Order BuyStopLimitOrder(Instrument instrument, double qty, double stopPx, double price, string text = "")
 {
     Order order = new Order(this.method_1(instrument), this.Portfolio, instrument, OrderType.StopLimit, OrderSide.Buy, qty, 0.0, 0.0, TimeInForce.Day, 0, "");
     order.StrategyId = this.Id;
     order.Text = text;
     order.StopPx = stopPx;
     order.Price = price;
     OrderManager.Register(order);
     return order;
 }
コード例 #24
0
ファイル: Program.cs プロジェクト: fastquant/fastquant.dll
        public OrderProcessor(SpreadSellSide strategy, ExecutionCommand command)
        {
            // Add current processor to SellSide processor's list. 
            strategy.processors.AddLast(this);

            // Init OrderProcessor fields.
            this.strategy = strategy;
            this.command = command;
            order = command.Order;
            spreadInstrument = order.Instrument;
            orders = new Dictionary<Order, Leg>();

            // Send leg orders if order type is market.
            if (order.Type == OrderType.Market)
                SendLegOrders();
        }
コード例 #25
0
 public void Send(Order order)
 {
     OrderManager.Send(order);
 }
コード例 #26
0
 private void method_8(Order order_0, Bid bid_0, Ask ask_0)
 {
 }
コード例 #27
0
 private void method_6(Order order_0)
 {
 }
コード例 #28
0
 public void Cancel(Order order)
 {
     OrderManager.Cancel(order);
 }
コード例 #29
0
ファイル: Program.cs プロジェクト: fastquant/fastquant.dll
        private void UpdateExitLimit()
        {
            if (exitOrder != null && !exitOrder.IsDone)
                Cancel(exitOrder);

            if (HasPosition(Instrument))
            {
                if (Position.Side == PositionSide.Long)
                    exitOrder = SellLimitOrder(Instrument, Qty, sma.Last, "Exit");
                else
                    exitOrder = BuyLimitOrder(Instrument, Qty, sma.Last, "Exit");

                Send(exitOrder);
            }
        }
コード例 #30
0
 public void Reject(Order order)
 {
     OrderManager.Reject(order);
 }