void StartAlgo()
        {
            while (!m_price.IsValid || m_algo == null)
            {
                mre.WaitOne();
            }

            // To retrieve the list of parameters valid for the Algo you can call algo.AlgoParameters;
            // Construct a dictionary of the parameters and the values to send out
            Dictionary <string, object> algo_userparams = new Dictionary <string, object>
            {
                { "Ignore Market State", true },
            };

            var lines = algo_userparams.Select(kvp => kvp.Key + ": " + kvp.Value.ToString());

            Console.WriteLine(string.Join(Environment.NewLine, lines));

            OrderProfile algo_op = m_algo.GetOrderProfile(m_instrument);

            algo_op.LimitPrice     = m_price;
            algo_op.OrderQuantity  = Quantity.FromDecimal(m_instrument, 5);;
            algo_op.Side           = OrderSide.Buy;
            algo_op.OrderType      = OrderType.Limit;
            algo_op.Account        = m_accounts.ElementAt(0);
            algo_op.UserParameters = algo_userparams;
            m_algoTradeSubscription.SendOrder(algo_op);
        }
Exemple #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Event notification for order book download complete. </summary>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        void m_algoTradeSubscription_OrderBookDownload(object sender, OrderBookDownloadEventArgs e)
        {
            Console.WriteLine("Orderbook downloaded...");

            //To retrieve the list of parameters valid for the Algo you can call
            //algo.AlgoParameters;

            //For an Iceberg Synthetic order here is the list of parameters you can set.

            /***************************************************************************
             *  Strategy: TT_Iceberg
             ***************************************************************************
             * ----------------------------------------------------------------------------------------------
             * ORDER PROFILE PROPERTIES
             * Name Type                                       Required                Updateable
             * ----------------------------------------------------------------------------------------------
             * OrderInstrumentID                                 true                     false
             * OrderQty                                          true                     true
             * OrderSide                                         true                     false
             * OrderAccount                                      true                     false
             * OrderType                                         true                     false
             * LimitPrice                                        true                     true
             *
             *
             * ----------------------------------------------------------------------------------------------------------------------
             * USER PARAMETER PROPERTIES
             * Name                        Type                Required         Updateable   Algo Specific Enum
             * -----------------------------------------------------------------------------------------------------------------------
             * ChildTIF                    Int_t               true            false
             * ParentTIF                   Int_t               true            false         tt_net_sdk.tt_iceberg.ParentTIF
             * DiscVal                     Qty_t               true            true
             * DiscValType                 Int_t               true            true          tt_net_sdk.tt_iceberg.DiscValType
             * Variance                    Int_t               false           false
             * LimitTicksAway              Int_t               false           true
             * LimitPriceType              Int_t               false           false         tt_net_sdk.tt_iceberg.LimitPriceType
             * TriggerType                 Int_t               false           false         tt_net_sdk.tt_iceberg.TriggerType
             * TriggerPriceType            Int_t               false           false         tt_net_sdk.tt_iceberg.TriggerPriceType
             * IsTrlTrg                    Boolean_t           false           false
             * TriggerTicksAway            Int_t               false           true
             * WithATickType               Int_t               false           false         tt_net_sdk.tt_iceberg.WithATickType
             * WithATick                   Qty_t               false           true
             * STime                       UTCTimestamp_t      false           true
             * ETime                       UTCTimestamp_t      false           true
             * ETimeAct                    Int_t               false           false         tt_net_sdk.tt_iceberg.ETimeAct
             * AutoResubExpiredGTD         Boolean_t           false           false
             * ----------------------------------------------------------------------------------------------------------------------- */
            // Get the accounts
            m_accounts = m_api.Accounts;

            //Construct a dictionary of the parameters and the values to send out
            Dictionary <string, object> iceberg_userparams = new Dictionary <string, object>
            {
                { "DiscVal", 5 },
                { "DiscValType", tt_net_sdk.tt_iceberg.DiscValType.Qty },
                { "ChildTIF", tt_net_sdk.TimeInForce.Day },
                { "ParentTIF", tt_net_sdk.tt_iceberg.ParentTIF.Day },
                { "ETimeAct", tt_net_sdk.tt_iceberg.ETimeAct.Cancel },
                { "STime", EpochTimeUtc(30) },
                { "ETime", EpochTimeUtc(60) },
            };

            var lines = iceberg_userparams.Select(kvp => kvp.Key + ": " + kvp.Value.ToString());

            Console.WriteLine(string.Join(Environment.NewLine, lines));

            OrderProfile iceberg_op = m_algo.GetOrderProfile(m_instrument);

            iceberg_op.LimitPrice = m_price;
            if (m_accounts.Count > 0)
            {
                iceberg_op.Account = m_accounts.ElementAt(0);
            }
            iceberg_op.Side          = OrderSide.Buy;
            iceberg_op.OrderType     = OrderType.Limit;
            iceberg_op.OrderQuantity = Quantity.FromDecimal(m_instrument, 10);
            iceberg_op.TimeInForce   = TimeInForce.Day;

            iceberg_op.UserParameters = iceberg_userparams;
            iceberg_op.UserTag        = "IcebergAlgoUsertag";
            iceberg_op.OrderTag       = "IcebergAlgoOrderTag";
            m_algoTradeSubscription.SendOrder(iceberg_op);
        }