| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847 |
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Helper;
- using Muchinfo.MTPClient.Resources;
- namespace Muchinfo.MTPClient.Data.Model.Account
- {
- using System;
- /// <summary>
- /// 持仓明细表
- /// </summary>
- public class HoldingOrder : OrderBase
- {
-
- #region Fields
-
- /// <summary>
- /// 手续费
- /// </summary>
- private decimal _charge;
- /// <summary>
- /// 平仓价
- /// </summary>
- private decimal _closePrice;
- ///// <summary>
- ///// 商品
- ///// </summary>
- //private string _goods;
- /// <summary>
- /// 持仓价
- /// </summary>
- private decimal _holdingPrice;
- /// <summary>
- /// 数量
- /// </summary>
- private decimal _lot;
- /// <summary>
- /// 建仓时间
- /// </summary>
- private DateTime _openDate;
- private Direction _openDirection;
- /// <summary>
- /// 建仓价
- /// </summary>
- private decimal _openPrice;
- /// <summary>
- /// 订单号
- /// </summary>
- private long _orderId;
- /// <summary>
- /// 浮动盈亏
- /// </summary>
- private decimal _pLFloat;
- /// <summary>
- /// 止损价
- /// </summary>
- private decimal _stopLoss;
- /// <summary>
- ///止盈价
- /// </summary>
- private decimal _stopProfit;
- /// <summary>
- /// 建仓单号
- /// </summary>
- private int _openOrder;
- /// <summary>
- /// 递延费
- /// </summary>
- private decimal _interest;
- /// <summary>
- /// 市场名称
- /// </summary>
- private string _marketName;
-
- #endregion Fields
- #region Properties
- #region Public Properties
-
- /// <summary>
- /// Sets and gets 手续费
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("Charge")]
- public decimal Charge
- {
- get { return _charge; }
- set { Set(() => Charge, ref _charge, value); }
- }
- /// <summary>
- /// 冻结头寸
- /// </summary>
- private decimal _positionFzQty;
- /// <summary>
- /// 冻结头寸
- /// </summary>
- [PropertyDisc("PositionFzQty")]
- public decimal PositionFzQty
- {
- get { return _positionFzQty; }
- set { Set(() => PositionFzQty, ref _positionFzQty, value); }
- }
- /// <summary>
- /// 所属机构
- /// </summary>
- [PropertyDisc("AreaName")]
- public string AreaName { get; set; }
- /// <summary>
- /// 合约单位
- /// </summary>
- [PropertyDisc("currentAgreeunit")]
- public int currentAgreeunit { get; set; }
-
-
- /// <summary>
- /// Sets and gets 平仓价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- public decimal ClosePrice
- {
- get
- {
- return _closePrice;
- }
- set
- {
- Set(() => ClosePrice, ref _closePrice, value);
- RaisePropertyChanged(() => DisplayClosePrice);
- }
- }
- public decimal ContrayClosePrice { get; set; }
-
- /// <summary>
- /// 格式化平仓价
- /// </summary>
- public string DisplayClosePrice
- {
- get
- {
- //if (ClosePrice > 0 && MarketType != eTradeMode.TRADEMODE_SALE)
- if (ClosePrice > 0)
- {
- return ClosePrice.ToString(PriceFormat);
- }
- else
- {
- return "-";
- }
-
- }
- }
- /// <summary>
- /// 显示建仓日期
- /// </summary>
- public string DisplayOpenDate
- {
- get
- {
- if (_openDate==DateTime.MinValue)
- {
- return "--";
- }
- return _openDate.ToString("yyyy-MM-dd HH:mm:ss");
- }
- }
- private decimal _usedMargin; //占用保证金
- /// <summary>
- /// 占用保证金
- /// </summary>
- [PropertyDisc("UsedMargin")]
- public decimal UsedMargin
- {
- get { return _usedMargin; }
- set { Set(() => UsedMargin, ref _usedMargin, value); }
- }
- /// <summary>
- /// 占用保证金[固定保留两位]
- /// </summary>
- public string UsedMarginDisplay
- {
- get
- {
- return UsedMargin.ToString("f2");
- }
- }
- /// <summary>
- /// Sets and gets 持仓价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("HolderPrice")]
- public decimal HoldingPrice
- {
- get
- {
- return _holdingPrice;
- }
- set
- {
- Set(() => HoldingPrice, ref _holdingPrice, value);
- }
- }
- /// <summary>
- /// 格式化持仓价
- /// </summary>
- public string DisplayHoldingPrice
- {
- get
- {
- return HoldingPrice.ToString(PriceFormat);
- }
- }
- /// <summary>
- /// Sets and gets 持仓 数量(包括锁仓数量).
- ///
- /// </summary>
- [PropertyDisc("Qty")]
- public decimal Lot
- {
- get { return _lot; }
- set { Set(() => Lot, ref _lot, value); }
- }
-
- /// <summary>
- /// 建仓时间
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("OpenTime")]
- public DateTime OpenDate
- {
- get { return _openDate; }
- set { Set(() => OpenDate, ref _openDate, value); }
- }
- /// <summary>HoldingMargin
- /// 显示建仓日期
- /// </summary>
- public string StrOpenDirection
- {
- get
- {
- return Direction.Discription();
- //switch (OpenDirection)
- //{
- // case Direction.Ask:
- // return Client_Resource.Domain_SellOut;
- // case Direction.Bid:
- // return Client_Resource.Model_Buyin;
- // default:
- // return Client_Resource.Model_Buyin;
- //}
- }
- }
- /// <summary>
- /// Sets and gets 建仓价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("OpenPrice")]
- public decimal OpenPrice
- {
- get { return _openPrice; }
- set { Set(() => OpenPrice, ref _openPrice, value); }
- }
- /// <summary>
- /// 显示委托价格
- /// </summary>
- public string DisplayOpenPrice
- {
- get { return OpenPrice.ToString(PriceFormat); }
- }
- /// <summary>
- /// Sets and gets the orderNumber property.
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("OrderID")]
- public long OrderID
- {
- get { return _orderId; }
- set { Set(() => OrderID, ref _orderId, value); }
- }
- /// <summary>
- /// Sets and gets 浮动盈亏
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- public decimal PLFloat
- {
- get { return _pLFloat; }
- set { Set(() => PLFloat, ref _pLFloat, value); }
- }
-
- /// <summary>
- /// Sets and gets 止损价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("SlPrice")]
- public decimal StopLoss
- {
- get { return _stopLoss; }
- set { Set(() => StopLoss, ref _stopLoss, value); }
- }
- /// <summary>
- /// 显示格式化止损价
- /// </summary>
- public string DisplayStopLoss
- {
- get
- {
- if (StopLoss == 0)
- {
- return "--";
- }
- return StopLoss.ToString(PriceFormat);
- }
- }
-
- /// <summary>
- /// Sets and gets 止盈价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("SpPrice")]
- public decimal StopProfit
- {
- get { return _stopProfit; }
- set { Set(() => StopProfit, ref _stopProfit, value); }
- }
- /// <summary>
- /// 显示格式化 止盈
- /// </summary>
- public string DisplayStopProfit
- {
- get
- {
- if (StopProfit == 0)
- {
- return "--";
- }
- return StopProfit.ToString(PriceFormat);
- }
- }
- private decimal _availQty;
- /// <summary>
- /// 可用数量
- /// </summary>
- [PropertyDisc("enableQty")]
- public decimal AvailQty
- {
- get { return _availQty; }
- set
- {
- Set(() => AvailQty, ref _availQty, value);
- }
- }
- /// <summary>
- /// 保证金金额
- /// </summary>
- private decimal _marginAccount;
- private decimal _reckonPl;
- /// <summary>
- /// 结算盈亏
- /// </summary>
- [PropertyDisc("ReckonPL")]
- public decimal ReckonPL
- {
- get { return _reckonPl; }
- set { Set(() => ReckonPL, ref _reckonPl, value); }
- }
-
-
- public TradeAccount TradeAccount
- {
- get;
- set;
- }
-
- /// <summary>
- /// 递延费
- /// </summary>
- [PropertyDisc("Interest")]
- public decimal Interest
- {
- get { return _interest; }
- set { Set(() => Interest, ref _interest, value); }
- }
- /// <summary>
- /// 成交数数量
- /// </summary>
- [PropertyDisc("TradeQty")]
- public decimal TradeQty { get; set; }
- /// <summary>
- /// 市场名称
- /// </summary>
- public string MarketName
- {
- get { return _marketName; }
- set { Set(() => MarketName, ref _marketName, value); }
- }
-
- private string _settlementMember;
- /// <summary>
- /// 特别会员ID
- /// </summary>
- public string SettlementMember
- {
- get { return _settlementMember; }
- set { Set(() => SettlementMember, ref _settlementMember, value); }
- }
- private string _settlementMemberName;
- /// <summary>
- /// 特别会员名字
- /// </summary>
- public string SettlementMemberName
- {
- get
- {
- return _settlementMemberName;
- }
- set
- {
- Set(() => SettlementMemberName, ref _settlementMemberName, value);
- }
- }
- /// <summary>
- /// 冻结数量
- /// </summary>
- //[PropertyDisc("FreezeQty")]
- //public decimal FrozenQty { get; set; }
- /// <summary>
- /// 操作类型
- /// </summary>
- public eOrderOperateType OrderOperate
- {
- get;
- set;
- }
- /// <summary>
- /// 操作员
- /// </summary>
- [PropertyDisc("OperatorId")]
- public ulong OperatorID
- {
- get;
- set;
- }
- private HoldStatus _holdStatus;
- /// <summary>
- /// 持仓金额
- /// </summary>
- [PropertyDisc("HolderAmount")]
- public decimal HoldAmount { get; set; }
- /// <summary>
- /// 锁仓的持仓金额
- /// </summary>
- [PropertyDisc("lockHolderAmount")]
- public decimal lockHolderAmount { get; set; }
- /// <summary>
- /// 建仓金额
- /// </summary>
- [PropertyDisc("TradeAmount")]
- public decimal OpenAmount { get; set; }
- /// <summary>
- /// 持仓状态
- /// </summary>
- public HoldStatus HoldStatus
- {
- get { return _holdStatus; }
- set { _holdStatus = value; }
- }
- private DateTime _tradeDate;
- /// <summary>
- /// 交易日
- /// </summary>
- public DateTime TradeDate
- {
- get { return _tradeDate; }
- set { _tradeDate = value; }
- }
- /// <summary>
- /// 账号ID
- /// </summary>
- [PropertyDisc("AccountId")]
- public ulong Accountid { get; set; }
- /// <summary>
- /// 持仓状态显示
- /// </summary>
- public string HoldStatusDisplay
- {
- get
- {
- switch (HoldStatus)
- {
- case HoldStatus.NODELIVERY:
- return "--";
- default:
- return Client_Resource.Model_DeliveryFreeze;
- }
- }
- }
- /// <summary>
- /// 显示到表单中操作类型
- /// </summary>
- public string OrderOperateDisplay
- {
- get
- {
- return OperatorID == Accountid ? Client_Resource.Model_UserPlaceOrder : Client_Resource.Model_SystemPlaceOrder;
- //switch (OrderOperate)
- //{
- // case OrderOperateType.UserOrder:
- // return Client_Resource.Model_UserPlaceOrder;
- // case OrderOperateType.SystemOrder:
- // return Client_Resource.Model_SystemPlaceOrder;
- // default:
- // return Client_Resource.Model_UserPlaceOrder;
- //}
- }
- }
- /// <summary>
- /// 关联委托单据号(平仓委托)
- /// </summary>
- [PropertyDisc("RelationTicket")]
- public long RelationTicket { get; set; }
- /// <summary>
- /// 订单所属交易类型
- /// </summary>
- [PropertyDisc("MarketType")]
- public eTradeMode MarketType { get; set; }
- /// <summary>
- /// 锁仓数量
- /// </summary>
- [PropertyDisc("LockQty")]
- public decimal LockQty { get; set; }
- /// <summary>
- /// 当前市值
- /// </summary>
- public decimal CurrentAmount { get; set; }
- private decimal _sumFloatPL;
- /// <summary>
- /// 盈亏汇总
- /// </summary>
- public decimal SumFloatPL
- {
- get { return _sumFloatPL; }
- set { Set(() => SumFloatPL, ref _sumFloatPL, value); }
- }
- /// <summary>
- /// 持仓天数
- /// </summary>
- [PropertyDisc("holderdays")]
- public int HolderDays { get; set; }
- /// <summary>
- /// /最小持仓天数
- /// </summary>
- [PropertyDisc("MinHOLDERDAYS")]
- public int MinHolderDays { get; set; }
- /// <summary>
- /// T+N 冻结
- /// </summary>
- [PropertyDisc("tnfreezeqty")]
- public decimal tnFreezeqty { get; set; }
- /// <summary>
- /// 是否可以平仓,T+N后可平仓
- /// </summary>
- public bool IsCanClose
- {
- get
- {
- return HolderDays - MinHolderDays >=0; ///持仓天数超过最小持仓天数
- }
- }
- /// <summary>
- /// 可平数量
- /// </summary>
- public decimal CloseQty
- {
- get
- {
- return IsCanClose ? AvailQty : 0;
- }
- }
- /// <summary>
- /// 显示商品最小持仓天数
- /// </summary>
- public string CloseDaysDisplay
- {
- get
- {
- return string.Format(Client_Resource.Content_ShowCloseDays, MinHolderDays);
- }
- }
- public bool IsCanButtunCloseVbs
- {
- get
- {
- //return MarketType != eTradeMode.TRADEMODE_SALE;
- return true;
- }
- }
- #region 小数位
- /// <summary>
- /// 价格小数位
- /// </summary>
- [PropertyDisc("decimalplace")]
- public int DecimalPlace { get; set; }
- public override string PriceExpFormat
- {
- get
- {
- if (DecimalPlace < 3)
- {
- return "F2";
- }
- else
- {
- return PriceFormat;
- }
- }
- }
- public override string PriceFormat
- {
- get
- {
- if (DecimalPlace > 0 && DecimalPlace < 20)
- {
- return "F" + DecimalPlace;
- }
- else
- {
- return "F2";
- }
- }
- }
- #endregion
- #endregion Public Properties
- #endregion Properties
- #region 全额持仓字段MTP2.0
- private uint _HolderQty = uint.MaxValue;
- /// <summary>
- /// 持仓数量
- /// </summary>
- public uint HolderQty
- {
- get { return _HolderQty; }
- set { _HolderQty = value; }
- }
- private uint _limitCount = uint.MaxValue;
- /// <summary>
- /// 受限数量
- /// </summary>
- public uint limitCount
- {
- get { return _limitCount; }
- set { _limitCount = value; }
- }
- private uint _FreezeQty = uint.MaxValue;
- /// <summary>
- /// 冻结数量
- /// </summary>
- public uint FreezeQty
- {
- get { return _FreezeQty; }
- set { _FreezeQty = value; }
- }
- #endregion
- #region 保证金持仓字段MTP2.0
- private uint _BuyFrozenQty = uint.MaxValue;
- /// <summary>
- /// 买持仓冻结
- /// </summary>
- public uint BuyFrozenQty
- {
- get { return _BuyFrozenQty; }
- set { _BuyFrozenQty = value; }
- }
- private uint _BuyOtherFrozenQty = uint.MaxValue;
- /// <summary>
- /// 买持仓其他冻结
- /// </summary>
- public uint BuyOtherFrozenQty
- {
- get { return _BuyOtherFrozenQty; }
- set { _BuyOtherFrozenQty = value; }
- }
- private uint _SellFrozenQty = uint.MaxValue;
- /// <summary>
- /// 卖持仓冻结
- /// </summary>
- public uint SellFrozenQty
- {
- get { return _SellFrozenQty; }
- set { _SellFrozenQty = value; }
- }
- private uint _SellOtherFrozenQty = uint.MaxValue;
- /// <summary>
- /// 卖持仓其他冻结
- /// </summary>
- public uint SellOtherFrozenQty
- {
- get { return _SellOtherFrozenQty; }
- set { _SellOtherFrozenQty = value; }
- }
- private uint _BuyCurPositionQty = uint.MaxValue;
- /// <summary>
- /// 买当前持仓数量
- /// </summary>
- public uint BuyCurPositionQty
- {
- get { return _BuyCurPositionQty; }
- set { _BuyCurPositionQty = value; }
- }
- private double _BuyCurHolderAmount = int.MinValue;
- /// <summary>
- /// 买当前持仓金额
- /// </summary>
- public double BuyCurHolderAmount
- {
- get { return _BuyCurHolderAmount; }
- set { _BuyCurHolderAmount = value; }
- }
- private uint _SellCurPositionQty = uint.MaxValue;
- /// <summary>
- /// 卖当前持仓数量
- /// </summary>
- public uint SellCurPositionQty
- {
- get { return _SellCurPositionQty; }
- set { _SellCurPositionQty = value; }
- }
- private double _SellCurHolderAmount = int.MinValue;
- /// <summary>
- /// 卖当前持仓金额
- /// </summary>
- public double SellCurHolderAmount
- {
- get { return _SellCurHolderAmount; }
- set { _SellCurHolderAmount = value; }
- }
- #endregion
- }
- }
|