예제 #1
0
        /// <summary>
        /// Selects the data closing.
        /// </summary>
        /// <param name="Side">The side.</param>
        /// <returns></returns>
        public static List <Orders> SelectDataClosing(string Side)
        {
            List <Orders> SubData = new List <Orders>();

            using (SqlConnection con = new SqlConnection(conString))
            {
                con.Open();
                SqlCommand T_TradedOrders = null;
                if (Side == "Opening")
                {
                    T_TradedOrders = new SqlCommand("Select * from T_TradedOrders where Side = 'Buy' or Side = 'Buy to Close'", con);
                }
                else if (Side == "Closing")
                {
                    T_TradedOrders = new SqlCommand("Select * from T_TradedOrders where Side = 'Sell' or Side = 'Sell Short'", con);
                }
                //else if (Side == "Closed")
                //{
                //    T_TradedOrders = new SqlCommand("Select * from T_TradedOrders where Side = 'Sell' or Side = 'SellShort'", con);
                //}

                SqlDataReader rd = T_TradedOrders.ExecuteReader();

                while (rd.Read())
                {
                    SubData.Add(new Orders {
                        Symbol = rd["Symbol"].ToString(), Side = rd["Side"].ToString(), Account = rd["Account"].ToString(), Quantity = rd["Quantity"].ToString(), AvgPrice = rd["AvgPrice"].ToString(), RemainingQuantity = rd["RemainingQuantity"].ToString(), OrderStatus = rd["OrderStatus"].ToString(), CLOrderID = rd["CLOrderId"].ToString(), ParentCLOrderID = rd["ParentCLOrderId"].ToString(), StaggedOrderID = rd["StagedOrderID"].ToString(), OriginalCLOrderID = rd["OriginalCLOrderId"].ToString()
                    });
                }
            }
            return(SubData);
        }
예제 #2
0
        /// <summary>
        /// Selects the data allocation.
        /// </summary>
        /// <param name="Account">The account.</param>
        /// <returns></returns>
        public static List <Orders> SelectDataAllocation(string Account)
        {
            List <Orders> SubData = new List <Orders>();

            using (SqlConnection con = new SqlConnection(conString))
            {
                con.Open();
                SqlCommand T_TradedOrders = null;
                if (Account == "Unallocated")
                {
                    T_TradedOrders = new SqlCommand("Select * from T_TradedOrders where Account = 'Unallocated'", con);
                }
                else if (Account == "Allocated")
                {
                    T_TradedOrders = new SqlCommand("Select * from T_TradedOrders where Account <> 'Unallocated'", con);
                }

                SqlDataReader rd = T_TradedOrders.ExecuteReader();

                while (rd.Read())
                {
                    SubData.Add(new Orders {
                        Symbol = rd["Symbol"].ToString(), Side = rd["Side"].ToString(), Account = rd["Account"].ToString(), Quantity = rd["Quantity"].ToString(), AvgPrice = rd["AvgPrice"].ToString(), RemainingQuantity = rd["RemainingQuantity"].ToString(), OrderStatus = rd["OrderStatus"].ToString(), CLOrderID = rd["CLOrderId"].ToString(), ParentCLOrderID = rd["ParentCLOrderId"].ToString(), StaggedOrderID = rd["StagedOrderID"].ToString(), OriginalCLOrderID = rd["OriginalCLOrderId"].ToString()
                    });
                }
            }
            return(SubData);
        }