Ejemplo n.º 1
0
        /// <summary>
        /// 每分钟下单量不能超过限制份数
        /// </summary>
        /// <param name="t"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool CheckLimitPerMin(this Trader t, Order o)
        {
            try
            {
                if (o.IsBySystem)
                {
                    return(true);
                }
                var l = l100.Get(t);
                if (l == null)
                {
                    l = new Limit100();
                    l100.Set(t, l);
                }
                var b = (l.CountInPast + o.ReportCount) < OrderPreHandler.CountPerMinuteLimit;
                if (b)
                {
                    l.Put(o.ReportCount);
                }
                return(b);
            }
            catch (Exception e)
            {
                Singleton <TextLog> .Instance.Error(e, "CheckLimitPerMin");

                return(false);
            }
        }
Ejemplo n.º 2
0
        public static List <SpotOrder> GetSpotOrders(this Trader t)
        {
            var sl = sos.Get(t);

            if (sl == null)
            {
                sl = new List <SpotOrder>();
                sos.Set(t, sl);
            }
            // return sos.Get(t);
            return(sl);
        }
Ejemplo n.º 3
0
        static void t_OnBailChanged(Trader arg1, decimal arg2)
        {
            if (arg1.Id < 1)
            {
                return;
            }
            var old   = curMaintainRatio.Get(arg1);
            var ratio = arg1.GetMaintainRatio(market);

            if (old != ratio)
            {
                curMaintainRatio.Set(arg1, ratio);
                arg1.RaiseRatioChanged(ratio);
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
0
 public static decimal GetCurPrice(this Coin c)
 {
     return(cp.Get(c) ?? 0);
 }
Ejemplo n.º 6
0
 public static decimal GetPreTotal(this SystemAccount sa)
 {
     return(bailSnap.Get("SystemAccount"));
 }