public Result Transfer(Transfer model) { string[] keys = TradeRA.KeySearch("D_" + model.deal_no + "_*_U_0"); if (keys.Length > 0 && TradeRA.KeyExists("U_" + model.unit_id)) { Deal deal = DealRA.Get(keys[0]); if (deal.type_enum == OrderTypeEnum.Sell) { int sellable_count = PositionRA.GetSellable(model.unit_id, deal.code, deal.account_id); if (deal.count > sellable_count) { return(Result(ApiResultEnum.Order_Account_Negative_Position)); } } deal.unit_id = model.unit_id; DealRA.UpdateUnit(model.unit_id, keys[0]); TradeRA.KeyRename(keys[0], keys[0].Substring(0, keys[0].Length - 1) + model.unit_id); TradeBiz.NewDeal(deal, deal.price, 1); return(Result(ApiResultEnum.Success)); } return(Result(ApiResultEnum.Failed)); }