StockSharp

Форк
0
163 строки · 4.3 Кб
1
#region S# License
2
/******************************************************************************************
3
NOTICE!!!  This program and source code is owned and licensed by
4
StockSharp, LLC, www.stocksharp.com
5
Viewing or use of this code requires your acceptance of the license
6
agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
7
Removal of this comment is a violation of the license agreement.
8

9
Project: StockSharp.BusinessEntities.BusinessEntities
10
File: MyTrade.cs
11
Created: 2015, 11, 11, 2:32 PM
12

13
Copyright 2010 by StockSharp, LLC
14
*******************************************************************************************/
15
#endregion S# License
16
namespace StockSharp.BusinessEntities
17
{
18
	using System;
19
	using System.ComponentModel;
20
	using System.ComponentModel.DataAnnotations;
21
	using System.Runtime.Serialization;
22

23
	using Ecng.Common;
24
	using Ecng.ComponentModel;
25

26
	using StockSharp.Localization;
27

28
	/// <summary>
29
	/// Own trade.
30
	/// </summary>
31
	[Serializable]
32
	[DataContract]
33
	[Display(
34
		ResourceType = typeof(LocalizedStrings),
35
		Name = LocalizedStrings.OwnTradeKey,
36
		Description = LocalizedStrings.OwnTradeDescKey)]
37
	public class MyTrade : NotifiableObject
38
	{
39
		/// <summary>
40
		/// Initializes a new instance of the <see cref="MyTrade"/>.
41
		/// </summary>
42
		public MyTrade()
43
		{
44
		}
45

46
		/// <summary>
47
		/// Order, for which a trade was filled.
48
		/// </summary>
49
		[DataMember]
50
		[TypeConverter(typeof(ExpandableObjectConverter))]
51
		[Display(
52
			ResourceType = typeof(LocalizedStrings),
53
			Name = LocalizedStrings.OrderKey,
54
			Description = LocalizedStrings.OwnTradeOrderKey,
55
			GroupName = LocalizedStrings.GeneralKey,
56
			Order = 0)]
57
		public Order Order { get; set; }
58

59
		/// <summary>
60
		/// Trade info.
61
		/// </summary>
62
		[DataMember]
63
		[TypeConverter(typeof(ExpandableObjectConverter))]
64
		[Display(
65
			ResourceType = typeof(LocalizedStrings),
66
			Name = LocalizedStrings.TradeKey,
67
			Description = LocalizedStrings.TickTradeInfoKey,
68
			GroupName = LocalizedStrings.GeneralKey,
69
			Order = 1)]
70
#pragma warning disable CS0618 // Type or member is obsolete
71
		public Trade Trade { get; set; }
72
#pragma warning restore CS0618 // Type or member is obsolete
73

74
		/// <summary>
75
		/// Commission.
76
		/// </summary>
77
		[DataMember]
78
		[Display(
79
			ResourceType = typeof(LocalizedStrings),
80
			Name = LocalizedStrings.CommissionKey,
81
			Description = LocalizedStrings.CommissionDescKey,
82
			GroupName = LocalizedStrings.StatisticsKey,
83
			Order = 0)]
84
		public decimal? Commission { get; set; }
85

86
		/// <summary>
87
		/// Commission currency. Can be <see langword="null"/>.
88
		/// </summary>
89
		public string CommissionCurrency { get; set; }
90

91
		/// <summary>
92
		/// Slippage in trade price.
93
		/// </summary>
94
		[DataMember]
95
		[Display(
96
			ResourceType = typeof(LocalizedStrings),
97
			Name = LocalizedStrings.SlippageKey,
98
			Description = LocalizedStrings.SlippageTradeKey,
99
			GroupName = LocalizedStrings.StatisticsKey,
100
			Order = 1)]
101
		public decimal? Slippage { get; set; }
102

103
		private decimal? _pnL;
104

105
		/// <summary>
106
		/// The profit, realized by trade.
107
		/// </summary>
108
		[DataMember]
109
		[Display(
110
			ResourceType = typeof(LocalizedStrings),
111
			Name = LocalizedStrings.PnLKey,
112
			Description = LocalizedStrings.PnLKey + LocalizedStrings.Dot,
113
			GroupName = LocalizedStrings.StatisticsKey,
114
			Order = 2)]
115
		public decimal? PnL
116
		{
117
			get => _pnL;
118
			set
119
			{
120
				if (_pnL == value)
121
					return;
122

123
				_pnL = value;
124
				NotifyChanged();
125
			}
126
		}
127

128
		/// <summary>
129
		/// The position, generated by trade.
130
		/// </summary>
131
		[DataMember]
132
		[Display(
133
			ResourceType = typeof(LocalizedStrings),
134
			Name = LocalizedStrings.PositionKey,
135
			Description = LocalizedStrings.PositionKey + LocalizedStrings.Dot,
136
			GroupName = LocalizedStrings.StatisticsKey,
137
			Order = 2)]
138
		public decimal? Position { get; set; }
139

140
		/// <summary>
141
		/// Used to identify whether the order initiator is an aggressor or not in the trade.
142
		/// </summary>
143
		[Display(
144
			ResourceType = typeof(LocalizedStrings),
145
			Name = LocalizedStrings.InitiatorKey,
146
			Description = LocalizedStrings.InitiatorTradeKey,
147
			GroupName = LocalizedStrings.GeneralKey,
148
			Order = 3)]
149
		public bool? Initiator { get; set; }
150

151
		/// <summary>
152
		/// Yield.
153
		/// </summary>
154
		[DataMember]
155
		public decimal? Yield { get; set; }
156

157
		/// <inheritdoc />
158
		public override string ToString()
159
		{
160
			return LocalizedStrings.TradeFromOrder.Put(Trade, Order);
161
		}
162
	}
163
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.