using Muchinfo.MTPClient.Data.Enums;
using Muchinfo.MTPClient.Resources;
namespace Muchinfo.MTPClient.Data.Model
{
///
/// 委托盘
/// @author: yxw
/// @time: 2014-03-13
///
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; }
///
/// 价格
///
public decimal Price { get; set; }
///
/// 数量
///
public long Volume { get; set; }
///
/// 单数
///
public int Order { get; set; }
///
/// 昨收
///
public decimal LastClose { get; set; }
///
/// 显示格式化价格
///
public string DisplayPrice
{
get
{
if (Price <= 0)
{
return "-";
}
else
{
return Price.ToString(FormatString);
}
}
}
///
/// 格式化字符串
///
public string FormatString
{
get;
set;
}
///
/// 显示成交量
///
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;
}
}
}
///
/// 当前价格与昨收比是涨还是跌。
///
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;
}
}
}
///
/// 比较对象是否发生更改
///
/// The value.
/// true if XXXX, false otherwise.
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;
}
}
}
///
/// 显示五档标题
///
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;
}
}
}
///
/// 价格状态
///
public enum PriceStatus
{
up=0,
equal=1,
down=2,
}
///
/// 價格档案
///
public enum PriceLevel
{
Ask1=1,
Bid1=2,
AnOthers=3,
}
public class EntructInfo
{
///
/// 委托账号
///
public string AccountCode { get; set; }
///
/// 委托数量
///
public string Qty { get; set; }
///
/// 显示的账号
///
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);
}
}
}
}
///
/// 显示大力士方式
///
public enum QueueShowType
{
///
/// 不显示
///
None=0,
///
/// 竞价
///
Bid=1,
///
/// 混合显示
///
BidMake=2,
///
/// 竞价,混合显示
///
All=3
}
}