Price Field
Inheritance: DecimalField
Esempio n. 1
0
        public void OnMessage(QuickFix.FIX44.NewOrderSingle n, SessionID s)
        {
            Console.WriteLine("* Got a NewOrderSingle.  Responding with an ExecutionReport.");

            Symbol symbol = n.Symbol;
            Side side = n.Side;
            OrdType ordType = n.OrdType;
            OrderQty orderQty = n.OrderQty;
            Price price = new Price(DEFAULT_MARKET_PRICE);
            ClOrdID clOrdID = n.ClOrdID;

            switch (ordType.getValue())
            {
                case OrdType.LIMIT:
                    price = n.Price;
                    if (price.Obj == 0)
                        throw new IncorrectTagValue(price.Tag);
                    break;
                case OrdType.MARKET: break;
                default: throw new IncorrectTagValue(ordType.Tag);
            }

            QuickFix.FIX44.ExecutionReport exReport = new QuickFix.FIX44.ExecutionReport(
                new OrderID(GenOrderID()),
                new ExecID(GenExecID()),
                new ExecType(ExecType.FILL),
                new OrdStatus(OrdStatus.FILLED),
                symbol, //shouldn't be here?
                side,
                new LeavesQty(0),
                new CumQty(orderQty.getValue()),
                new AvgPx(price.getValue()));

            exReport.Set(clOrdID);
            exReport.Set(symbol);
            exReport.Set(orderQty);
            exReport.Set(new LastQty(orderQty.getValue()));
            exReport.Set(new LastPx(price.getValue()));

            if (n.IsSetAccount())
                exReport.SetField(n.Account);

            try
            {
                Session.SendToTarget(exReport, s);
            }
            catch (SessionNotFound ex)
            {
                Console.WriteLine("==session not found exception!==");
                Console.WriteLine(ex.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 2
0
        private static OrderData TranslateOrderImpl(Symbol symbol,
                                                    Side side,
                                                    OrdType ordType,
                                                    OrderQty orderQty,
                                                    Price price,
                                                    ClOrdID clOrdID,
                                                    Account account)
        {
            switch (ordType.getValue())
            {
                case OrdType.LIMIT:
                    if (price.Obj == 0)
                        throw new IncorrectTagValue(price.Tag);

                    break;

                    //case OrdType.MARKET: break;

                default:
                    throw new IncorrectTagValue(ordType.Tag);
            }

            return new OrderData
                {
                    MarketSide = TranslateFixFields.Translate(side),
                    Symbol = symbol.getValue(),
                    OrderType = TranslateFixFields.Translate(ordType),
                    Quantity = orderQty.getValue(),
                    Price = price.getValue(),
                    ClOrdID = clOrdID.getValue(),
                    Account =
                        account == null
                            ? TradingAccount.None
                            : new TradingAccount(account.getValue())
                };
        }
Esempio n. 3
0
 public void Set(QuickFix.Fields.Price val) 
 { 
     this.Price = val;
 }
Esempio n. 4
0
 public bool IsSet(QuickFix.Fields.Price val)
 {
     return(IsSetPrice());
 }
Esempio n. 5
0
 public QuickFix.Fields.Price Get(QuickFix.Fields.Price val)
 {
     GetField(val);
     return(val);
 }
Esempio n. 6
0
 public void Set(QuickFix.Fields.Price val)
 {
     this.Price = val;
 }