Exemplo n.º 1
0
        public void PublishFakeExecutionReport()
        {
            int i = 1;

            while (true)
            {
                QuickFix41.ExecutionReport exReport = new QuickFix41.ExecutionReport();

                exReport.setField(new ExecID(i.ToString()));
                exReport.setField(new ExecTransType(ExecTransType.NEW));
                exReport.setField(new ClOrdID(i.ToString()));
                exReport.setField(new OrderID(i.ToString()));
                exReport.setField(new ExecType(ExecType.NEW));
                exReport.setField(new OrdStatus(OrdStatus.NEW));
                exReport.setField(new TransactTime(DateTime.Now));
                exReport.setField(new LeavesQty(1));
                exReport.setField(new CumQty(0));
                exReport.setField(new AvgPx(0));
                exReport.setField(new MultiLegReportingType(MultiLegReportingType.SINGLE));
                exReport.setField(new SecurityID("TVPP"));
                exReport.setField(new Symbol("TVPP"));
                exReport.setField(new Account("1"));
                //exReport.setField(new OrderCapacity(OrderCapacity.PRINCIPAL));
                //exReport.setField(new CustOrderCapacity(CustOrderCapacity.MEMBER_TRADING_FOR_THEIR_OWN_ACCOUNT));
                exReport.setField(new Side(Side.BUY));
                exReport.setField(new OrdType(OrdType.MARKET));
                exReport.setField(new OpenClose(OpenClose.OPEN));
                exReport.setField(new TimeInForce(TimeInForce.GOOD_TILL_CANCEL));

                Session.sendToTarget(exReport, SessionID);

                i++;
                Thread.Sleep(1000);
            }
        }
Exemplo n.º 2
0
        public override void onMessage(QuickFix41.NewOrderSingle order, SessionID sessionID)
        {
            Symbol   symbol   = new Symbol();
            Side     side     = new Side();
            OrdType  ordType  = new OrdType();
            OrderQty orderQty = new OrderQty();
            Price    price    = new Price();
            ClOrdID  clOrdID  = new ClOrdID();

            order.get(ordType);

            if (ordType.getValue() != OrdType.LIMIT)
            {
                throw new IncorrectTagValue(ordType.getField());
            }

            order.get(symbol);
            order.get(side);
            order.get(orderQty);
            order.get(price);
            order.get(clOrdID);

            QuickFix41.ExecutionReport executionReport = new QuickFix41.ExecutionReport
                                                             (genOrderID(),
                                                             genExecID(),
                                                             new ExecTransType(ExecTransType.NEW),
                                                             new ExecType(ExecType.FILL),
                                                             new OrdStatus(OrdStatus.FILLED),
                                                             symbol,
                                                             side,
                                                             orderQty,
                                                             new LastShares(orderQty.getValue()),
                                                             new LastPx(price.getValue()),
                                                             new LeavesQty(0),
                                                             new CumQty(orderQty.getValue()),
                                                             new AvgPx(price.getValue()));

            executionReport.set(clOrdID);

            if (order.isSetAccount())
            {
                executionReport.set(order.getAccount());
            }

            try
            {
                Session.sendToTarget(executionReport, sessionID);
            }
            catch (SessionNotFound) {}
        }
Exemplo n.º 3
0
  public override void onMessage( QuickFix41.NewOrderSingle order, SessionID sessionID )
  {
    Symbol symbol = new Symbol();
    Side side = new Side();
    OrdType ordType = new OrdType();
    OrderQty orderQty = new OrderQty();
    Price price = new Price();
    ClOrdID clOrdID = new ClOrdID();

    order.get( ordType );

    if ( ordType.getValue() != OrdType.LIMIT )
      throw new IncorrectTagValue( ordType.getField() );
    
    order.get( symbol );
    order.get( side );
    order.get( orderQty );
    order.get( price );
    order.get( clOrdID );

    QuickFix41.ExecutionReport executionReport = new QuickFix41.ExecutionReport
        ( genOrderID(),
          genExecID(),
          new ExecTransType( ExecTransType.NEW ),
          new ExecType( ExecType.FILL ),
          new OrdStatus ( OrdStatus.FILLED ),
          symbol,
          side,
          orderQty,
          new LastShares ( orderQty.getValue() ),
          new LastPx ( price.getValue() ),
          new LeavesQty( 0 ),
          new CumQty ( orderQty.getValue() ),
          new AvgPx ( price.getValue() ) );

    executionReport.set( clOrdID );

    if( order.isSetAccount() )
      executionReport.set( order.getAccount() );

    try
    {
      Session.sendToTarget( executionReport, sessionID );
    }
    catch ( SessionNotFound ) {}
  }