Example #1
0
        public bool Redo(SpotOrder so)
        {
            if (so == null)
            {
                return(false);
            }
            if (!so.IsArrangable())
            {
                return(false);
            }
            if (so.IsArranging())
            {
                return(false);
            }
            so.State = OrderState.已撤销;
            var r = Container.Remove(so);

            so.UnFreeze();
            if (OnFinish != null)
            {
                foreach (var v in OnFinish.GetInvocationList())
                {
                    ((Action <SpotOrder>)v)(so);
                }
            }
            return(r);
        }
Example #2
0
        //TextLog log = new TextLog("jd.txt");
        void HandleCache(SpotOrder so)
        {
            so.UnFreeze();
            if (so.Direction == TradeDirectType.卖)
            {
                var ca = so.Trader.Account.CacheAccount.BtcAccount;

                //收款
                TraderService.OperateAccount(so.Trader, so.DonePrice * so.DoneCount, AccountChangeType.现金收款, so.Trader.Name, null);

                TraderService.OperateAccount(so.Trader, so.DoneCount, AccountChangeType.BTC付款, so.Trader.Name, null);
            }
            else
            {
                TraderService.OperateAccount(so.Trader, so.DoneCount * so.DonePrice, AccountChangeType.现金付款, so.Trader.Name, null);

                TraderService.OperateAccount(so.Trader, so.DoneCount, AccountChangeType.BTC收款, so.Trader.Name, null);
            }
        }