| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Resources;
- namespace Muchinfo.MTPClient.Data.Model
- {
- /// <summary>
- /// 委托盘
- /// @author: yxw
- /// @time: 2014-03-13
- /// </summary>
- public class Commission
- {
- public Commission() { }
- public Commission(Direction direction)
- {
- //Price = 1;
- //Volume = 2;
- //Order = 3;
- this.Direction = direction;
- }
- public Commission(decimal price, int volume)
- {
- Price = price;
- Volume = volume;
- }
- public Direction Direction { get; set; }
- public int Index { get; set; }
- /// <summary>
- /// 价格
- /// </summary>
- public decimal Price { get; set; }
- /// <summary>
- /// 数量
- /// </summary>
- public long Volume { get; set; }
- /// <summary>
- /// 单数
- /// </summary>
- public int Order { get; set; }
- /// <summary>
- /// 昨收
- /// </summary>
- public decimal LastClose { get; set; }
- /// <summary>
- /// 显示格式化价格
- /// </summary>
- public string DisplayPrice
- {
- get
- {
- if (Price <= 0)
- {
- return "-";
- }
- else
- {
- return Price.ToString(FormatString);
- }
- }
- }
- /// <summary>
- /// 格式化字符串
- /// </summary>
- public string FormatString
- {
- get;
- set;
- }
- /// <summary>
- /// 显示成交量
- /// </summary>
- public string DisplayVolume
- {
- get
- {
- if (this.Volume <= 0)
- {
- return "-";
- }
- if (this.Volume <= 999999)
- {
- return this.Volume.ToString();
- }
- else if (this.Volume <= 9999999)
- {
- return System.Math.Round(((decimal)this.Volume / 10000), 2).ToString() + Client_Resource.Domain_TenThousand;
- }
- else if (this.Volume <= 99999999)
- {
- return System.Math.Round(((decimal)this.Volume / 10000), 0).ToString() + Client_Resource.Domain_TenThousand;
- }
- else if (this.Volume <= 99999999999)
- {
- return System.Math.Round(((decimal)this.Volume / 100000000), 2).ToString() + Client_Resource.Domain_OneHundredmillion;
- }
- else
- {
- return System.Math.Round(((decimal)this.Volume / 100000000), 0).ToString() + Client_Resource.Domain_OneHundredmillion;
- }
- }
- }
- /// <summary>
- /// 当前价格与昨收比是涨还是跌。
- /// </summary>
- public PriceStatus PriceStatus
- {
- get
- {
- if (this.Price <= 0)
- {
- return PriceStatus.equal;
- }
- if (this.Price > this.LastClose)
- {
- return PriceStatus.up;
- }
- else if (this.Price < this.LastClose)
- {
- return PriceStatus.down;
- }
- else
- {
- return PriceStatus.equal;
- }
- }
- }
- /// <summary>
- /// 比较对象是否发生更改
- /// </summary>
- /// <param name="value">The value.</param>
- /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
- public bool Equals(Commission value)
- {
- if (this.Price != value.Price)
- {
- return false;
- }
- if (this.Volume != value.Volume)
- {
- return false;
- }
- if (this.Order != value.Order)
- {
- return false;
- }
- return true;
- }
- public string IndexChinese
- {
- get
- {
- switch (this.Index)
- {
- case 1:
- return Client_Resource.Model_One;
- case 2:
- return Client_Resource.Model_Two;
- case 3:
- return Client_Resource.Model_Three;
- case 4:
- return Client_Resource.Model_Four;
- case 5:
- return Client_Resource.Model_Five;
- default:
- return Client_Resource.Model_Zero;
- }
- }
- }
- /// <summary>
- /// 显示五档标题
- /// </summary>
- public string DisplayOrder
- {
- get
- {
- return string.Format("{0}{1}",
- Direction == Direction.Bid ? Client_Resource.Text_Buy : Client_Resource.Text_Sell, IndexChinese);
- }
- }
- public PriceLevel PriceLevel
- {
- get
- {
- if (Index == 1)
- {
-
- }
- return PriceLevel.AnOthers;
- }
- }
- }
- /// <summary>
- /// 价格状态
- /// </summary>
- public enum PriceStatus
- {
- up=0,
- equal=1,
- down=2,
- }
- /// <summary>
- /// 價格档案
- /// </summary>
- public enum PriceLevel
- {
- Ask1=1,
- Bid1=2,
- AnOthers=3,
-
- }
- public class EntructInfo
- {
- /// <summary>
- /// 委托账号
- /// </summary>
- public string AccountCode { get; set; }
- /// <summary>
- /// 委托数量
- /// </summary>
- public string Qty { get; set; }
- /// <summary>
- /// 显示的账号
- /// </summary>
- public string AccountDisplay
- {
- get
- {
- var result = "****";
- var str = AccountCode ;
- if (str.Length <= 4)
- {
- return result;
- }
- else
- {
- var tem = str.Substring(2, str.Length - 4);
- return str.Replace(tem, result);
- }
- }
- }
- }
- /// <summary>
- /// 显示大力士方式
- /// </summary>
- public enum QueueShowType
- {
- /// <summary>
- /// 不显示
- /// </summary>
- None=0,
- /// <summary>
- /// 竞价
- /// </summary>
- Bid=1,
- /// <summary>
- /// 混合显示
- /// </summary>
- BidMake=2,
- /// <summary>
- /// 竞价,混合显示
- /// </summary>
- All=3
- }
- }
|