コード例 #1
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);
        }
コード例 #2
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);
            }
        }
コード例 #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);
            }
        }
コード例 #4
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);
        }
コード例 #5
0
 public static void SetCurPrice(this Coin c, decimal?price)
 {
     cp.Set(c, price);
 }
コード例 #6
0
 public static void SetPreTotal(this SystemAccount sa, decimal total)
 {
     bailSnap.Set("SystemAccount", total);
 }