Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixTradingGateway"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="fixClient">The FIX client.</param>
        public FixTradingGateway(
            IComponentryContainer container,
            IMessageBusAdapter messagingAdapter,
            IFixClient fixClient)
            : base(container, messagingAdapter)
        {
            this.fixClient = fixClient;

            // Commands
            this.RegisterHandler <ConnectSession>(this.OnMessage);
            this.RegisterHandler <DisconnectSession>(this.OnMessage);

            // Events
            this.RegisterHandler <OrderSubmitted>(this.OnMessage);
            this.RegisterHandler <OrderAccepted>(this.OnMessage);
            this.RegisterHandler <OrderRejected>(this.OnMessage);
            this.RegisterHandler <OrderWorking>(this.OnMessage);
            this.RegisterHandler <OrderModified>(this.OnMessage);
            this.RegisterHandler <OrderCancelReject>(this.OnMessage);
            this.RegisterHandler <OrderExpired>(this.OnMessage);
            this.RegisterHandler <OrderCancelled>(this.OnMessage);
            this.RegisterHandler <OrderPartiallyFilled>(this.OnMessage);
            this.RegisterHandler <OrderFilled>(this.OnMessage);
            this.RegisterHandler <AccountStateEvent>(this.OnMessage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixDataGateway"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="dataBusAdapter">The data bus adapter.</param>
        /// <param name="fixClient">The FIX client.</param>
        public FixDataGateway(
            IComponentryContainer container,
            IDataBusAdapter dataBusAdapter,
            IFixClient fixClient)
            : base(container, dataBusAdapter)
        {
            this.fixClient = fixClient;

            this.RegisterHandler <ConnectSession>(this.OnMessage);
            this.RegisterHandler <DisconnectSession>(this.OnMessage);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates and returns a new FIX gateway.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="fixClient">The FIX client.</param>
        /// <returns>The created FIX gateway.</returns>
        public static FixTradingGateway Create(
            IComponentryContainer container,
            IMessageBusAdapter messagingAdapter,
            IFixClient fixClient)
        {
            var gateway = new FixTradingGateway(
                container,
                messagingAdapter,
                fixClient);

            fixClient.InitializeGateway(gateway);

            return(gateway);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates and returns a new FIX gateway.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="dataBusAdapter">The data bus adapter.</param>
        /// <param name="fixClient">The FIX client.</param>
        /// <returns>The created FIX gateway.</returns>
        public static FixDataGateway Create(
            IComponentryContainer container,
            IDataBusAdapter dataBusAdapter,
            IFixClient fixClient)
        {
            var gateway = new FixDataGateway(
                container,
                dataBusAdapter,
                fixClient);

            fixClient.InitializeGateway(gateway);

            return(gateway);
        }