从山证v2.3.0拷贝

This commit is contained in:
吴方海
2024-05-09 14:06:26 +08:00
parent 566ff33259
commit f9d8a256a6
4471 changed files with 1203456 additions and 9 deletions
@@ -0,0 +1,56 @@
namespace YLErp.Modules.DataProviderModule
{
/// <summary>
/// 场内数据信息提供
/// </summary>
public static class ExchangeOptionDataProvider
{
/// <summary>
/// 尝试获取场内期权过期日
/// </summary>
public static bool TryGetMaturityDate(string optionCode, out DateTime date)
{
date = DateTime.MinValue;
if (string.IsNullOrEmpty(optionCode))
{
return false;
}
var data = DataCacheProvider.GetExchangeListOptionDataSource().GetData(optionCode);
if (data == null)
{
return false;
}
date = data.MaturityDate;
return true;
}
/// <summary>
/// 尝试获取行情价格
/// </summary>
public static bool TryGetPrice(string optionCode, out double price)
{
price = 0;
if (string.IsNullOrWhiteSpace(optionCode))
{
return false;
}
var data = DataCacheProvider.GetExchangeListOptionDataSource().GetData(optionCode);
if (data == null)
{
return false;
}
price = data.Price ?? 0;
return true;
}
}
}