| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- using Muchinfo.MTPClient.Data.Enums;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Muchinfo.MTPClient.Data.Helper;
- namespace Muchinfo.MTPClient.Data.Model.Account
- {
- /// <summary>
- /// 止盈止损单对象
- /// </summary>
- public class SPSLOrderModel
- {
- #region 查询返回字段
- [PropertyDisc("OrderId")]
- public ulong OrderId { get; set; }
- [PropertyDisc("AccountId")]
- public long AccountId { get; set; }
- [PropertyDisc("LoginId")]
- public long LoginId { get; set; }
- [PropertyDisc("GoodsId")]
- public uint GoodsId { get; set; }
- [PropertyDisc("MarketId")]
- public uint MarketId { get; set; }
- [PropertyDisc("OrderQty")]
- public decimal OrderQty { get; set; }
- [PropertyDisc("ValidType")]
- public ExpirationType ValidType { get; set; }
- [PropertyDisc("SPSLType")]
- public SPSLOrderType SPSLType { get; set; }
- [PropertyDisc("PriceType")]
- public ChannelPriceMode PriceType { get; set; }
- [PropertyDisc("TriggerType")]
- public SPSLTriggerType TriggerType { get; set; }
- [PropertyDisc("OrderSrc")]
- public eOrderSrc OrderSrc { get; set; }
- [PropertyDisc("BuyOrSell")]
- public Direction BuyOrSell { get; set; }
- [PropertyDisc("SPPrice")]
- public decimal SPPrice { get; set; }
- [PropertyDisc("SLPrice")]
- public decimal SLPrice { get; set; }
- [PropertyDisc("Status")]
- public SPSLOrderStatus Status { get; set; }
- [PropertyDisc("CreateTime")]
- public DateTime CreateTime { get; set; }
- [PropertyDisc("UpdateTime")]
- public DateTime UpdateTime { get; set; }
- #endregion
- /// <summary>
- /// 单据商品
- /// </summary>
- public QuoteGoods QuoteGoods { get; set; }
- /// <summary>
- /// Gets the goods code.
- /// </summary>
- /// <value>The goods code.</value>
- public string GoodsCode
- {
- get { return QuoteGoods == null ? string.Empty : QuoteGoods.GoodsCode; }
- }
- /// <summary>
- /// Gets the name of the goods.
- /// </summary>
- /// <value>The name of the goods.</value>
- public string GoodsName
- {
- get { return QuoteGoods == null ? string.Empty : QuoteGoods.Name; }
- }
- /// <summary>
- /// Gets the direction display.
- /// </summary>
- /// <value>The direction display.</value>
- public string DirectionDisplay
- {
- // 止损止盈单显示的是持仓方向 <- 下止损止盈单时方向使用的已经是持仓方向,这里不用再取反
- get
- {
- //var buyOrSell = BuyOrSell == Direction.Ask ? Direction.Bid : Direction.Ask;
- return BuyOrSell.Discription();
- }
- }
- /// <summary>
- /// Gets the SPSL type display.
- /// </summary>
- /// <value>The SPSL type display.</value>
- public string SPSLTypeDisplay
- {
- get
- {
- switch (SPSLType)
- {
- case SPSLOrderType.SPOrder:
- return "止盈";
- case SPSLOrderType.SLOrder:
- return "止损";
- case SPSLOrderType.Cancel:
- return "撤单";
- case SPSLOrderType.SPSL:
- return "止盈止损";
- default:
- return SPSLType.Discription("spsltype");
- }
- //更新协议后使用
- return SPSLType.Discription("spsltype");
- }
- }
- /// <summary>
- /// Gets the trigger type display.
- /// </summary>
- /// <value>The trigger type display.</value>
- public string TriggerTypeDisplay
- {
- get { return TriggerType.Discription("triggertype"); }
- }
- /// <summary>
- /// Gets the trigger type display.
- /// </summary>
- /// <value>The trigger type display.</value>
- public string PriceDisplay
- {
- get
- {
- var spPrice = SPPrice > 0 ? SPPrice.ToString(PriceExpFormat) : "-";
- var slPrice = SLPrice > 0 ? SLPrice.ToString(PriceExpFormat) : "-";
- return spPrice + "/" + slPrice;
- }
- }
- /// <summary>
- /// Gets the price type display.
- /// </summary>
- /// <value>The price type display.</value>
- public string PriceTypeDisplay
- {
- get { return PriceType.Discription("pricetype"); }
- }
- /// <summary>
- /// Gets the status display.
- /// </summary>
- /// <value>The status display.</value>
- public string StatusDisplay
- {
- get { return Status.Discription("spslstatus"); }
- }
- /// <summary>
- /// Gets the valid type display.
- /// </summary>
- /// <value>The valid type display.</value>
- public string ValidTypeDisplay
- {
- get { return ValidType.Discription(); }
- }
- /// <summary>
- /// Gets the create time display.
- /// </summary>
- /// <value>The create time display.</value>
- public string CreateTimeDisplay
- {
- get { return CreateTime.ToString("yyyy-MM-dd HH:mm:ss"); }
- }
- /// <summary>
- /// Gets a value indicating whether this instance is cancel.
- /// </summary>
- /// <value><c>true</c> if this instance is cancel; otherwise, <c>false</c>.</value>
- public bool IsCancel
- {
- //OrderSrc = 5:交易服务下的止盈止损单的不能撤单
- get { return Status == SPSLOrderStatus.NotTrigger && OrderSrc != eOrderSrc.ORDERSRC_TRADE; }
- }
- /// <summary>
- /// Gets the price exp format.
- /// </summary>
- /// <value>The price exp format.</value>
- public string PriceExpFormat
- {
- get
- {
- if (this.QuoteGoods == null || this.QuoteGoods.GoodsParameters == null)
- {
- // return "F0";
- //}
- //if (this.QuoteGoods.GoodsParameters.HqExchFigures < 3)
- //{
- return "F2";
- }
- else
- {
- return QuoteGoods.FormatPrice;
- }
- }
- }
- }
- }
|