Files
marketdata/MarketDataLib/Generator/MGSHMomentum/MGSHPricingException.cs
2026-02-19 09:13:15 -05:00

67 lines
2.2 KiB
C#

using MarketData.Utils;
using System;
using System.Collections.Generic;
namespace MarketData.Generator.MGSHMomentum
{
public class MGSHPricingExceptions:List<MGSHPricingException>
{
public NVPCollections ToNVPCollections()
{
NVPCollections nvpCollections=new NVPCollections();
foreach(MGSHPricingException pricingException in this)
{
nvpCollections.Add(pricingException.ToNVPCollection());
}
return nvpCollections;
}
public static MGSHPricingExceptions FromNVPCollections(NVPCollections nvpCollections)
{
MGSHPricingExceptions pricingExcpetions=new MGSHPricingExceptions();
foreach(NVPCollection nvpCollection in nvpCollections)
{
pricingExcpetions.Add(MGSHPricingException.FromNVPCollection(nvpCollection));
}
return pricingExcpetions;
}
public void AddFromNVPCollection(NVPCollection nvpCollection)
{
Add(MGSHPricingException.FromNVPCollection(nvpCollection));
}
}
public class MGSHPricingException
{
public MGSHPricingException()
{
}
public MGSHPricingException(MGSHPricingException pricingException)
{
this.Symbol=pricingException.Symbol;
this.ExceptionCount=pricingException.ExceptionCount;
}
public MGSHPricingException(String symbol,int exceptionCount)
{
this.Symbol=symbol;
this.ExceptionCount=exceptionCount;
}
public String Symbol { get; set; }
public int ExceptionCount { get; set; }
public virtual NVPCollection ToNVPCollection()
{
NVPCollection nvpCollection=new NVPCollection();
nvpCollection.Add(new NVP("Symbol",Symbol.ToString()));
nvpCollection.Add(new NVP("ExceptionCount",ExceptionCount.ToString()));
return nvpCollection;
}
public static MGSHPricingException FromNVPCollection(NVPCollection nvpCollection)
{
MGSHPricingException pricingException=new MGSHPricingException();
NVPDictionary nvpDictionary=nvpCollection.ToDictionary();
pricingException.Symbol=nvpDictionary["Symbol"].Get<String>();
pricingException.ExceptionCount=nvpDictionary["ExceptionCount"].Get<int>();
return pricingException;
}
}
}