コード例 #1
0
        public static EEntrustType GetEntrustType(OrderRow_LH order)
        {
            EEntrustType direction = EEntrustType.无;
            if (order.sc == 'S' || order.sc == 'H')
            {
                if (order.BS == 'B')
                    direction = EEntrustType.买入;
                else if (order.BS == 'S')
                    direction = EEntrustType.卖出;
            }
            else if (order.sc == 'F')
            {
                if (order.BS == 'B')
                {
                    if (order.OpenOrClose == 'O')
                        direction = EEntrustType.买入开仓;
                    else if (order.OpenOrClose == 'C')
                        direction = EEntrustType.买入平仓;
                    else
                        direction = EEntrustType.买入;
                }
                else if (order.BS == 'S')
                {
                    if (order.OpenOrClose == 'O')
                        direction = EEntrustType.卖出开仓;
                    else if (order.OpenOrClose == 'C')
                        direction = EEntrustType.卖出平仓;
                    else
                        direction = EEntrustType.卖出;
                }
            }

            return direction;
        }
コード例 #2
0
        /// <summary>
        /// 获取多头空头状态,0:表示多头,1:表示空头;
        /// </summary>
        protected int GetSideState(OrderRow_LH order, int defaultValue = 0)
        {
            if (order.OpenOrClose == 'C' || order.OpenOrClose == 'c')
            {
                if (order.BS == 'B' || order.BS == 'b')
                    return 1;
                else if (order.BS == 'S' || order.BS == 's')
                    return 0;
            }
            else if (order.OpenOrClose == 'O' || order.OpenOrClose == 'o')
            {
                if (order.BS == 'B' || order.BS == 'b')
                    return 0;
                else if (order.BS == 'S' || order.BS == 's')
                    return 1;
            }

            return defaultValue;
        }
コード例 #3
0
 public static ESecurityType GetSecurityType(OrderRow_LH row)
 {
     return GetSecurityType(row.zqlb);
 }
コード例 #4
0
        protected string ConvertSecurityId(OrderRow_LH order)
        {
            if (string.IsNullOrEmpty(order.zqdm))
                return string.Empty;

            if (order.sc == 'S' || order.sc == 's')
                return string.Format("{0}.SZ", order.zqdm);
            else if (order.sc == 'H' || order.sc == 'h')
                return string.Format("{0}.SH", order.zqdm);
            else if (order.sc == 'F' || order.sc == 'f')
                return string.Format("{0}.CFE", order.zqdm);

            return order.zqdm;
        }
コード例 #5
0
        protected int GetDirection(OrderRow_LH order)
        {
            if (order.sc == 'S' || order.sc == 'H')
            {
                if (order.BS == 'B')
                    return DirectionCoding.GetDirectionCode(TradeType.TRADE_BUY);
                else if (order.BS == 'S')
                    return DirectionCoding.GetDirectionCode(TradeType.TRADE_SELL);
            }
            else if (order.sc == 'F')
            {
                if (order.OpenOrClose == 'O')
                    return DirectionCoding.GetDirectionCode(TradeType.TRADE_FUT_OPEN);
                else if (order.OpenOrClose == 'C')
                    return DirectionCoding.GetDirectionCode(TradeType.TRADE_FUT_CLOSE);
            }

            return 0;
        }
コード例 #6
0
        public TradeRow GetTradeRow(OrderRow_LH row)
        {
            TradeRow trade = new TradeRow();
            trade.Trade_Date = row.CrtDate != null ? row.CrtDate.Value.ToString("yyyyMMdd") : null;
            //trade.Trade_Id;
            trade.Security_Id = this.ConvertSecurityId(row);
            trade.Direction = this.GetDirection(row);
            trade.Volume = row.CjNum;
            trade.Multiplier = row.mUnitnum;
            trade.Side = this.GetSideState(row);
            trade.Price = row.OrderPr;
            trade.Balance = row.CjBal;
            //trade.Trade_Type;
            //trade.Source_Type;
            //trade.Source
            trade.Turn_Over = row.CjBal;
            //trade.Front_Id;
            //trade.Session_Id;
            //trade.Local_Order_Id;
            trade.Xmdm = row.xmdm;
            //trade.Zcdy;
            trade.Zhdm = row.zmdm.ToString();
            trade.Policy_Id = row.PolicyId;
            trade.Order_Date = row.CrtDate != null ? row.CrtDate.Value.ToString("yyyyMMdd") : null;
            trade.Order_Id = row.orderno.ToString();
            //trade.Trade_Route;
            //trade.Seat_Id;
            //trade.Client_Id;
            //trade.Sys_Trade_Date;
            //trade.Sys_Trade_Settlement_Id;
            //trade.Sys_Trade_Id;
            //trade.Sys_Order_Date;
            //trade.Sys_Order_Settlement_Id;
            //trade.Sys_Order_Id;
            trade.Trade_Time = row.CjTimeJys.ToString();

            return trade;
        }
コード例 #7
0
        public OrderRow GetOrderRow(OrderRow_LH row)
        {
            OrderRow order = new OrderRow();

            order.Trade_Date = row.CrtDate != null ? row.CrtDate.Value.ToString("yyyyMMdd") : null;
            order.Order_Id = row.orderno.ToString();
            order.Security_Id = this.ConvertSecurityId(row);
            order.Direction = this.GetDirection(row);
            order.Volume = row.OrderNum;
            order.Multiplier = row.mUnitnum;
            order.Side = this.GetSideState(row);
            order.Price = row.OrderPr;
            order.Order_Type = row.OpenOrClose;
            //order.Order_Status = ;
            //order.Order_Status_Msg;
            //order.Original_Volume;
            //order.Turn_Over;
            //order.Front_Id;
            //order.Session_Id = ;
            //order.Local_Order_Id;
            order.Xmdm = row.xmdm;
            //order.Zcdy = ;
            //order.Zhdm = row.zmdm.ToString();
            order.Policy_Id = row.PolicyId;
            //order.Trading_Route;
            //order.Seat_Id;
            //order.Client_Id;
            //order.Sys_Order_Date;
            //order.Sys_Order_Settlement_Id;
            //order.Sys_Order_Id;
            //order.Create_User_Id;
            //order.Create_Iime;
            //order.Update_User_Id;
            //order.Update_Time;

            return order;
        }
コード例 #8
0
        protected OrderRow_LH GetOrderRow_LH(DbDataReader reader)
        {
            OrderRow_LH order = new OrderRow_LH();
            order.BS = Convert.ToChar(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_BS)));
            order.cancelnum = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_cancelnum)));
            order.Cancelorderno = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_Cancelorderno)));
            order.cidx = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_cidx)));
            order.CjBal = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CjBal)));
            order.CjNum = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CjNum)));
            order.CjTimeJys = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CjTimeJys)));
            order.CrtDate = Convert.ToDateTime(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CrtDate)));
            order.CustomInfo1 = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CustomInfo1)));
            order.CustomInfo2 = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CustomInfo2)));
            order.CustomInfo3 = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_CustomInfo3)));
            order.DebugInfo = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_DebugInfo)));
            order.FirtCjTime = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_FirtCjTime)));
            order.FroseBal = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_FroseBal)));
            order.FroseStore = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_FroseStore)));
            order.FroseStoreETF = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_FroseStoreETF)));
            order.gddm = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_gddm)));
            order.InstruId = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_InstruId)));
            order.LastCjTime = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_LastCjTime)));
            order.mUnitnum = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_mUnitnum)));
            order.OpenOrClose = Convert.ToChar(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_OpenOrClose)));
            order.Oper = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_Oper)));
            order.orderno = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_orderno)));
            order.OrderNum = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_OrderNum)));
            order.OrderPr = Convert.ToDouble(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_OrderPr)));
            order.OrderTime = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_OrderTime)));
            order.OrderType = Convert.ToChar(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_OrderType)));
            order.PolicyId = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_PolicyId)));
            order.reportno = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_reportno)));
            order.ReportTime = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_ReportTime)));
            order.sc = Convert.ToChar(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_sc)));
            order.status = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_status)));
            order.xmdm = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_xmdm)));
            order.zjdm = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_zjdm)));
            order.zmdm = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_zmdm)));
            order.zqdm = Convert.ToString(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_zqdm)));
            order.zqlb = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(OrderRow_LH.C_zqlb)));

            return order;
        }