示例#1
0
        private bool PO_HoldValidate_Buy(ref string strMessage)
        {
            bool result = false;

            strMessage = "GT-2419:[港股委托持久化]买持仓检查,超过持仓限制";

            int     position     = 0;
            decimal freezeAmount = 0;

            var ahtMemory = MemoryDataManager.HKHoldMemoryList.GetByAccountHoldLogoId(HoldingAccountId);

            if (ahtMemory == null)
            {
                ahtMemory = HKCommonLogic.GetHoldMemoryTable(HoldingAccount, Code, CurrencyType);
            }

            if (ahtMemory != null)
            {
                var aht = ahtMemory.Data;
                if (aht != null)
                {
                    /*update 李健华 2009-12-11===========
                     * 当程序没有加载持仓时第一次为-1,那么这里在内部从数据库获取持仓表的主键持仓账户ID时获取到了数据并加载到了内
                     * 存表中,那么这里也应把持仓账户ID附值回这里,要不然在数据库提交时会有主外键的冲突,如果不设置数据库的主外键那么
                     *这里可以不用修改,因为后面清算的时候是以委托编号去查询相关的冻结记录
                     */
                    if (HoldingAccountId == -1)
                    {
                        HoldingAccountId = aht.AccountHoldLogoID;
                    }
                    //======================
                    position     = Convert.ToInt32(aht.AvailableAmount);
                    freezeAmount = aht.FreezeAmount;
                }
            }

            if (ValidateCenter.ValidateHKMinVolumeOfBusiness(Request, position, ref strMessage))
            {
                //获取持仓限制
                Decimal pLimit = MCService.GetPositionLimit(Request.Code, Types.BreedClassTypeEnum.HKStock).PositionValue;
                //可用持仓+冻结量+委托量<持仓限制
                result = pLimit >= position + freezeAmount +
                         Convert.ToDecimal(Request.OrderAmount);
            }

            //成功时需要清空错误信息。
            if (result)
            {
                strMessage = "";
            }

            return(result);
        }
示例#2
0
        private bool PO_HoldValidate_Sell(ref string strMessage)
        {
            bool result = false;

            strMessage = "GT-2420:[港股委托持久化]卖持仓检查,无持仓";

            var ahtMemory = MemoryDataManager.HKHoldMemoryList.GetByHoldAccountAndCurrencyType(HoldingAccount, Code,
                                                                                               CurrencyType);

            if (ahtMemory == null)
            {
                ahtMemory = HKCommonLogic.GetHoldMemoryTable(HoldingAccount, Code, CurrencyType);
            }

            if (ahtMemory == null)
            {
                return(false);
            }

            var aht = ahtMemory.Data;

            if (aht == null)
            {
                return(false);
            }

            /*update 李健华 2009-12-11===========
             * 当程序没有加载持仓时第一次为-1,那么这里在内部从数据库获取持仓表的主键持仓账户ID时获取到了数据并加载到了内
             * 存表中,那么这里也应把持仓账户ID附值回这里,要不然在数据库提交时会有主外键的冲突,如果不设置数据库的主外键那么
             *这里可以不用修改,因为后面清算的时候是以委托编号去查询相关的冻结记录
             */
            if (HoldingAccountId == -1)
            {
                HoldingAccountId = aht.AccountHoldLogoID;
            }
            //======================

            strMessage = "GT-2421:[港股委托持久化]卖持仓检查,无足够可用持仓";
            int position = Convert.ToInt32(aht.AvailableAmount);

            //持仓帐户是否存在判断
            if (ValidateCenter.ValidateHKMinVolumeOfBusiness(Request, position, ref strMessage))
            {
                //已经统一使用撮合单位了
                decimal orderAmount = Convert.ToDecimal(Request.OrderAmount); // *unitMultiple;
                result = aht.AvailableAmount >= orderAmount;                  //可用持仓>=委托量
            }
            if (result)
            {
                strMessage = "";
            }
            return(result);
        }
示例#3
0
        private bool HodingCheck(HK_AccountHoldInfo hold, HK_AccountHoldInfo_Delta change)
        {
            string strMessage = "";
            bool   result     = false;

            if (Request.BuySell == Types.TransactionDirection.Buying)
            {
                strMessage = "GT-2419:[港股委托持久化]买持仓检查,超过持仓限制";
                int     position     = 0;
                decimal freezeAmount = 0;

                position     = Convert.ToInt32(hold.AvailableAmount);
                freezeAmount = hold.FreezeAmount;

                if (ValidateCenter.ValidateHKMinVolumeOfBusiness(Request, position, ref strMessage))
                {
                    //获取持仓限制
                    Decimal pLimit = MCService.GetPositionLimit(Request.Code, Types.BreedClassTypeEnum.HKStock).PositionValue;
                    //可用持仓+冻结量+委托量<持仓限制
                    result = pLimit >= position + freezeAmount + Convert.ToDecimal(Request.OrderAmount);
                }
            }
            else
            {
                strMessage = "GT-2420:[港股委托持久化]卖持仓检查,无持仓";

                if (hold != null)
                {
                    strMessage = "GT-2421:[港股委托持久化]卖持仓检查,无足够可用持仓";
                    int position = Convert.ToInt32(hold.AvailableAmount);
                    //持仓帐户是否存在判断
                    if (ValidateCenter.ValidateHKMinVolumeOfBusiness(Request, position, ref strMessage))
                    {
                        //已经统一使用撮合单位了
                        decimal orderAmount = Convert.ToDecimal(Request.OrderAmount); // *unitMultiple;
                        //可用持仓>=委托量
                        result = hold.AvailableAmount >= orderAmount;
                    }
                }
            }

            if (result)
            {
                strMessage = "";
            }
            else
            {
                holdMessage = strMessage;
            }

            return(result);
        }