using GalaSoft.MvvmLight;
using Muchinfo.MTPClient.Data.Enums;
using Muchinfo.MTPClient.Data.Helper;
using System.Collections.Generic;
using System.Linq;
namespace Muchinfo.MTPClient.Data.Model.Account
{
public class MemberAccountInfo : ObservableObject
{
private decimal _holdNetWorthFloatPL;
///
/// 持有净浮亏
///
public decimal HoldNetWorthFloatPL
{
get { return _holdNetWorthFloatPL; }
set { Set(() => HoldNetWorthFloatPL, ref _holdNetWorthFloatPL, value); }
}
private decimal _customTradeFloatPL;
///
/// 客户交易浮亏
///
public decimal CustomTradeFloatPL
{
get { return _customTradeFloatPL; }
set { Set(() => CustomTradeFloatPL, ref _customTradeFloatPL, value); }
}
///
/// 隶属账户浮动盈亏
///
public decimal CustomerPosFloatPL { get; set; }
///
/// 自营头寸浮动盈亏
///
public double SelfPosFloatPL { get; set; }
///
/// 转单头寸浮动盈亏
///
public double CutPosFloatPL { get; set; }
private decimal _hedgeTradeFloatPL;
///
/// 对冲交易浮盈亏
///
public decimal HedgeTradeFloatPL
{
get { return _hedgeTradeFloatPL; }
set { Set(() => HedgeTradeFloatPL, ref _hedgeTradeFloatPL, value); }
}
///
/// 对冲交易浮盈亏格式化
///
public string HedgeTradeFloatPLDisplay
{
get { return HedgeTradeFloatPL.ToString("N2"); }
}
///
/// 持有净浮亏格式化
///
public string HoldNetWorthFloatPLDisplay
{
get { return HoldNetWorthFloatPL.ToString("N2"); }
}
///
/// 客户交易浮亏格式化
///
public string CustomTradeFloatPLDisplay
{
get { return CustomTradeFloatPL.ToString("N2"); }
}
// private decimal _netWorth;
///
/// 净值
///
public decimal NetWorth
{
//get
//{
// return Balance; // + FloatPL; //风控服务返回的值就是净值
//}
get;
set;
}
///
/// 净值格式化
///
public string NetWorthDisplay
{
get { return NetWorth.ToString("N2"); }
}
///
/// 可用保证金格式化
///
public string AvailMarginDisplay
{
get { return AvailMargin.ToString("N2"); }
}
///
/// 期初权益
///
public string BalanceDisplay
{
get { return Balance.ToString("N2"); }
}
///
/// 可用保证金格式化
///
public string UsedMarginDisplay
{
get { return UsedMargin.ToString("N2"); }
}
private decimal _holdPosition;
///
/// 持有净头寸
///
public decimal HoldPosition
{
get { return _holdPosition; }
set { Set(() => HoldPosition, ref _holdPosition, value); }
}
///
/// 可用保证金
///
public decimal AvailMargin { get; set; }
///
/// 帐户余额
///
public decimal Balance { get; set; }
///
/// 浮动盈亏
///
public decimal FloatPL { get; set; }
///
/// 汇率
///
public decimal Rate { get; set; }
///
/// 交易代码
///
public string TradeCode { get; set; }
///
/// 占用保证金
///
public decimal UsedMargin { get; set; }
///
/// 可出资金
///
public decimal AvailAmount { get; set; }
private eAccountStatus _accountStatus;
///
/// 账号状态
///
public eAccountStatus AccountStatus
{
get { return _accountStatus; }
set { Set(() => AccountStatus, ref _accountStatus, value); }
}
private List _memberPositions;
///
/// 会员持仓汇总信息
///
public List MemberPositions
{
get { return _memberPositions; }
set
{
_memberPositions = value;
if (value != null)
{
CustomTradeFloatPL = value.Sum((positionPl) => positionPl.CustomerFloatPL);
HedgeTradeFloatPL = value.Sum((position) => position.MemberFloatPL);
HoldNetWorthFloatPL = CustomTradeFloatPL + HedgeTradeFloatPL;
}
}
}
///
/// 显示账号类型
///
public string RateDisplay
{
get { return Rate.ToString("p2"); }
}
public string AccountStatusDisplay
{
get
{
return AccountStatus.Discription();
}
}
}
}