/// <summary> /// 获取股票持仓 /// </summary> /// <returns></returns> private List <TradingAccount.StockHolderInfo> GetStocks() { GetStockPositionRequest t = new GetStockPositionRequest { branch_no = this.resAccountInfo.branch_no, custid = this.resAccountInfo.fund_account, fund_account = this.resAccountInfo.fund_account, op_branch_no = this.resAccountInfo.branch_no, op_station = this.resAccountInfo.op_station, password = this.resAccountInfo.trdpwd, uid = this.resAccountInfo.uid }; GetStockPositionResp result = getResp <GetStockPositionResp, GetStockPositionRequest>(t); //string str2 = StockUtil.Base64Encode(URLHelper.GetDataWithOutEncode<GetStockPositionRequest>(t), this.encoding); //string positionUrl = "https://tradegw.htsc.com.cn/?" + str2; //string respStr = this.httpClient.DownloadString(positionUrl); //GetStockPositionResp result = JsonConvert.DeserializeObject<GetStockPositionResp>(StockUtil.Base64Decode(respStr, this.GB2312)); List <TradingAccount.StockHolderInfo> list = new List <TradingAccount.StockHolderInfo>(); foreach (GetStockPositionResp.GetStockPositionRespItem si in result.Item) { if (si.stock_code != null) { TradingAccount.StockHolderInfo shi = new TradingAccount.StockHolderInfo { StockAccount = si.stock_account, StockCode = si.stock_code, StockName = si.stock_name, ExchangeName = si.exchange_name, MarketValue = (decimal)si.market_value, CostPrice = (decimal)si.cost_price, CurrentAmount = (int)si.current_amount, EnableAmount = (int)si.enable_amount, IncomeBalance = (decimal)si.income_balance, KeepCostPrice = (decimal)si.keep_cost_price, LastPrice = (decimal)si.last_price }; list.Add(shi); } } return(list); }
/// <summary> /// 获取股票持仓 /// </summary> /// <returns></returns> private List <StockHolderInfo> GetStocks() { GetStockPositionRequest t = new GetStockPositionRequest { branch_no = this.resAccountInfo.branch_no, custid = this.resAccountInfo.fund_account, fund_account = this.resAccountInfo.fund_account, op_branch_no = this.resAccountInfo.branch_no, op_station = this.resAccountInfo.op_station, password = this.resAccountInfo.trdpwd, uid = this.resAccountInfo.uid }; GetStockPositionResp result = getResp <GetStockPositionResp, GetStockPositionRequest>(t); List <StockHolderInfo> list = new List <StockHolderInfo>(); foreach (GetStockPositionResp.GetStockPositionRespItem si in result.Item) { if (si.stock_code != null) { StockHolderInfo shi = new StockHolderInfo { StockAccount = si.stock_account, StockCode = si.stock_code, StockName = si.stock_name, ExchangeName = si.exchange_name, MarketValue = si.market_value, CostPrice = si.cost_price, CurrentAmount = si.current_amount, EnableAmount = si.enable_amount, IncomeAmount = si.income_balance, KeepCostPrice = si.keep_cost_price, LastPrice = si.last_price }; list.Add(shi); } } return(list); }