Esempio n. 1
0
        static decimal GetUnfreezeCount(this SpotOrder o, SoFreeze sof)
        {
            decimal c = o.DoneCount;

            if (o.State == OrderState.已撤销)
            {
                c = o.ReportCount - o.TotalDoneCount;
            }
            return(c);
        }
Esempio n. 2
0
        public static SoFreeze Freeze(this SpotOrder o)
        {
            SoFreeze f;

            if (o.Direction == TradeDirectType.卖)
            {
                f = new SoFreeze(true, true, o.ReportCount, o.Price);
            }
            else
            {
                f = new SoFreeze(false, true, o.ReportCount, o.Price);
            }
            sof.Set(o.Id, f);
            f.Execute(o);
            return(f);
        }
Esempio n. 3
0
        public static void UnFreeze(this SpotOrder o)
        {
            lock (o.Sign)
            {
                var f = sof.Get(o.Id);
                if (f == null)
                {
                    return;
                }

                var c = o.GetUnfreezeCount(f);
                if (c > 0)
                {
                    SoFreeze sf = new SoFreeze(f.IsCoin, false, c, f.Price);
                    sf.Execute(o);
                }

                if (o.CouldUnfreezeAll())
                {
                    sof.Clear(o.Id);
                }
            }
        }