using Muchinfo.MTPClient.Data.Helper;
using Muchinfo.MTPClient.Resources;
namespace Muchinfo.MTPClient.Data.Model.Account
{
using Muchinfo.MTPClient.Data.Enums;
using System;
///
/// 平仓单
///
public class CloseOrder : OrderBase
{
#region Fields
/// OrderOperateDisplay
/// 手续费
///
private decimal _charge;
///
/// 平仓日期
///
private DateTime _closeDate;
///
/// 平仓价
///
private decimal _closePrice;
///
/// 商品
///
private string _goods;
///
/// 持仓价
///
private decimal _holdingPrice;
///
/// 数量
///
private decimal _lot;
///
/// 建仓日期
///
private DateTime _openDate;
///
/// 买卖
///
private Direction _direction;
///
/// 建仓单号
///
private long _openOrderId;
///
/// 建仓价
///
private decimal _openPrice;
///
/// 平仓盈亏
///
private decimal _profitLoss;
///
/// 递延费
///
private decimal _interest;
///
/// 成交金额
///
private decimal _dealMoney;
///
/// 结算盈亏
///
private decimal _reckonPL;
///
/// 盈亏汇总
///
private decimal _totalProfit;
///
/// 市场名称
///
private string _marketName;
#endregion Fields
#region Properties
///
/// 获取或设置 手续费
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("Charge")]
public decimal Charge
{
get { return _charge; }
set { Set(() => Charge, ref _charge, value); }
}
///
/// 获取或设置 平仓日期
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("TradeTime")]
public DateTime CloseDate
{
get { return _closeDate; }
set { Set(() => CloseDate, ref _closeDate, value); }
}
///
/// 获取或设置 平仓价
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("TradePrice")]
public decimal ClosePrice
{
get
{
return _closePrice;
}
set
{
Set(() => ClosePrice, ref _closePrice, value);
RaisePropertyChanged(() => DisplayClosePrice);
}
}
///
/// 成交金额
///
[PropertyDisc("TradeAmount")]
public decimal TradeAmount { get; set; }
///
/// 显示格式化后平仓价
///
public string DisplayClosePrice
{
get { return this.ClosePrice.ToString(PriceFormat); }
}
///
/// 显示平仓日期
///
public string DisplayCloseDate
{
get { return _closeDate.ToString("yyyy-MM-dd HH:mm:ss"); }
}
///
/// 显示建仓日期
///
public string DisplayOpenDate
{
get { return _openDate.ToString("yyyy-MM-dd HH:mm:ss"); }
}
///
/// 获取或设置 持仓价
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("HolderPrice")]
public decimal HoldingPrice
{
get
{
return _holdingPrice;
}
set
{
Set(() => HoldingPrice, ref _holdingPrice, value);
RaisePropertyChanged(() => DisplayHoldingPrice);
}
}
///
/// 显示格式化后持仓价
///
public string DisplayHoldingPrice
{
get { return this.HoldingPrice.ToString(PriceFormat); }
}
private eListingSelectType _eSelectType = eListingSelectType.LISTINGSELECTTYPE_DELISTING;
[PropertyDisc("ListingSelectType")]
public eListingSelectType ListingSelectType
{
get
{
return _eSelectType;
}
set
{
Set(() => ListingSelectType, ref _eSelectType, value);
RaisePropertyChanged(() => DisplayListingSelectType);
}
}
public string DisplayListingSelectType
{
get
{
return ListingSelectType.Discription();
}
}
///
/// Sets and 数量
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("TradeQty")]
public decimal Lot
{
get { return _lot; }
set { Set(() => Lot, ref _lot, value); }
}
///
/// 获取或设置 建仓日期
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("OpenTime")]
public DateTime OpenDate
{
get { return _openDate; }
set { Set(() => OpenDate, ref _openDate, value); }
}
///
/// 获取或设置 建仓单号
///
public long OpenOrderId
{
get { return _openOrderId; }
set { Set(() => OpenOrderId, ref _openOrderId, value); }
}
///
/// 获取或设置 建仓价
/// Changes to that property's value raise the PropertyChanged event.
///
[PropertyDisc("OpenPrice")]
public decimal OpenPrice
{
get
{
return _openPrice;
}
set
{
Set(() => OpenPrice, ref _openPrice, value);
RaisePropertyChanged(() => DisplayOpenPrice);
}
}
///
/// 显示格式化后持仓价
///
public string DisplayOpenPrice
{
get { return this.OpenPrice.ToString(PriceFormat); }
}
///
/// 平仓盈亏
///
[PropertyDisc("ClosePL")]
public decimal ProfitLoss
{
get { return _profitLoss; }
set { Set(() => ProfitLoss, ref _profitLoss, value); }
}
///
/// 平仓盈亏
///
public string ProfitLossDisplay
{
get
{
if (ProfitLoss != 0)
{
return ProfitLoss.ToString();
}
return "-";
}
}
///
/// 显示建仓方向
///
public string StrOpenDirection
{
get
{
// return _direction.Discription();
return Direction.Discription();
//switch (OpenDirection)
//{
// case Direction.Ask:
// return Client_Resource.Infrastructure_sell;
// case Direction.Bid:
// return Client_Resource.Content_Purchase;
// default:
// return Client_Resource.Content_Purchase;
//}
}
}
///
/// 合约单位
///
[PropertyDisc("AgreeUnit")]
public decimal AgreeUnit { get; set; }
///
/// 递延费
///
public decimal Interest
{
get { return _interest; }
set { Set(() => Interest, ref _interest, value); }
}
///
/// 盈亏汇总
///
public decimal TotalProfit
{
get { return _totalProfit; }
set { Set(() => TotalProfit, ref _totalProfit, value); }
}
///
/// 委托单号
///
[PropertyDisc("Orderid")]
public ulong EntrustID { get; set; }
private string _settlementMember;
///
/// 结算类会员
///
public string SettlementMember
{
get { return _settlementMember; }
set { Set(() => SettlementMember, ref _settlementMember, value); }
}
///
///
///
[PropertyDisc("TradeId")]
public long TradeId { get; set; }
///
/// 操作类型
///
[PropertyDisc("OrderOperate")]
public eOrderOperateType OrderOperate
{
get;
set;
}
///
/// 所属机构
///
[PropertyDisc("AreaName")]
public string AreaName { get; set; }
///
/// 显示到表单中操作类型
///
public string OrderOperateDisplay
{
get
{
return OrderOperate.Discription();
}
}
#endregion Properties
///
/// 订单所属交易类型
///
[PropertyDisc("MarketType")]
public eTradeMode MarketType { get; set; }
///
/// 占用保证金
///
[PropertyDisc("UsedMargin")]
public decimal UsedMargin { get; set; }
///
/// 占用保证金[固定保留两位]
///
public string UsedMarginDisplay
{
get
{
return UsedMargin.ToString("f2");
}
}
///
/// 订单类型
///
private eOrderType _entrustOrderType;
///
/// 订单类型
///
[PropertyDisc("OrderType")]
public eOrderType EntrustOrderType
{
get { return _entrustOrderType; }
set { Set(() => EntrustOrderType, ref _entrustOrderType, value); }
}
///
/// 订单类型
///
public string OrderTypeDisc
{
get { return EntrustOrderType.Discription(); }
}
///
/// 分利积分
///
[PropertyDisc("PROFITTRANSFER")]
public decimal ProfitTransfer { get; set; }
public string ProfitTransferDispay
{
get
{
if (ProfitTransfer <= 0)
{
return "-";
}
return ProfitTransfer + string.Empty;
}
}
///
/// 是否显示积分
///
public bool IsProfitTransfer { get; set; }
}
}