static decimal GetUnfreezeCount(this SpotOrder o, SoFreeze sof) { decimal c = o.DoneCount; if (o.State == OrderState.已撤销) { c = o.ReportCount - o.TotalDoneCount; } return(c); }
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); }
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); } } }