Example #1
0
 public OrderTrailingStop(OrderSide position, decimal quantity, decimal adjustedPrice, int lagTicks, Symbol symbol, IAggregator account = null,
                          OrderDuration duration = OrderDuration.Gtc, uint leverage = 1)
     : base(position, quantity, symbol, account, duration, leverage)
 {
     LagTicks = lagTicks;
     SetStrikePrice(adjustedPrice);
 }
Example #2
0
 /// <summary>
 /// Convert the QuantConnect order duration enum into a Tradier order duration enum
 /// </summary>
 /// <param name="duration">QuantConnect order duration enum</param>
 /// <returns>Tradier order duration enum</returns>
 private TradierOrderDuration OrderDuration(OrderDuration duration)
 {
     switch (duration)
     {
     default:
     case QuantConnect.Orders.OrderDuration.GTC:
         return(TradierOrderDuration.GTC);
     }
 }
Example #3
0
 /// <summary>
 /// Order constructor:
 /// </summary>
 public Order(string symbol, int quantity, OrderType order, DateTime time, decimal price = 0, string tag = "")
 {
     this.Time         = time;
     this.Price        = price;
     this.Type         = order;
     this.Quantity     = quantity;
     this.Symbol       = symbol;
     this.Status       = OrderStatus.None;
     this.Tag          = tag;
     this.Duration     = OrderDuration.GTC;
     this.BrokerId     = new List <long>();
     this.ContingentId = 0;
 }
Example #4
0
 /// <summary>
 /// New order constructor
 /// </summary>
 /// <param name="symbol">Symbol asset we're seeking to trade</param>
 /// <param name="quantity">Quantity of the asset we're seeking to trade</param>
 /// <param name="order">Order type (market, limit or stoploss order)</param>
 /// <param name="time">Time the order was placed</param>
 /// <param name="price">Price the order should be filled at if a limit order</param>
 /// <param name="tag">User defined data tag for this order</param>
 public Order(string symbol, int quantity, OrderType order, DateTime time, decimal price = 0, string tag = "")
 {
     Time         = time;
     Price        = price;
     Type         = order;
     Quantity     = quantity;
     Symbol       = symbol;
     Status       = OrderStatus.None;
     Tag          = tag;
     Duration     = OrderDuration.GTC;
     BrokerId     = new List <long>();
     ContingentId = 0;
 }
Example #5
0
 /// <summary>
 /// Added a default constructor for JSON Deserialization:
 /// </summary>
 public Order()
 {
     Time         = new DateTime();
     Price        = 0;
     Type         = OrderType.Market;
     Quantity     = 0;
     Symbol       = "";
     Status       = OrderStatus.None;
     Tag          = "";
     SecurityType = SecurityType.Base;
     Duration     = OrderDuration.GTC;
     BrokerId     = new List <long>();
     ContingentId = 0;
 }
Example #6
0
 /// <summary>
 /// Added a default constructor for JSON Deserialization:
 /// </summary>
 protected Order(OrderType type)
 {
     Time         = new DateTime();
     Price        = 0;
     Type         = type;
     Quantity     = 0;
     Symbol       = "";
     Status       = OrderStatus.None;
     Tag          = "";
     SecurityType = SecurityType.Base;
     Duration     = OrderDuration.GTC;
     BrokerId     = new List <long>();
     ContingentId = 0;
 }
Example #7
0
        public string ConvertToTimeInForce(OrderDuration orderDuration)
        {
            switch (orderDuration)
            {
            case OrderDuration.GTC:
                return(CashDefinition.TIF_GTC);

            case OrderDuration.Custom:
                return(CashDefinition.TIF_DAY);

            case OrderDuration.Day:
                return(CashDefinition.TIF_DAY);

            default:
                throw new InvalidEnumArgumentException("order.OrderType", (int)orderDuration, typeof(Orders.OrderDuration));
            }
        }
 protected OrderBase(OrderType type, OrderSide side, decimal quantity, IAggregator account, Symbol symbol,
                     decimal price = 0, OrderDuration duration = OrderDuration.Gtc, uint leverage = 1)
 {
     Account      = account;
     TargetSymbol = symbol;
     Type         = type;
     ClientId     = Guid.NewGuid();
     OrigClientId = ClientId;
     Quantity     = quantity;
     if (quantity < 0)
     {
         throw new Exception("negative quantity order");
     }
     Side     = side;
     Duration = duration;
     Leverage = leverage;
     Price    = price;
     status   = DigitexWire.OrderStatus.Pending;
 }
Example #9
0
 /// <summary>
 /// New order constructor
 /// </summary>
 /// <param name="symbol">Symbol asset we're seeking to trade</param>
 /// <param name="type"></param>
 /// <param name="quantity">Quantity of the asset we're seeking to trade</param>
 /// <param name="order">Order type (market, limit or stoploss order)</param>
 /// <param name="time">Time the order was placed</param>
 /// <param name="tag">User defined data tag for this order</param>
 protected Order(string symbol, SecurityType type, int quantity, OrderType order, DateTime time, string tag = "")
 {
     Time = time;
     Price = 0;
     Type = order;
     Quantity = quantity;
     Symbol = symbol;
     Status = OrderStatus.None;
     Tag = tag;
     SecurityType = type;
     Duration = OrderDuration.GTC;
     BrokerId = new List<long>();
     ContingentId = 0;
 }
Example #10
0
 Order exit(string s, OrderDetails stop, OrderDuration duration)
 {
     return(placeOrder(system.position().exit(s, stop, duration)));
 }
Example #11
0
 Order scaleUp(string description, OrderDetails details, OrderDuration duration)
 {
     return(placeOrder(system.position().scaleUp(description, details, 1, duration)));
 }
Example #12
0
 Order buy(string description, OrderDetails details, OrderDuration duration)
 {
     return(placeOrder(SYMBOL.buy(description, details, 1, duration)));
 }
 public OrderLimit(OrderSide side, decimal quantity, decimal price, Symbol symbol, IAggregator account = null, OrderDuration duration = OrderDuration.Gtc, uint leverage = 1)
     : base(OrderType.Limit, side, quantity, account, symbol, price, duration, leverage)
 {
 }
Example #14
0
 /// <summary>
 /// New order constructor
 /// </summary>
 /// <param name="symbol">Symbol asset we're seeking to trade</param>
 /// <param name="type">Type of the security order</param>
 /// <param name="quantity">Quantity of the asset we're seeking to trade</param>
 /// <param name="order">Order type (market, limit or stoploss order)</param>
 /// <param name="time">Time the order was placed</param>
 /// <param name="price">Price the order should be filled at if a limit order</param>
 /// <param name="tag">User defined data tag for this order</param>
 public Order(string symbol, int quantity, OrderType order, DateTime time, decimal price = 0, string tag = "", SecurityType type = SecurityType.Base)
 {
     Time = time;
     Price = price;
     Type = order;
     Quantity = quantity;
     Symbol = symbol;
     Status = OrderStatus.None;
     Tag = tag;
     SecurityType = type;
     Duration = OrderDuration.GTC;
     BrokerId = new List<long>();
     ContingentId = 0;
 }
Example #15
0
        protected List <Order> sell(string description, OrderDetails detailsLeft, OrderDetails detailsRight, long size, OrderDuration duration)
        {
            var result = pair().sell(description, detailsLeft, detailsRight, size, duration);

            Objects.each(result, order => order.placed());
            return(result);
        }
Example #16
0
 /// <summary>
 /// Added a default constructor for JSON Deserialization:
 /// </summary>
 protected Order(OrderType type)
 {
     Time = new DateTime();
     Price = 0;
     Type = type;
     Quantity = 0;
     Symbol = "";
     Status = OrderStatus.None;
     Tag = "";
     SecurityType = SecurityType.Base;
     Duration = OrderDuration.GTC;
     BrokerId = new List<long>();
     ContingentId = 0;
 }
 public OrderMarket(OrderSide position, decimal quantity, Symbol symbol, IAggregator account = null, OrderDuration duration = OrderDuration.Gtc, uint leverage = 1)
     : base(OrderType.Market, position, quantity, account, symbol, duration: duration, leverage: leverage)
 {
 }
Example #18
0
 /// <summary>
 /// Order constructor:
 /// </summary>
 public Order(string symbol, int quantity, OrderType order, DateTime time, decimal price = 0, string tag = "")
 {
     this.Time = time;
     this.Price = price;
     this.Type = order;
     this.Quantity = quantity;
     this.Symbol = symbol;
     this.Status = OrderStatus.None;
     this.Tag = tag;
     this.Duration = OrderDuration.GTC;
     this.BrokerId = new List<long>();
     this.ContingentId = 0;
 }
Example #19
0
 /// <summary>
 /// Added a default constructor for JSON Deserialization:
 /// </summary>
 public Order()
 {
     Time = new DateTime();
     Price = 0;
     Type = OrderType.Market;
     Quantity = 0;
     Symbol = "";
     Status = OrderStatus.None;
     Tag = "";
     SecurityType = SecurityType.Base;
     Duration = OrderDuration.GTC;
     BrokerId = new List<long>();
     ContingentId = 0;
 }
Example #20
0
 protected Order sell(string description, OrderDetails details, long size, OrderDuration duration)
 {
     return(symbol().sell(description, details, size, duration).placed());
 }