コード例 #1
0
        /// <summary>
        /// Create a NewOrderSingle message.
        /// </summary>
        /// <param name="customFields"></param>
        /// <param name="orderType"></param>
        /// <param name="side"></param>
        /// <param name="symbol"></param>
        /// <param name="orderQty"></param>
        /// <param name="tif"></param>
        /// <param name="price">ignored if orderType=Market</param>
        /// <returns></returns>
        static public QuickFix.FIX42.NewOrderSingle NewOrderSingle(
            Dictionary <int, string> customFields,
            OrderType orderType, Side side, string symbol,
            int orderQty, TimeInForce tif, decimal price)
        {
            // hard-coded fields
            QuickFix.Fields.HandlInst fHandlInst = new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE);

            // from params
            QuickFix.Fields.OrdType      fOrdType      = FixEnumTranslator.ToField(orderType);
            QuickFix.Fields.Side         fSide         = FixEnumTranslator.ToField(side);
            QuickFix.Fields.Symbol       fSymbol       = new QuickFix.Fields.Symbol(symbol);
            QuickFix.Fields.TransactTime fTransactTime = new QuickFix.Fields.TransactTime(DateTime.Now);
            QuickFix.Fields.ClOrdID      fClOrdID      = GenerateClOrdID();

            QuickFix.FIX42.NewOrderSingle nos = new QuickFix.FIX42.NewOrderSingle(
                fClOrdID, fHandlInst, fSymbol, fSide, fTransactTime, fOrdType);
            nos.OrderQty    = new QuickFix.Fields.OrderQty(orderQty);
            nos.TimeInForce = FixEnumTranslator.ToField(tif);

            if (orderType == OrderType.Limit)
            {
                nos.Price = new QuickFix.Fields.Price(price);
            }

            // add custom fields
            foreach (KeyValuePair <int, string> p in customFields)
            {
                nos.SetField(new QuickFix.Fields.StringField(p.Key, p.Value));
            }

            return(nos);
        }
コード例 #2
0
        public static string Translate(QuickFix.Fields.OrdType ordType)
        {
            switch (ordType.Obj)
            {
            case '1': return("Market");

            case '2': return("Limit");
            }
            return("unknown");
        }
コード例 #3
0
        /// <summary>
        /// Throws a ArgumentException if field value isn't supported
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public static Enums.OrderType ToEnum(QuickFix.Fields.OrdType field)
        {
            switch (field.Obj)
            {
            case QuickFix.Fields.OrdType.LIMIT: return(Enums.OrderType.Limit);

            case QuickFix.Fields.OrdType.MARKET: return(Enums.OrderType.Market);
            }
            throw new ArgumentException(String.Format("Field value '{0}' not supported", field.Obj));
        }
コード例 #4
0
        public static OrderType c(QuickFix.Fields.OrdType s)
        {
            var val = s_ordtypes.Find(v => v.first.getValue() == s.getValue());

            if (val == null)
            {
                throw new Exception("Unmapped QuickFix.Fields.OrdType value : " + s.ToString());
            }
            return(val.second);
        }
コード例 #5
0
 public void Set(QuickFix.Fields.OrdType val)
 {
     this.OrdType = val;
 }