Esempio n. 1
0
        protected TradeRow GetTradeRow(JsmxRow_SZ row)
        {
            TradeRow data = new TradeRow();

            // 02、成交日期:成交日期;
            data.Trade_Date = string.Empty;
            // 03、成交ID:可能为订单编号/申请单号、执行编号,对于其他渠道申请的委托,执行编号可能为空;
            data.Trade_Id = string.Empty;
            // 04、证券代码:深交所证券代码需要添加后缀".SZ";
            data.Security_Id = this.ConvertSecurityId(row.MXZQDM);
            // 05、方向标志位:
            data.Direction = this.GetDirection(row);
            // 06、数量:数量暂时以成交数量为准;
            data.Volume = row.MXCJSL;
            // 07、合约乘数:
            data.Multiplier = 1;
            // 08、多头空头;
            data.Side = this.GetSideFlag(row);
            // 09、价格:
            data.Price = row.MXCJJG;
            // 10、金额:
            data.Balance = row.MXQSBJ;
            // 11、成交类型:9:30之前为集合竞价;9:30之后为连续竞价;默认为2;
            data.Trade_Type = 2;
            // 12、基金代码或内部融券标志位;
            data.Source_Type = 2;
            // 13、基金代码/账户信息;
            data.Source = row.MXZQZH;
            // 14、成交额:
            data.Turn_Over = data.Balance;
            // 15、前置编号;
            data.Front_Id = 0;
            // 16、回话编号;
            data.Session_Id = 0;
            // 17、本地委托编号;
            data.Local_Order_Id = string.Empty;
            // 18、项目代码;
            data.Xmdm = 0;
            // 19、资产单元;
            data.Zcdy = string.Empty;
            // 20、组合代码;
            data.Zhdm = string.Empty;
            // 21、策略号;
            data.Policy_Id = 0;
            // 22、委托日期:没有托管日期;
            data.Order_Date = string.Empty;
            // 23、委托编号:对应于结算明细表中的订单编号;
            data.Order_Id = string.Empty;
            // 24、交易通道:
            data.Trade_Route = string.Empty;
            // 25、经纪商席位代码;
            data.Seat_Id = string.Empty;
            // 26、投资者客户代码;
            data.Client_Id = string.Empty;
            // 27、系统成交日期;
            data.Sys_Trade_Date = row.MXCJRQ;
            // 28、系统成交结算编号;
            data.Sys_Trade_Settlement_Id = 0;
            // 29、系统成交ID:同成交ID,清算表中的数据均为系统生成的,但是在成交表中需要的是成交ID,所以将成交信息与系统成交信息设为相同的数据;
            data.Sys_Trade_Id = row.MXYWLSH;
            // 30、系统委托日期与系统成交日期为同一天;
            data.Sys_Order_Date = row.MXCJRQ;
            // 31、系统委托结算编号:
            data.Sys_Order_Settlement_Id = 0;
            // 32、系统委托日期;
            data.Sys_Order_Id = row.MXDDBH;
            // 33、成交时间:清算表中没有与时间相关的字段;
            data.Trade_Time = string.Empty;

            return data;
        }
Esempio n. 2
0
        public bool Add(TradeRow trade)
        {
            string sql = string.Format("insert into {0}({1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}) VALUES(@{1}, @{2}, @{3}, @{4}, @{5}, @{6}, @{7}, @{8}, @{9}, @{10}, @{11}, @{12}, @{13}, @{14}, @{15}, @{16}, @{17}, @{18}, @{19}, @{20}, @{21}, @{22}, @{23}, @{24}, @{25}, @{26}, @{27}, @{28}, @{29}, @{30}, @{31}, @{32});", T_TableName,
                TradeRow.C_trade_date,
                TradeRow.C_trade_id,
                TradeRow.C_security_id,
                TradeRow.C_direction,
                TradeRow.C_volume,
                TradeRow.C_multiplier,
                TradeRow.C_side,
                TradeRow.C_price,
                TradeRow.C_balance,
                TradeRow.C_trade_type,
                TradeRow.C_source_type,
                TradeRow.C_source,
                TradeRow.C_turn_over,
                TradeRow.C_front_id,
                TradeRow.C_session_id,
                TradeRow.C_local_order_id,
                TradeRow.C_xmdm,
                TradeRow.C_zcdy,
                TradeRow.C_zhdm,
                TradeRow.C_policy_id,
                TradeRow.C_order_date,
                TradeRow.C_order_id,
                TradeRow.C_trade_route,
                TradeRow.C_seat_id,
                TradeRow.C_client_id,
                TradeRow.C_sys_trade_date,
                TradeRow.C_sys_trade_settlement_id,
                TradeRow.C_sys_trade_id,
                TradeRow.C_sys_order_date,
                TradeRow.C_sys_order_settlement_id,
                TradeRow.C_sys_order_id,
                TradeRow.C_trade_time);

            MySqlParameter[] parameters = new MySqlParameter[]{
                new MySqlParameter(string.Format("@{0}", TradeRow.C_trade_date), trade.Trade_Date), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_trade_id), trade.Trade_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_security_id), trade.Security_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_direction), trade.Direction), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_volume), trade.Volume), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_multiplier), trade.Multiplier), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_side), trade.Side), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_price), trade.Price), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_balance), trade.Balance), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_trade_type), trade.Trade_Type), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_source_type), trade.Source_Type), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_source), trade.Source), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_turn_over), trade.Turn_Over), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_front_id), trade.Front_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_session_id), trade.Session_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_local_order_id), trade.Local_Order_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_xmdm), trade.Xmdm), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_zcdy), trade.Zcdy), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_zhdm), trade.Zhdm), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_policy_id), trade.Policy_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_order_date), trade.Order_Date), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_order_id), trade.Order_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_trade_route), trade.Trade_Route), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_seat_id), trade.Seat_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_client_id), trade.Client_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_trade_date), trade.Sys_Trade_Date), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_trade_settlement_id), trade.Sys_Trade_Settlement_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_trade_id), trade.Sys_Trade_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_order_date), trade.Sys_Order_Date), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_order_settlement_id), trade.Sys_Order_Settlement_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_sys_order_id), trade.Sys_Order_Id), 
                new MySqlParameter(string.Format("@{0}", TradeRow.C_trade_time), trade.Trade_Time)
            };

            return this.ExecuteNonQuery(sql, parameters) > 0;
        }
        protected TradeRow GetTradeRow(TradeInfo_O32 row)
        {
            TradeRow info = new TradeRow();

            // 02、成交日期:
            info.Trade_Date = row.L_DATE;
            // 03、成交ID:
            info.Trade_Id = row.VC_DEAL_NO;
            // 04、证券代码:
            info.Security_Id = this.ConvertSecurityId(row);
            // 05、方向标志位:可根据平仓类型转换;
            info.Direction = this.GetDirection(row);
            // 06、数量:
            info.Volume = this.GetDouble(row.L_DEAL_AMOUNT);
            // 07、合约乘数:
            info.Multiplier = 1.0;
            // 08、多头空头状态
            info.Side = this.GetSideState(row);
            // 09、价格:
            info.Price = row.EN_DEAL_PRICE;
            // 10、金额:
            info.Balance = row.EN_DEAL_BALANCE;
            // 11、成交类型:
            info.Trade_Type = GetTradeTypeByTradeTime(row.L_BUSINESS_TIME.ToString(), 2);
            // 12、基金公司/内部融券类型
            info.Source_Type = 0;
            // 13、基金代码/账户信息
            info.Source = "";
            // 14、成交额:
            info.Turn_Over = row.EN_DEAL_BALANCE;
            // 15、前置编号:
            info.Front_Id = 0;
            // 16、会话编号:
            info.Session_Id = 0;
            // 17、本地委托编号:
            info.Local_Order_Id = "";
            // 18、项目代码:
            info.Xmdm = 0;
            // 19、资产单元:
            info.Zcdy = "";
            // 20、组合代码:
            info.Zhdm = row.VC_COMBI_NO;
            // 21、策略号:
            info.Policy_Id = 0;
            // 22、委托日期:
            info.Order_Date = row.L_DATE;
            // 23、委托编号:
            info.Order_Id = row.L_ENTRUST_SERIAL_NO != 0 ? row.L_ENTRUST_SERIAL_NO.ToString() : string.Empty;
            // 24、交易通道:
            info.Trade_Route = "";
            // 25 、经纪商席位代码:
            info.Seat_Id = row.VC_REPORT_SEAT;
            // 26、投资者客户代码:
            info.Client_Id = row.VC_STOCKHOLDER_ID;
            // 27、系统成交日期:
            info.Sys_Trade_Date = "";
            // 28、系统成交结算编号:
            info.Sys_Trade_Settlement_Id = 0;
            // 29、系统成交编号:
            info.Sys_Trade_Id = "";
            // 30、系统委托日期:
            info.Sys_Order_Date = "";
            // 31、系统委托结算编号:
            info.Sys_Order_Settlement_Id = 0;
            // 32、系统委托编号:
            info.Sys_Order_Id = "";
            // 33、成交时间:
            info.Trade_Time = row.L_BUSINESS_TIME.ToString();

            return info;
        }
Esempio n. 4
0
        protected TradeRow GetTradeRow(CilRow row)
        {
            TradeRow data = new TradeRow();

            // 02、成交日期;
            data.Trade_Date = "";
            // 03、成交编号;
            data.Trade_Id = "";
            // 04、证券代码以证券代码1为准;为了防止与深交所证券代码混淆,需要以加后缀".SH"
            data.Security_Id = this.ConvertSecurityId(row.ZQDM);

            // 02:现金替代退补款;04:赎回替代款;
            if (row.ZJLX.Equals("02"))
            {
                // 05、方向;
                data.Direction = DirectionCoding.GetDirectionCode(TradeType.TRADE_ETF_CASH_REPLACEMENT_DRAWBACK);
                // 10、成交金额;
                data.Balance = this.GetDouble(row.BKJE);
                // 14、成交额;
                data.Turn_Over = this.GetDouble(row.BKJE);
            }
            else
            {
                data.Direction = DirectionCoding.GetDirectionCode(TradeType.TRADE_ETF_RED_REPLACEMENT_DRAWBACK);
                data.Balance = this.GetDouble(row.TKJE);
                data.Turn_Over = this.GetDouble(row.TKJE);
            }

            // 06、数量暂时以成交数量为准;
            data.Volume = 1.0;
            // 07、上海合约乘数为1
            data.Multiplier = 1;
            // 08、多头空头(0表示多头,1表示空头);
            data.Side = 0;
            // 09、价格以价格1为准;
            data.Price = 0.0;
            // 11、成交类型:9:30之前为集合竞价;9:30之后为连续竞价;默认为2。
            data.Trade_Type = 2;
            // 12、基金公司/内部融券(1表示基金公司,2表示内部融券);
            data.Source_Type = 0;
            // 13、基金代码/账户信息;
            data.Source = string.Empty;
            // 15、前置编号;
            data.Front_Id = 0;
            // 16、会话编号;
            data.Session_Id = 0;
            // 17、本地委托编号;
            data.Local_Order_Id = "";
            // 18、项目代码;
            data.Xmdm = 0;
            // 19、资产单元;
            data.Zcdy = "";
            // 20、组合代码;
            data.Zhdm = "";
            // 21、策略号;
            data.Policy_Id = 0;
            // 22、委托日期;
            data.Order_Date = "";
            // 23、委托编号;
            data.Order_Id = "";
            // 24、交易通道;
            data.Trade_Route = "";
            // 25、经纪商席位代码;
            data.Seat_Id = row.JYXW;
            // 26、投资者客户代码;
            data.Client_Id = "";
            // 27、系统成交日期;
            data.Sys_Trade_Date = row.JYRQ;
            // 28、系统成交结算编号;
            data.Sys_Trade_Settlement_Id = 0;
            // 29、系统成交编号;
            data.Sys_Trade_Id = "";
            // 30、系统委托日期;
            data.Sys_Order_Date = row.JYRQ;
            // 31、系统委托结算编号;
            data.Sys_Order_Settlement_Id = 0;
            // 32、系统委托编号;
            data.Sys_Order_Id = "";
            // 33、成交时间;
            data.Trade_Time = "";

            return data;
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
        protected TradeRow GetTradeRow(JsmxRow_SH row)
        {
            TradeRow trade = new TradeRow();

            // 2、成交日期;
            trade.Trade_Date = string.Empty;
            // 3、成交编号;
            trade.Trade_Id = string.Empty;
            // 4、证券代码以证券代码1为准;为了防止与深交所证券代码混淆,需要以加后缀".SH"
            trade.Security_Id = this.ConvertSecurityId(row.ZQDM1);
            // 5、方向需要根据买卖编号进行转换(B:表示Buy;S:表示Sell);
            trade.Direction = this.GetDirectionByBS(row.MMBZ);
            // 6、数量暂时以成交数量为准;
            trade.Volume = this.GetDouble(row.CJSL);
            // 7、合约乘数为1
            trade.Multiplier = 1;
            // 8、多头空头;
            trade.Side = this.GetSideFlag(row);
            // 9、价格以价格1为准;
            trade.Price = this.GetDouble(row.JG1);
            // 10、金额以清算金额为准;
            trade.Balance = this.GetDouble(row.QSJE);
            // 11、9:30之前为集合竞价;9:30之后为连续竞价;默认为2。
            trade.Trade_Type = this.GetTradeTypeByTradeTime(row.CJSJ, 2);
            // 12、基金公司/内部融券标志位;1表示基金公司;2表示内部融券;
            trade.Source_Type = 2;
            // 13、基金代码/账户信息;
            trade.Source = string.Empty;
            // 14、成交额;
            trade.Turn_Over = trade.Balance;
            // 15、前置编号;
            trade.Front_Id = 0;
            // 16、回话编号;
            trade.Session_Id = 0;
            // 17、本地委托编号;
            trade.Local_Order_Id = string.Empty;
            // 18、项目代码;
            trade.Xmdm = 0;
            // 19、资产单元;
            trade.Zcdy = string.Empty;
            // 20、组合代码;
            trade.Zhdm = string.Empty;
            // 21、策略号;
            trade.Policy_Id = 0;
            // 22、委托日期;
            trade.Order_Date = string.Empty;
            // 23、委托编号;
            trade.Order_Id = string.Empty;
            // 24、交易通道;
            trade.Trade_Route = string.Empty;
            // 25、经纪商席位代码;
            trade.Seat_Id = string.Empty;
            // 26、投资者客户代码;
            trade.Client_Id = string.Empty;
            // 27、系统成交日期;
            trade.Sys_Trade_Date = row.JYRQ;
            // 28、系统成交结算编号;
            trade.Sys_Trade_Settlement_Id = 0;
            trade.Sys_Trade_Id = row.CJBH;
            // 29、系统成交日期;
            trade.Sys_Order_Date = row.JYRQ;
            // 30、系统委托结算编号;
            trade.Sys_Order_Settlement_Id = 0;
            // 31、系统委托编号;
            trade.Sys_Order_Id = row.WTBH;
            // 32、成交时间;
            trade.Trade_Time = row.CJSJ;

            return trade;
        }