| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using MuchInfo.Chart.Data.EnumTypes;
- using System;
- using System.Collections.Generic;
- namespace MuchInfo.Chart.Data.Models
- {
- /// <summary>
- /// 商品信息类
- /// </summary>
- public class GoodsInfo
- {
- #region Constructors
- /// <summary>
- /// 初始化商品信息实例
- /// </summary>
- /// <param name="exchangeCode">交易所代码</param>
- /// <param name="goodsCode">商品代码</param>
- /// <param name="goodsType">商品类型</param>
- /// <param name="preClose">昨日收盘价</param>
- /// <param name="openCloseTimes">结算计划</param>
- /// <param name="minUnit">报价小数位数</param>
- public GoodsInfo(int exchangeCode, string goodsCode, GoodsType goodsType, float preClose, List<OpenCloseTime> openCloseTimes, int minUnit)
- {
- this.ExchangeCode = exchangeCode;
- this.GoodsCode = goodsCode;
- this.GoodsType = goodsType;
- this.PreClose = preClose;
- this.OpenCloseTimes = openCloseTimes ?? new List<OpenCloseTime>(){new OpenCloseTime()
- {
- OpenTime = DateTime.Now.Date,
- CloseTime = DateTime.Now.Date.AddHours(24).AddSeconds(-1),
- }};
- this.MinUnit = minUnit;
- }
- #endregion Constructors
- #region Properties
- #region Public Properties
- /// <summary>
- /// 商品显示名
- /// </summary>
- public string DisplayName
- {
- get;
- set;
- }
- /// <summary>
- /// 交易所代码
- /// </summary>
- public int ExchangeCode
- {
- get;
- set;
- }
- /// <summary>
- /// 商品代码
- /// </summary>
- public string GoodsCode
- {
- get;
- set;
- }
- /// <summary>
- /// 商品类型
- /// </summary>
- public GoodsType GoodsType
- {
- get;
- set;
- }
- /// <summary>
- /// 收盘时间对集合-给分时线用
- /// </summary>
- public List<OpenCloseTime> OpenCloseTimes
- {
- get;
- set;
- }
- /// <summary>
- /// 昨日收盘价-给分时线用
- /// </summary>
- public float PreClose
- {
- get;
- set;
- }
- /// <summary>
- /// 报价小数位数
- /// </summary>
- public int MinUnit
- {
- get;
- set;
- }
- #endregion Public Properties
- #region Internal Properties
- /// <summary>
- /// 商品标识
- /// </summary>
- public string Symbol
- {
- get
- {
- //统一使用此格式,包括行情组件,图表组件,统一客户端及各服务
- return ExchangeCode.ToString().PadLeft(3, ' ') + GoodsCode.PadLeft(6, ' ');
- }
- }
- public string DisplaySymbol
- {
- get
- {
- var symbol = ExchangeCode + GoodsCode.Trim();
- return string.IsNullOrEmpty(DisplayName) ? "(" + symbol + ")" : ("(" + DisplayName + "-" + symbol + ")");
- }
- }
- #endregion Internal Properties
- #endregion Properties
- }
- /// <summary>
- /// 开收盘时间对
- /// </summary>
- public class OpenCloseTime
- {
- #region Properties
- #region Public Properties
- /// <summary>
- /// 收盘时间
- /// </summary>
- public DateTime CloseTime
- {
- get;
- set;
- }
- /// <summary>
- /// 开盘时间
- /// </summary>
- public DateTime OpenTime
- {
- get;
- set;
- }
- #endregion Public Properties
- #endregion Properties
- }
- }
|