Handle multiple stop limits for single symbol.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user