Ejemplo n.º 1
0
        public Queryinfo SendIMSOrder(string GroupName, string BSFlag, string market, string Zqdm, float price, int qty)
        {
            Queryinfo response = null;

            lock (SendOrderObject)
            {
                StringBuilder result  = new StringBuilder(1024 * 1024);
                StringBuilder errInfo = new StringBuilder(256);
                if (Adapter.GroupsDict.ContainsKey(GroupName))
                {
                    var group = Adapter.GroupsDict[GroupName];
                    if (!Tool.IsSendOrderTimeFit())
                    {
                        errInfo.AppendFormat("下单时限为9:00-15:00, 当前时间{0}超出下单时限", DateTime.Now.ToShortDateString());
                    }
                    else if (group.ClientID > -1)
                    {
                        errInfo.AppendFormat("{0}: ClientID为-1", GroupName);
                    }
                    else
                    {
                        group.SendOrderIMS(BSFlag, market, Zqdm, price, qty, result, errInfo);
                    }
                }
                else
                {
                    errInfo.AppendFormat("下单失败,{0}:未找到该组合号对应的配置信息!", GroupName);
                }
                response = new Queryinfo()
                {
                    Result = result.ToString(), Error = errInfo.ToString()
                };
            }
            return(response);
        }
Ejemplo n.º 2
0
        public Queryinfo SendOrder(string GroupName, int Category, int PriceType, string Gddm, string Zqdm, float Price, int Quantity, string Mac)
        {
            Queryinfo response = null;

            lock (SendOrderObject)
            {
                StringBuilder result  = new StringBuilder(1024 * 1024);
                StringBuilder errInfo = new StringBuilder(256);

                if (Adapter.GroupsDict.ContainsKey(GroupName))
                {
                    var group = Adapter.GroupsDict[GroupName];
                    if (!Tool.IsSendOrderTimeFit())
                    {
                        return(new Queryinfo()
                        {
                            Error = string.Format("下单时限为9:00-15:00, 当前时间超出下单时限", DateTime.Now.ToShortTimeString())
                        });
                    }
                    else if (group.ClientID == -1)
                    {
                        return(new Queryinfo()
                        {
                            Error = string.Format("{0}: ClientID为-1", GroupName)
                        });
                    }
                    else
                    {
                        if (Zqdm.Length == 5)
                        {
                            response = group.SendOrderHK(Category, PriceType, Gddm, Zqdm, Price, Quantity, result, errInfo);
                        }
                        else
                        {
                            response = group.SendOrderNormal(Category, PriceType, Gddm, Zqdm, Price, Quantity, Mac, result, errInfo);
                        }
                    }
                }
                else
                {
                    return(new Queryinfo()
                    {
                        Error = string.Format("下单失败,{0}:未找到该组合号对应的配置信息!", GroupName)
                    });
                }
            }
            return(response);
        }
Ejemplo n.º 3
0
        public Queryinfo SendOrder(string GroupName, int Category, int PriceType, string Gddm, string Zqdm, decimal Price, decimal Quantity, string Mac)
        {
            Queryinfo response = new Queryinfo();

            lock (SendOrderObject)
            {
                //StringBuilder result = new StringBuilder(1024 * 1024);
                //StringBuilder errInfo = new StringBuilder(256);
                if (Program.db.券商帐户.Exists(GroupName))
                {
                    if (!dictMacOrderList.ContainsKey(Mac))
                    {
                        dictMacOrderList[Mac] = new ConcurrentBag <string>();
                    }
                    string result, errInfo;
                    if (!Tool.IsSendOrderTimeFit())
                    {
                        response.Error = string.Format("下单时限为9:00-15:00, 当前时间超出下单时限", DateTime.Now.ToShortTimeString());
                    }
                    else
                    {
                        Program.db.券商帐户.SendOrderLocal(GroupName, Category, Gddm, Zqdm, Price, Quantity, Mac, out result, out errInfo);
                        response.Error  = errInfo;
                        response.Result = result;
                    }
                }
                else
                {
                    return(new Queryinfo()
                    {
                        Error = string.Format("下单失败,{0}:未找到该组合号对应的配置信息!", GroupName)
                    });
                }
            }
            return(response);
        }