Handle multiple stop limits for single symbol.

This commit is contained in:
2026-02-18 21:51:02 -05:00
parent ea96097828
commit 315cf51da4
5 changed files with 65 additions and 17 deletions

View File

@@ -11,4 +11,19 @@ namespace MarketData.MarketDataModel
public String StopType{get;set;}
public int Active{get;set;}
}
public class StopLimits : List<StopLimit>
{
public StopLimits()
{
}
public StopLimits(List<StopLimit> stopLimits)
{
foreach(StopLimit stopLimit in stopLimits) Add(stopLimit);
}
public void Add(StopLimits stopLimits)
{
foreach(StopLimit stopLimit in stopLimits)this.Add(stopLimit);
}
}
}

View File

@@ -339,6 +339,30 @@ namespace MarketData.Service
}
}
public ServiceResult GetStopLimits(String symbol)
{
lock(this)
{
try
{
if(!IsNetworkAvailable())return new ServiceResult(false,"No network.");
if (!IsAuthorized()) return new ServiceResult(false,"Unauthorized.");
StringBuilder sb = new StringBuilder();
sb.Append("/api/Portfolio/GetStopLimits?").Append("token=").Append(accessToken).Append("&").Append("symbol=").Append(symbol);
String json = httpClient.GetStringAsync(sb.ToString()).Result;
if(null==json)return new ServiceResult(null);
StopLimits stopLimits = JsonConvert.DeserializeObject<StopLimits>(json);
return new ServiceResult(stopLimits);
}
catch (Exception exception)
{
exceptions.Add(exception);
Debug.WriteLine(exception.ToString());
return new ServiceResult(false,exception.ToString());
}
}
}
public ServiceResult GetPortfolioTradesWithParityPrice(String symbol)
{
lock(this)