StockSharp
184 строки · 4.7 Кб
1#region S# License
2/******************************************************************************************
3NOTICE!!! This program and source code is owned and licensed by
4StockSharp, LLC, www.stocksharp.com
5Viewing or use of this code requires your acceptance of the license
6agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
7Removal of this comment is a violation of the license agreement.
8
9Project: StockSharp.BusinessEntities.BusinessEntities
10File: News.cs
11Created: 2015, 11, 11, 2:32 PM
12
13Copyright 2010 by StockSharp, LLC
14*******************************************************************************************/
15#endregion S# License
16namespace StockSharp.BusinessEntities
17{
18using System;
19using System.ComponentModel.DataAnnotations;
20using System.Runtime.Serialization;
21
22using Ecng.ComponentModel;
23
24using StockSharp.Messages;
25using StockSharp.Localization;
26
27/// <summary>
28/// News.
29/// </summary>
30[Serializable]
31[DataContract]
32[Display(
33ResourceType = typeof(LocalizedStrings),
34Name = LocalizedStrings.NewsKey,
35Description = LocalizedStrings.NewsDescKey)]
36public class News : NotifiableObject
37{
38/// <summary>
39/// News ID.
40/// </summary>
41[DataMember]
42[Display(
43ResourceType = typeof(LocalizedStrings),
44Name = LocalizedStrings.IdKey,
45Description = LocalizedStrings.NewsIdKey,
46GroupName = LocalizedStrings.GeneralKey)]
47public string Id { get; set; }
48
49/// <summary>
50/// Exchange board for which the news is published.
51/// </summary>
52[DataMember]
53[Display(
54ResourceType = typeof(LocalizedStrings),
55Name = LocalizedStrings.BoardKey,
56Description = LocalizedStrings.ElectronicBoardDescKey,
57GroupName = LocalizedStrings.GeneralKey)]
58public ExchangeBoard Board { get; set; }
59
60/// <summary>
61/// Security, for which news have been published.
62/// </summary>
63[DataMember]
64[Display(
65ResourceType = typeof(LocalizedStrings),
66Name = LocalizedStrings.SecurityKey,
67Description = LocalizedStrings.NewsSecurityKey,
68GroupName = LocalizedStrings.GeneralKey)]
69public Security Security { get; set; }
70
71/// <summary>
72/// News source.
73/// </summary>
74[DataMember]
75[Display(
76ResourceType = typeof(LocalizedStrings),
77Name = LocalizedStrings.SourceKey,
78Description = LocalizedStrings.NewsSourceKey,
79GroupName = LocalizedStrings.GeneralKey)]
80public string Source { get; set; }
81
82/// <summary>
83/// Header.
84/// </summary>
85[DataMember]
86[Display(
87ResourceType = typeof(LocalizedStrings),
88Name = LocalizedStrings.HeaderKey,
89Description = LocalizedStrings.HeaderKey + LocalizedStrings.Dot,
90GroupName = LocalizedStrings.GeneralKey)]
91public string Headline { get; set; }
92
93private string _story;
94
95/// <summary>
96/// News text.
97/// </summary>
98[DataMember]
99[Display(
100ResourceType = typeof(LocalizedStrings),
101Name = LocalizedStrings.TextKey,
102Description = LocalizedStrings.NewsTextKey,
103GroupName = LocalizedStrings.GeneralKey)]
104public string Story
105{
106get => _story;
107set
108{
109_story = value;
110NotifyChanged();
111}
112}
113
114/// <summary>
115/// Time of news arrival.
116/// </summary>
117[DataMember]
118[Display(
119ResourceType = typeof(LocalizedStrings),
120Name = LocalizedStrings.TimeKey,
121Description = LocalizedStrings.NewsTimeKey,
122GroupName = LocalizedStrings.GeneralKey)]
123public DateTimeOffset ServerTime { get; set; }
124
125/// <summary>
126/// News received local time.
127/// </summary>
128[DataMember]
129[Display(
130ResourceType = typeof(LocalizedStrings),
131Name = LocalizedStrings.LocalTimeKey,
132Description = LocalizedStrings.LocalTimeDescKey,
133GroupName = LocalizedStrings.GeneralKey)]
134public DateTimeOffset LocalTime { get; set; }
135
136/// <summary>
137/// News link in the internet.
138/// </summary>
139[DataMember]
140[Display(
141ResourceType = typeof(LocalizedStrings),
142Name = LocalizedStrings.LinkKey,
143Description = LocalizedStrings.NewsLinkKey,
144GroupName = LocalizedStrings.GeneralKey)]
145//[Url]
146public string Url { get; set; }
147
148/// <summary>
149/// News priority.
150/// </summary>
151[DataMember]
152[Display(
153ResourceType = typeof(LocalizedStrings),
154Name = LocalizedStrings.PriorityKey,
155Description = LocalizedStrings.NewsPriorityKey,
156GroupName = LocalizedStrings.GeneralKey)]
157public NewsPriorities? Priority { get; set; }
158
159/// <summary>
160/// Language.
161/// </summary>
162[DataMember]
163public string Language { get; set; }
164
165/// <summary>
166/// Expiration date.
167/// </summary>
168[DataMember]
169public DateTimeOffset? ExpiryDate { get; set; }
170
171/// <summary>
172/// Sequence number.
173/// </summary>
174/// <remarks>Zero means no information.</remarks>
175[DataMember]
176public long SeqNum { get; set; }
177
178/// <inheritdoc />
179public override string ToString()
180{
181return $"{ServerTime} {Headline} {Story} {Source}";
182}
183}
184}