| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- using System.Collections.Generic;
- using System.Windows.Documents;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Helper;
- using System;
- namespace Muchinfo.MTPClient.Data.Model.Account
- {
- public class HoldingSummaryNew : OrderBase
- {
- [PropertyDisc("AccountID")]
- public ulong AccountId
- {
- get;
- set;
- }
- /// <summary>
- /// 期初持仓数量
- /// </summary>
- private decimal _positionQty;
- /// <summary>
- /// 期初持仓数量
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("PositionQty")]
- public decimal PositionQty
- {
- get { return _positionQty; }
- set { Set(() => PositionQty, ref _positionQty, value); }
- }
- /// <summary>
- /// 期初持仓总金额
- /// </summary>
- private decimal _holderAmount;
- /// <summary>
- /// 期初持仓总金额
- /// </summary>
- [PropertyDisc("HolderAmount")]
- public decimal HolderAmount
- {
- get{ return _holderAmount; }
- set { Set(() => HolderAmount, ref _holderAmount, value); }
- }
- /// <summary>
- /// 当前持仓数量
- /// </summary>
- private decimal _curPositionQty;
- /// <summary>
- /// 当前持仓数量
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("CurPositionQty")]
- public decimal CurPositionQty
- {
- get { return _curPositionQty; }
- set
- {
- Set(() => CurPositionQty, ref _curPositionQty, value);
- RaisePropertyChanged(() => AvailQty);
- }
- }
- private decimal _availQty;
- public decimal AvailQty
- {
- get
- {
- _availQty=_curPositionQty - _frozenQty - _otherFrozenQty;
- return _availQty;
- }
- set { Set(() => AvailQty, ref _availQty, value); }
- }
- /// <summary>
- /// 当前持仓总金额
- /// </summary>
- private decimal _curHolderAmount;
- /// <summary>
- /// 当前持仓总金额
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("CurHolderAmount")]
- public decimal CurHolderAmount
- {
- get { return _curHolderAmount; }
- set
- {
- Set(() => CurHolderAmount, ref _curHolderAmount, value);
- RaisePropertyChanged(() => GoodsPaymentDisplay);
- RaisePropertyChanged(() => ProfitPercen);
- }
- }
- /// <summary>
- /// 持仓冻结数量
- /// </summary>
- private decimal _frozenQty;
- /// <summary>
- /// 持仓冻结数量
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- [PropertyDisc("FrozenQty")]
- public decimal FrozenQty
- {
- get { return _frozenQty; }
- set
- {
- Set(() => FrozenQty, ref _frozenQty, value);
- RaisePropertyChanged(() => AvailQty);
- }
- }
- /// <summary>
- /// 其他冻结数量
- /// </summary>
- private decimal _otherFrozenQty;
- /// <summary>
- /// 其他冻结数量
- /// </summary>
- [PropertyDisc("OtherFrozenQty")]
- public decimal OtherFrozenQty
- {
- get { return _otherFrozenQty; }
- set
- {
- Set(() => OtherFrozenQty, ref _otherFrozenQty, value);
- RaisePropertyChanged(() => AvailQty);
- }
- }
- private decimal _openReqQty;
- [PropertyDisc("OpenReqQty")]
- public decimal OpenReqQty
- {
- get { return _openReqQty; }
- set { Set(() => OpenReqQty, ref _openReqQty, value); }
- }
- private decimal _openTotalQty;
- [PropertyDisc("OpenTotalQty")]
- public decimal OpenTotalQty
- {
- get { return _openTotalQty; }
- set { Set(() => OpenTotalQty, ref _openTotalQty, value); }
- }
- private decimal _closeTotalQty;
- [PropertyDisc("CloseTotalQty")]
- public decimal CloseTotalQty
- {
- get { return _closeTotalQty; }
- set { Set(() => CloseTotalQty, ref _closeTotalQty, value); }
- }
- /// <summary>
- /// 持仓均价
- /// </summary>
- private decimal _holdingAVGPrice;
- /// <summary>
- /// 获取或设置 持仓均价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- public decimal HoldingAVGPrice
- {
- get { return _holdingAVGPrice; }
- set
- {
- Set(() => HoldingAVGPrice, ref _holdingAVGPrice, value);
- RaisePropertyChanged(() => DisplayHoldingAVGPrice);
- }
- }
- /// <summary>
- /// 显示持仓均价
- /// </summary>
- public string DisplayHoldingAVGPrice
- {
- get
- {
- if (HoldingAVGPrice > 0)
- {
- return HoldingAVGPrice.ToString(PriceExpFormat);
- }
- else
- {
- return "-";
- }
- }
- }
- [PropertyDisc("AgreeUnit")]
- public decimal AgreeUnit { get; set; }
-
- /// <summary>
- /// 交割标志
- /// </summary>
- [PropertyDisc("DeliveryFlag")]
- public eDeliveryFlag DeliveryFlag
- {
- get;
- set;
- }
- public string StrOpenDirection
- {
- get
- {
- return Direction.Discription();
- }
- }
- /// <summary>
- /// 最新价
- /// </summary>
- private decimal _latestPrice;
- /// <summary>
- /// 获取或设置 最新价
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- public decimal LatestPrice
- {
- get
- {
- return _latestPrice;
- }
- set
- {
- Set(() => LatestPrice, ref _latestPrice, value);
- RaisePropertyChanged(() => DisplayLatestPrice);
- RaisePropertyChanged(() => MarketValue);
- }
- }
- /// <summary>
- /// 显示最新价
- /// </summary>
- public string DisplayLatestPrice
- {
- get
- {
- if (LatestPrice > 0)
- {
- return LatestPrice.ToString(PriceFormat);
- }
- else
- {
- return "-";
- }
- }
- }
- public string GoodsPaymentDisplay
- {
- get
- {
- if (CurHolderAmount != 0)
- {
- return CurHolderAmount.ToString("f2");
- }
- else
- {
- return "-";
- }
- }
- }
- private decimal _marketValue;
- /// <summary>
- /// 市值=最新价*持有总量*合约单位;
- /// </summary>
- public decimal MarketValue
- {
- get { return _marketValue; }
- set
- {
- Set(() => MarketValue, ref _marketValue, value);
- RaisePropertyChanged(() => MarketValueDisplay);
- RaisePropertyChanged(() => ProfitPercen);
- }
- }
- public string MarketValueDisplay
- {
- get
- {
- if (MarketValue != 0)
- {
- return MarketValue.ToString("f2");
- }
- else
- {
- return "-";
- }
- }
- }
- /// <summary>
- /// 浮动盈亏
- /// </summary>
- private decimal _pLFloat;
- /// <summary>
- /// 获取或设置 浮动盈亏
- /// Changes to that property's value raise the PropertyChanged event.
- /// </summary>
- public decimal PLFloat
- {
- get
- {
- return _pLFloat;
- }
- set
- {
- Set(() => PLFloat, ref _pLFloat, value);
- RaisePropertyChanged(() => DisplayPLFloat);
- RaisePropertyChanged(() => SumFloatPL);
- }
- }
- /// <summary>
- /// 显示 浮动盈亏
- /// </summary>
- public string DisplayPLFloat
- {
- get
- {
- if (PLFloat != decimal.Zero)
- {
- return PLFloat.ToString(PriceExpFormat);
- }
- else
- {
- return "-";
- }
- }
- }
- /// <summary>
- /// 盈亏比例=(市值—货款)/ 货款 * 100% ;
- /// </summary>
- public string ProfitPercen
- {
- get
- {
- if (CurHolderAmount != 0 && MarketValue != 0)
- {
- return ((MarketValue - CurHolderAmount) / CurHolderAmount).ToString("P2");
- }
- else
- {
- return "-";
- }
- }
- }
- private decimal _sumFloatPL;
- /// <summary>
- /// 盈亏汇总
- /// </summary>
- public decimal SumFloatPL
- {
- get { return _sumFloatPL; }
- set { Set(() => SumFloatPL, ref _sumFloatPL, value); }
- }
- /// <summary>
- /// 是否可平仓
- /// </summary>
- public bool IsCanClose
- {
- get
- {
- return AvailQty > 0;
- }
- }
- public bool IsShowDelivery
- {
- get
- {
- return DeliveryFlag == eDeliveryFlag.DELIVERYFLAG_YES && Direction == Direction.Bid;
- }
- }
- }
- }
|