예제 #1
0
 /// <summary>
 /// Broadcasts a change of record event.
 /// </summary>
 /// <param name="allocationsEventArgs">The event argument.</param>
 public static void OnAllocationChanged(AllocationEventArgs allocationsEventArgs)
 {
     // Broadcast the event to any listeners.
     if (Allocation.Changed != null)
     {
         Allocation.Changed(typeof(Allocation), allocationsEventArgs);
     }
 }
예제 #2
0
        /// <summary>
        /// Checks to make sure that a new proposed order doesn't violate a list of restricted securities.
        /// </summary>
        /// <param name="sender">The object that originated the event (ignored).</param>
        /// <param name="allocationEventArgs">A proposed order that is to be checked.</param>
        private static void AllocationHandler(object sender, AllocationEventArgs allocationEventArgs)
        {
            // Extract the event argument.
            Allocation allocation = allocationEventArgs.Allocation;

            // There is no need to recalculate the market and sector values if the the account is not part of this compliance
            // restriction.  A quick filter should be part of all compliance checks to prevent unnecessary calculations.
            if (TelecomConcentration.betaAccountList.Contains(allocation.Position.Account))
            {
                TelecomConcentration.updateAccountList.Add(allocation.Position.Account);
            }
        }
예제 #3
0
        /// <summary>
        /// Handles the primary Market Data events and passes the events along to the Langauge Primitives.
        /// </summary>
        /// <param name="sender">The object that originated the event.</param>
        /// <param name="allocationRowChangeEvent">The record change event argument.</param>
        public static void AllocationHandler(object sender, ClientMarketData.AllocationRowChangeEvent allocationRowChangeEvent)
        {
            // Extract the record from the event argument.
            ClientMarketData.AllocationRow allocationRow = allocationRowChangeEvent.Row;

            // Translate the ADO.NET row states into a record state used by the Rules Engine.
            Action action = Action.Nothing;

            switch (allocationRowChangeEvent.Action)
            {
            case DataRowAction.Add: action = Action.Add; break;

            case DataRowAction.Delete: action = Action.Delete; break;

            case DataRowAction.Change: action = Action.Change; break;

            case DataRowAction.Commit: return;
            }

            // Place the event into a list that will be processed when the tables are no longer locked.
            Allocation.allocationEventArgList.Add(new AllocationEventArgs(action, Allocation.Make(allocationRow)));
        }
예제 #4
0
 /// <summary>
 /// Constructs and argument for passing a proposed order event to a listener.
 /// </summary>
 /// <param name="action">The action taken on the proposed order.</param>
 /// <param name="allocation">The proposed order record.</param>
 public AllocationEventArgs(Action action, Allocation allocation)
 {
     // Initialize the record.
     this.action     = action;
     this.allocation = allocation;
 }