- SwapEodPositionService: 删除衡泰推送残留的swapInsertEnum/swapPosiEnum赋值及fposition判空赋值块,赋值后从未读取(CS0219×2) - TradeConfirmService: if(addlog)分支仅剩三个同源死赋值(原衡泰推送调用已删),删赋值并将if/else翻转为if(!addlog),保留原else的Task.Run实时持仓刷新(CS0219×3) - QuotaMonitorService.checkTrade: 唯一存活case互换价格偏离比例恒return,删除switch后不可达收尾段(CS0162);删除从未使用的posiVal与重复的currentValue=null赋值 - YLErpWebApiHelper: 删除从未赋值/读取的私有字段baseUrl(CS0169) UnderlyingDbDataSource.DataSourceUpdated(CS0067)为IDataSourceEvent接口契约成员且DataCacheManager经接口订阅,不属死代码,保留不动。全量重编YLErpDAL通过,0警告0错误。
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using DocumentFormat.OpenXml.Spreadsheet;
|
|
using Org.BouncyCastle.Ocsp;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using YLErp.Helpers;
|
|
using YLErp.Modules.TradeRiskCalcModule;
|
|
|
|
namespace YLErp.Modules.ApiModule
|
|
{
|
|
public class YLErpWebApiHelper
|
|
{
|
|
private Func<string> tokenFunc;
|
|
private HttpHelper httpHelper;
|
|
public YLErpWebApiHelper(Func<string> tokenFunc)
|
|
{
|
|
this.tokenFunc = tokenFunc;
|
|
string ylErpWebUrl = Environment.GetEnvironmentVariable("AppSettings:YLErpWebUrl") ?? PS.Config.ErpElement.YLErpWebUrl;
|
|
httpHelper = new HttpHelper(ylErpWebUrl, tokenFunc);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询实时风险
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
public async Task<TradingRiskResult> GetTradingRisk(TradingRiskReqModel request)
|
|
{
|
|
// http 请求 Web项目接口
|
|
var result = await httpHelper.PostRequest<TradingRiskReqModel, TradingRiskResult>("/m/api/v1/realtimeRiskCalc", request);
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询实时持仓
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<IEnumerable<ExchangePositionItem>> GetExchangePositions()
|
|
{
|
|
// http 请求 Web项目接口
|
|
var result = await httpHelper.PostRequest<TradingRiskReqModel, IEnumerable<ExchangePositionItem>>("/m/api/v1/realtimeExchangePositions", null);
|
|
return result;
|
|
}
|
|
}
|
|
}
|