QuoteGoods.cs 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721
  1. using GalaSoft.MvvmLight.Messaging;
  2. using Muchinfo.MTPClient.Data.Enums;
  3. using Muchinfo.MTPClient.Resources;
  4. using System;
  5. using System.Windows.Media;
  6. using Newtonsoft.Json;
  7. using System.Collections.Generic;
  8. namespace Muchinfo.MTPClient.Data.Model
  9. {
  10. /// <summary>
  11. /// QuoteGoods类
  12. /// </summary>
  13. public partial class QuoteGoods : Goods, ICloneable
  14. {
  15. #region Fields
  16. /// <summary>
  17. /// 卖价
  18. /// </summary>
  19. private decimal _askPrice;
  20. /// <summary>
  21. /// 卖量
  22. /// </summary>
  23. private long _askVolume;
  24. /// <summary>
  25. /// 均价
  26. /// </summary>
  27. private decimal _averagePrice;
  28. /// <summary>
  29. /// 买价
  30. /// </summary>
  31. private decimal _bidPrice;
  32. /// <summary>
  33. /// 买量
  34. /// </summary>
  35. private long _bidVolume;
  36. ///// <summary>
  37. ///// 代码
  38. ///// </summary>
  39. //private int _code;
  40. /// <summary>
  41. /// 现价
  42. /// </summary>
  43. private decimal _currentPrice;
  44. /// <summary>
  45. /// 现量
  46. /// </summary>
  47. private long _currentVolume;
  48. /// <summary>
  49. /// 时间
  50. /// </summary>
  51. private DateTime _date;
  52. /// <summary>
  53. /// 日增仓
  54. /// </summary>
  55. private decimal _dayAddPositions;
  56. /// <summary>
  57. /// 交收日
  58. /// </summary>
  59. private DateTime _deliveryDate;
  60. /// <summary>
  61. /// 交易所名称
  62. /// </summary>
  63. private string _exchangeName;
  64. /// <summary>
  65. /// 最高
  66. /// </summary>
  67. private decimal _high;
  68. /// <summary>
  69. /// 内盘
  70. /// </summary>
  71. private int _inSize;
  72. /// <summary>
  73. /// 昨收
  74. /// </summary>
  75. private decimal _lastClose;
  76. /// <summary>
  77. /// 昨持仓量
  78. /// </summary>
  79. private long _lastPositions;
  80. /// <summary>
  81. /// 昨结算
  82. /// </summary>
  83. private decimal _lastSettlement;
  84. /// <summary>
  85. /// 最低
  86. /// </summary>
  87. private decimal _low;
  88. /// <summary>
  89. /// 流通市值
  90. /// </summary>
  91. private decimal _marketCapitalizations;
  92. /// <summary>
  93. /// 流通股本
  94. /// </summary>
  95. private long _negotiableShares;
  96. /// <summary>
  97. /// 今开
  98. /// </summary>
  99. private decimal _open;
  100. /// <summary>
  101. /// 外盘
  102. /// </summary>
  103. private int _outSize;
  104. /// <summary>
  105. /// 持仓
  106. /// </summary>
  107. private long _positions;
  108. /// <summary>
  109. /// 市盈率
  110. /// </summary>
  111. private decimal _priceEarningRatio;
  112. /// <summary>
  113. /// 量比
  114. /// </summary>
  115. private decimal _quantityRelativeRatio;
  116. /// <summary>
  117. /// 结算
  118. /// </summary>
  119. private decimal _settlement;
  120. /// <summary>
  121. /// 分类名称
  122. /// </summary>
  123. private string _sortName;
  124. /// <summary>
  125. /// 总股本
  126. /// </summary>
  127. private long _totalEquity;
  128. /// <summary>
  129. /// 总额
  130. /// </summary>
  131. private decimal _totalTurnover;
  132. /// <summary>
  133. /// 总量
  134. /// </summary>
  135. private long _totalVolume;
  136. /// <summary>
  137. /// 成交额
  138. /// </summary>
  139. private decimal _tradeTurnover;
  140. /// <summary>
  141. /// 换手率
  142. /// </summary>
  143. private decimal _turnoverRate;
  144. /// <summary>
  145. /// 成交量
  146. /// </summary>
  147. private long _volume;
  148. /// <summary>
  149. /// 委比
  150. /// </summary>
  151. private double _weiBi;
  152. /// <summary>
  153. /// 委差
  154. /// </summary>
  155. //private int _weiCha;
  156. private GoodsParameters _goodsParameters;
  157. #endregion Fields
  158. #region Constructors
  159. /// <summary>
  160. /// 实例化报价商品
  161. /// </summary>
  162. /// <param name="exchangeCode">交易所代码</param>
  163. /// <param name="goodsCode">商品代码</param>
  164. /// <param name="goodshqCode">报价分组</param>
  165. /// <param name="category">报价分组</param>
  166. public QuoteGoods(string exchangeCode, string goodsCode, string goodshqCode, QuoteCategoryType category)
  167. : base(exchangeCode, goodsCode, goodshqCode)
  168. {
  169. this.Category = category;
  170. //
  171. Messenger.Default.Register<bool>(this, MessengerTokens.NotifyQuoteGoodsColorChanged, (flag) =>
  172. {
  173. RaisePropertyChanged(() => IncreaseValue);
  174. RaisePropertyChanged(() => BidPriceColor);
  175. RaisePropertyChanged(() => AskPriceColor);
  176. RaisePropertyChanged(() => HighColor);
  177. RaisePropertyChanged(() => LowColor);
  178. RaisePropertyChanged(() => IncreaseValue);
  179. RaisePropertyChanged(() => IncreaseValueColor);
  180. RaisePropertyChanged(() => IncreasePercentColor);
  181. });
  182. }
  183. #endregion Constructors
  184. #region Properties
  185. #region Public Properties
  186. /// <summary>
  187. /// 振幅 ((最高-最低)/昨收)
  188. /// </summary>
  189. public decimal Amplitude
  190. {
  191. get
  192. {
  193. if (_lastClose != 0)
  194. {
  195. return (_high - _low) / _lastClose;
  196. }
  197. else
  198. {
  199. return (_high - _low);
  200. }
  201. }
  202. }
  203. /// <summary>
  204. /// 卖价
  205. /// </summary>
  206. public decimal AskPrice
  207. {
  208. get
  209. {
  210. return _askPrice;
  211. }
  212. set
  213. {
  214. Set(() => AskPrice, ref _askPrice, value);
  215. RaisePropertyChanged(() => AskPriceDisplay);
  216. RaisePropertyChanged(() => AskPriceColor);
  217. IsAskPriceBorder = !IsAskPriceBorder;
  218. }
  219. }
  220. /// <summary>
  221. /// 合约单位名称
  222. /// </summary>
  223. public string AgreeUnitDisplay { get; set; }
  224. /// <summary>
  225. /// <summary>
  226. /// 查询回来的商品参数
  227. /// </summary>
  228. public GoodsParameters GoodsParameters
  229. {
  230. get
  231. {
  232. return _goodsParameters;
  233. }
  234. set
  235. {
  236. _goodsParameters = value;
  237. }
  238. }
  239. /// <summary>
  240. /// 卖量
  241. /// </summary>
  242. public long AskVolume
  243. {
  244. get
  245. {
  246. return _askVolume;
  247. }
  248. set
  249. {
  250. Set(() => AskVolume, ref _askVolume, value);
  251. RaisePropertyChanged(() => AskVolumeDisplay);
  252. }
  253. }
  254. /// <summary>
  255. /// 均价
  256. /// </summary>
  257. public decimal AveragePrice
  258. {
  259. get
  260. {
  261. return _averagePrice;
  262. }
  263. set
  264. {
  265. Set(() => AveragePrice, ref _averagePrice, value);
  266. RaisePropertyChanged(() => AveragePriceDisplay);
  267. RaisePropertyChanged(() => AveragePriceColor);
  268. }
  269. }
  270. /// <summary>
  271. /// 买价
  272. /// </summary>
  273. public decimal BidPrice
  274. {
  275. get
  276. {
  277. return _bidPrice;
  278. }
  279. set
  280. {
  281. Set(() => BidPrice, ref _bidPrice, value);
  282. RaisePropertyChanged(() => BidPriceDisplay);
  283. RaisePropertyChanged(() => BidPriceColor);
  284. IsBidPriceBorder = !IsBidPriceBorder;
  285. }
  286. }
  287. /// <summary>
  288. /// 买量
  289. /// </summary>
  290. public long BidVolume
  291. {
  292. get
  293. {
  294. return _bidVolume;
  295. }
  296. set
  297. {
  298. Set(() => BidVolume, ref _bidVolume, value);
  299. RaisePropertyChanged(() => BidVolumeDisplay);
  300. }
  301. }
  302. /// <summary>
  303. /// 获取和设置报价商品分组
  304. /// </summary>
  305. public QuoteCategoryType Category
  306. {
  307. get;
  308. set;
  309. }
  310. /// <summary>
  311. /// 现价/最新价
  312. /// </summary>
  313. public decimal CurrentPrice
  314. {
  315. get
  316. {
  317. return _currentPrice;
  318. }
  319. set
  320. {
  321. Set(() => CurrentPrice, ref _currentPrice, value);
  322. RaisePropertyChanged(() => CurrentPriceDisplay);
  323. RaisePropertyChanged(() => IncreasePercentDisplay);
  324. RaisePropertyChanged(() => IncreaseValueDisplay);
  325. RaisePropertyChanged(() => IncreasePercentColor);
  326. RaisePropertyChanged(() => IncreaseValueColor);
  327. RaisePropertyChanged(() => CurrentPriceColor);
  328. RaisePropertyChanged(() => IncreaseValue);
  329. IsCurrentPriceBorder = !IsCurrentPriceBorder;
  330. }
  331. }
  332. /// <summary>
  333. /// 现量()
  334. /// </summary>
  335. public long CurrentVolume
  336. {
  337. get
  338. {
  339. return _currentVolume;
  340. }
  341. set
  342. {
  343. Set(() => CurrentVolume, ref _currentVolume, value);
  344. RaisePropertyChanged(() => CurrentVolumeDisplay);
  345. }
  346. }
  347. /// <summary>
  348. /// 时间
  349. /// </summary>
  350. public DateTime Date
  351. {
  352. get
  353. {
  354. return _date;
  355. }
  356. set
  357. {
  358. Set(() => Date, ref _date, value);
  359. RaisePropertyChanged(() => DateDisplay);
  360. }
  361. }
  362. /// <summary>
  363. /// 日增仓
  364. /// </summary>
  365. public decimal DayAddPositions
  366. {
  367. get
  368. {
  369. return _dayAddPositions;
  370. }
  371. set
  372. {
  373. Set(() => DayAddPositions, ref _dayAddPositions, value);
  374. RaisePropertyChanged(() => DayAddPositionsDisplay);
  375. }
  376. }
  377. /// <summary>
  378. /// 交收日
  379. /// </summary>
  380. public DateTime DeliveryDate
  381. {
  382. get
  383. {
  384. return _deliveryDate;
  385. }
  386. set
  387. {
  388. Set(() => DeliveryDate, ref _deliveryDate, value);
  389. RaisePropertyChanged(() => DeliveryDateDisplay);
  390. }
  391. }
  392. /// <summary>
  393. /// 交易所名称
  394. /// </summary>
  395. public string ExchangeName
  396. {
  397. get
  398. {
  399. return StringDisplay(_exchangeName);
  400. }
  401. set
  402. {
  403. Set(() => ExchangeName, ref _exchangeName, value);
  404. }
  405. }
  406. /// <summary>
  407. /// 最高
  408. /// </summary>
  409. public decimal High
  410. {
  411. get
  412. {
  413. return _high;
  414. }
  415. set
  416. {
  417. Set(() => High, ref _high, value);
  418. RaisePropertyChanged(() => AmplitudeDisplay);
  419. RaisePropertyChanged(() => HighDisplay);
  420. RaisePropertyChanged(() => HighColor);
  421. }
  422. }
  423. /// <summary>
  424. /// 涨幅%((现价-昨收)/昨收)
  425. /// </summary>
  426. public decimal IncreasePercent
  427. {
  428. get
  429. {
  430. if (_lastClose != 0)
  431. {
  432. return (_currentPrice - _lastClose) / _lastClose;
  433. }
  434. return (_currentPrice - _lastClose);
  435. }
  436. }
  437. /// <summary>
  438. /// 涨跌(现价-昨收)
  439. /// </summary>
  440. public decimal IncreaseValue
  441. {
  442. get
  443. {
  444. var value = (_currentPrice - _lastClose);
  445. return value;
  446. }
  447. }
  448. /// <summary>
  449. /// 内盘
  450. /// </summary>
  451. public int InSize
  452. {
  453. get
  454. {
  455. return _inSize;
  456. }
  457. set
  458. {
  459. Set(() => InSize, ref _inSize, value);
  460. RaisePropertyChanged(() => InSizeDisplay);
  461. }
  462. }
  463. /// <summary>
  464. /// 昨收
  465. /// </summary>
  466. public decimal LastClose
  467. {
  468. get
  469. {
  470. return _lastClose;
  471. }
  472. set
  473. {
  474. Set(() => LastClose, ref _lastClose, value);
  475. RaisePropertyChanged(() => LastCloseDisplay);
  476. RaisePropertyChanged(() => AmplitudeDisplay);
  477. RaisePropertyChanged(() => IncreasePercentDisplay);
  478. RaisePropertyChanged(() => IncreasePercentColor);
  479. RaisePropertyChanged(() => IncreaseValueDisplay);
  480. RaisePropertyChanged(() => IncreaseValueColor);
  481. }
  482. }
  483. /// <summary>
  484. /// 昨持仓量
  485. /// </summary>
  486. public long LastPositions
  487. {
  488. get
  489. {
  490. return _lastPositions;
  491. }
  492. set
  493. {
  494. Set(() => LastPositions, ref _lastPositions, value);
  495. RaisePropertyChanged(() => LastPositionsDisplay);
  496. RaisePropertyChanged(() => TurnoverRateDisplay);
  497. }
  498. }
  499. /// <summary>
  500. /// 昨结算
  501. /// </summary>
  502. public decimal LastSettlement
  503. {
  504. get
  505. {
  506. return _lastSettlement;
  507. }
  508. set
  509. {
  510. Set(() => LastSettlement, ref _lastSettlement, value);
  511. RaisePropertyChanged(() => LastSettlementDisplay);
  512. }
  513. }
  514. private decimal _deliveryPrice;
  515. /// <summary>
  516. /// 交收价格
  517. /// </summary>
  518. public decimal DeliveryPrice
  519. {
  520. get { return _deliveryPrice; }
  521. set
  522. {
  523. Set(() => DeliveryPrice, ref _deliveryPrice, value);
  524. RaisePropertyChanged(() => DeliveryPriceDisplay);
  525. }
  526. }
  527. /// <summary>
  528. /// 最低
  529. /// </summary>
  530. public decimal Low
  531. {
  532. get
  533. {
  534. return _low;
  535. }
  536. set
  537. {
  538. Set(() => Low, ref _low, value);
  539. RaisePropertyChanged(() => AmplitudeDisplay);
  540. RaisePropertyChanged(() => LowDisplay);
  541. RaisePropertyChanged(() => LowColor);
  542. }
  543. }
  544. /// <summary>
  545. /// 流通市值
  546. /// </summary>
  547. public decimal MarketCapitalizations
  548. {
  549. get
  550. {
  551. return _marketCapitalizations;
  552. }
  553. set
  554. {
  555. Set(() => MarketCapitalizations, ref _marketCapitalizations, value);
  556. RaisePropertyChanged(() => MarketCapitalizationsDisplay);
  557. }
  558. }
  559. /// <summary>
  560. /// 流通股本
  561. /// </summary>
  562. public long NegotiableShares
  563. {
  564. get
  565. {
  566. return _negotiableShares;
  567. }
  568. set
  569. {
  570. Set(() => NegotiableShares, ref _negotiableShares, value);
  571. RaisePropertyChanged(() => NegotiableSharesDisplay);
  572. }
  573. }
  574. /// <summary>
  575. /// 今开
  576. /// </summary>
  577. public decimal Open
  578. {
  579. get
  580. {
  581. return _open;
  582. }
  583. set
  584. {
  585. Set(() => Open, ref _open, value);
  586. RaisePropertyChanged(() => OpenDisplay);
  587. RaisePropertyChanged(() => OpenColor);
  588. }
  589. }
  590. /// <summary>
  591. /// 外盘
  592. /// </summary>
  593. public int OutSize
  594. {
  595. get
  596. {
  597. return _outSize;
  598. }
  599. set
  600. {
  601. Set(() => OutSize, ref _outSize, value);
  602. RaisePropertyChanged(() => OutSizeDisplay);
  603. }
  604. }
  605. /// <summary>
  606. /// 持仓量
  607. /// </summary>
  608. public long Positions
  609. {
  610. get
  611. {
  612. return _positions;
  613. }
  614. set
  615. {
  616. Set(() => Positions, ref _positions, value);
  617. RaisePropertyChanged(() => PositionsDisplay);
  618. }
  619. }
  620. /// <summary>
  621. /// 市盈率
  622. /// </summary>
  623. public decimal PriceEarningRatio
  624. {
  625. get
  626. {
  627. return _priceEarningRatio;
  628. }
  629. set
  630. {
  631. Set(() => PriceEarningRatio, ref _priceEarningRatio, value);
  632. RaisePropertyChanged(() => PriceEarningRatioDisplay);
  633. }
  634. }
  635. /// <summary>
  636. /// 量比
  637. /// </summary>
  638. public decimal QuantityRelativeRatio
  639. {
  640. get
  641. {
  642. return _quantityRelativeRatio;
  643. }
  644. set
  645. {
  646. Set(() => QuantityRelativeRatio, ref _quantityRelativeRatio, value);
  647. RaisePropertyChanged(() => QuantityRelativeRatioColor);
  648. }
  649. }
  650. /// <summary>
  651. /// 结算
  652. /// </summary>
  653. public decimal Settlement
  654. {
  655. get
  656. {
  657. return _settlement;
  658. }
  659. set
  660. {
  661. Set(() => Settlement, ref _settlement, value);
  662. RaisePropertyChanged(() => SettlementDisplay);
  663. }
  664. }
  665. /// <summary>
  666. /// 分类
  667. /// </summary>
  668. public string SortName
  669. {
  670. get
  671. {
  672. return StringDisplay(_sortName);
  673. }
  674. set
  675. {
  676. Set(() => SortName, ref _sortName, value);
  677. }
  678. }
  679. /// <summary>
  680. /// 总股本
  681. /// </summary>
  682. public long TotalEquity
  683. {
  684. get
  685. {
  686. return _totalEquity;
  687. }
  688. set
  689. {
  690. Set(() => TotalEquity, ref _totalEquity, value);
  691. RaisePropertyChanged(() => TotalEquityDisplay);
  692. }
  693. }
  694. /// <summary>
  695. /// 总额
  696. /// </summary>
  697. public decimal TotalTurnover
  698. {
  699. get
  700. {
  701. return _totalTurnover;
  702. }
  703. set
  704. {
  705. Set(() => TotalTurnover, ref _totalTurnover, value);
  706. RaisePropertyChanged(() => TotalTurnoverDisplay);
  707. }
  708. }
  709. /// <summary>
  710. /// 总量
  711. /// </summary>
  712. public long TotalVolume
  713. {
  714. get
  715. {
  716. return _totalVolume;
  717. }
  718. set
  719. {
  720. Set(() => TotalVolume, ref _totalVolume, value);
  721. RaisePropertyChanged(() => TotalVolumeDisplay);
  722. RaisePropertyChanged(() => TurnoverRateDisplay);
  723. }
  724. }
  725. /// <summary>
  726. /// 总量是否变化
  727. /// </summary>
  728. public bool IsChangedByTotalVolume { get; set; }
  729. /// <summary>
  730. /// 成交额
  731. /// </summary>
  732. public decimal TradeTurnover
  733. {
  734. get
  735. {
  736. return _tradeTurnover;
  737. }
  738. set
  739. {
  740. Set(() => TradeTurnover, ref _tradeTurnover, value);
  741. RaisePropertyChanged(() => TradeTurnoverDisplay);
  742. }
  743. }
  744. /// <summary>
  745. /// 换手率
  746. /// </summary>
  747. public decimal TurnoverRate
  748. {
  749. get
  750. {
  751. return _turnoverRate;
  752. }
  753. set
  754. {
  755. Set(() => TurnoverRate, ref _turnoverRate, value);
  756. }
  757. }
  758. /// <summary>
  759. /// 委比
  760. /// </summary>
  761. public double WeiBi
  762. {
  763. get
  764. {
  765. double total = 0;
  766. for (int i = 0; i < BidList.Length && i < AskList.Length; i++)
  767. {
  768. total += BidList[i].Volume + AskList[i].Volume;
  769. }
  770. if (total == 0)
  771. {
  772. return 100;
  773. }
  774. _weiBi = WeiCha / total * 100;
  775. return _weiBi;
  776. }
  777. }
  778. /// <summary>
  779. /// 委差
  780. /// </summary>
  781. public double WeiCha
  782. {
  783. get
  784. {
  785. double weiCha = 0d;
  786. for (int i = 0; i < BidList.Length && i < AskList.Length; i++)
  787. {
  788. weiCha += BidList[i].Volume - AskList[i].Volume;
  789. }
  790. return weiCha;
  791. }
  792. }
  793. #region yxw
  794. private Commission[] _bidList = new Commission[5] { new Commission(Direction.Bid), new Commission(Direction.Bid), new Commission(Direction.Bid), new Commission(Direction.Bid), new Commission(Direction.Bid) };
  795. /// <summary>
  796. /// 买
  797. /// </summary>
  798. [JsonIgnore]
  799. public Commission[] BidList
  800. {
  801. get
  802. {
  803. return _bidList;
  804. }
  805. set
  806. {
  807. _bidList = value;
  808. }
  809. }
  810. private Commission[] _askList = new Commission[5] { new Commission(Direction.Ask), new Commission(Direction.Ask), new Commission(Direction.Ask), new Commission(Direction.Ask), new Commission(Direction.Ask) };
  811. /// <summary>
  812. /// 卖
  813. /// </summary>
  814. [JsonIgnore]
  815. public Commission[] AskList
  816. {
  817. get
  818. {
  819. return _askList;
  820. }
  821. set
  822. {
  823. _askList = value;
  824. }
  825. }
  826. #endregion
  827. /// <summary>
  828. /// 商品来源(包含)类型之和
  829. /// </summary>
  830. public int ContainsGoodsSrc { get; set; }
  831. #endregion Public Properties
  832. #endregion Properties
  833. #region Methods
  834. #region Public Methods
  835. /// <summary>
  836. /// 获取买卖档
  837. /// </summary>
  838. /// <param name="isAsk">获取买档</param>
  839. /// <param name="level">买卖排名</param>
  840. /// <returns>Commission.</returns>
  841. public Commission GetBidOrAsk(bool isAsk, int level)
  842. {
  843. level--;
  844. if (level < 0)
  845. {
  846. return null;
  847. }
  848. if (isAsk)
  849. {
  850. if (level >= AskList.Length)
  851. {
  852. return null;
  853. }
  854. return AskList[level];
  855. }
  856. else
  857. {
  858. if (level >= BidList.Length)
  859. {
  860. return null;
  861. }
  862. return BidList[level];
  863. }
  864. }
  865. /// <summary>
  866. /// 交易模式
  867. /// </summary>
  868. public eTradeMode TradeMode { get; set; }
  869. /// <summary>
  870. /// 交易属性NEW 2.0
  871. /// </summary>
  872. public eTradeProperty TradeProperty { get; set; }
  873. /// <summary>
  874. /// Gets the abbreviated.
  875. /// </summary>
  876. /// <param name="aVal">A val.</param>
  877. /// <param name="formatString">The format string.</param>
  878. /// <returns>System.String.</returns>
  879. public string GetAbbreviated(double aVal, string formatString = "")
  880. {
  881. string result = string.Empty;
  882. if (aVal.Equals(0))
  883. {
  884. result = DefaultString;
  885. }
  886. var value = Math.Abs(aVal);
  887. if (value <= 999999)
  888. {
  889. result = value.ToString();
  890. }
  891. else if (value <= 9999999)
  892. {
  893. result = System.Math.Round(((decimal)value / 10000), 2).ToString() + Client_Resource.Domain_TenThousand;
  894. }
  895. else if (value <= 99999999)
  896. {
  897. result = System.Math.Round(((decimal)value / 10000), 0).ToString() + Client_Resource.Domain_TenThousand;
  898. }
  899. else if (value <= 99999999999)
  900. {
  901. result = System.Math.Round(((decimal)value / 100000000), 2).ToString() + Client_Resource.Domain_OneHundredmillion;
  902. }
  903. else
  904. {
  905. result = System.Math.Round(((decimal)value / 100000000), 0).ToString() + Client_Resource.Domain_OneHundredmillion;
  906. }
  907. return result;
  908. }
  909. public string GetAbbreviatedEx(long aVal,bool defaultzero=true)
  910. {
  911. if (aVal == 0)
  912. {
  913. return defaultzero ? "0" : "-";
  914. }
  915. else if (aVal <= 999999)
  916. {
  917. return aVal.ToString();
  918. }
  919. else if (aVal <= 9999999)
  920. {
  921. return System.Math.Round(((decimal)aVal / 10000), 2).ToString() + Client_Resource.Domain_TenThousand;
  922. }
  923. else if (aVal <= 99999999)
  924. {
  925. return System.Math.Round(((decimal)aVal / 10000), 0).ToString() + Client_Resource.Domain_TenThousand;
  926. }
  927. else if (aVal <= 99999999999)
  928. {
  929. return System.Math.Round(((decimal)aVal / 100000000), 2).ToString() + Client_Resource.Domain_OneHundredmillion;
  930. }
  931. else
  932. {
  933. return System.Math.Round(((decimal)aVal / 100000000), 0).ToString() + Client_Resource.Domain_OneHundredmillion;
  934. }
  935. }
  936. /// <summary>
  937. /// Gets the abbreviated.
  938. /// </summary>
  939. /// <param name="aVal">A val.</param>
  940. /// <param name="formatString">The format string.</param>
  941. /// <returns>System.String.</returns>
  942. public string GetAbbreviated(decimal aVal, string formatString = "")
  943. {
  944. return GetAbbreviated((double)aVal, formatString);
  945. }
  946. /// <summary>
  947. /// 更新对象属性值(只更新需要字段)
  948. /// </summary>
  949. /// <param name="item">The item.</param>
  950. public void UpdateFrom(QuoteGoods item, bool IsHistory)
  951. {
  952. double decimalPlace = (double)this.DecimalPlaces;
  953. item.CurrentPrice = decimal.Multiply(item.CurrentPrice, (decimal)Math.Pow(0.1, decimalPlace));
  954. item.BidPrice = decimal.Multiply(item.BidPrice, (decimal)Math.Pow(0.1, decimalPlace));
  955. item.AskPrice = decimal.Multiply(item.AskPrice, (decimal)Math.Pow(0.1, decimalPlace));
  956. item.BidList[0].Price = decimal.Multiply(item.BidList[0].Price, (decimal)Math.Pow(0.1, decimalPlace));
  957. item.BidList[1].Price = decimal.Multiply(item.BidList[1].Price, (decimal)Math.Pow(0.1, decimalPlace));
  958. item.BidList[2].Price = decimal.Multiply(item.BidList[2].Price, (decimal)Math.Pow(0.1, decimalPlace));
  959. item.BidList[3].Price = decimal.Multiply(item.BidList[3].Price, (decimal)Math.Pow(0.1, decimalPlace));
  960. item.BidList[4].Price = decimal.Multiply(item.BidList[4].Price, (decimal)Math.Pow(0.1, decimalPlace));
  961. item.AskList[0].Price = decimal.Multiply(item.AskList[0].Price, (decimal)Math.Pow(0.1, decimalPlace));
  962. item.AskList[1].Price = decimal.Multiply(item.AskList[1].Price, (decimal)Math.Pow(0.1, decimalPlace));
  963. item.AskList[2].Price = decimal.Multiply(item.AskList[2].Price, (decimal)Math.Pow(0.1, decimalPlace));
  964. item.AskList[3].Price = decimal.Multiply(item.AskList[3].Price, (decimal)Math.Pow(0.1, decimalPlace));
  965. item.AskList[4].Price = decimal.Multiply(item.AskList[4].Price, (decimal)Math.Pow(0.1, decimalPlace));
  966. item.LastClose = decimal.Multiply(item.LastClose, (decimal)Math.Pow(0.1, decimalPlace));
  967. item.DeliveryPrice = decimal.Multiply(item.DeliveryPrice, (decimal)Math.Pow(0.1, decimalPlace));
  968. item.High = decimal.Multiply(item.High, (decimal)Math.Pow(0.1, decimalPlace));
  969. item.Low = decimal.Multiply(item.Low, (decimal)Math.Pow(0.1, decimalPlace));
  970. item.Open = decimal.Multiply(item.Open, (decimal)Math.Pow(0.1, decimalPlace));
  971. item.TotalTurnover = decimal.Multiply(item.TotalTurnover, (decimal)Math.Pow(0.1, decimalPlace));
  972. item.TradeTurnover = decimal.Multiply(item.TradeTurnover, (decimal)Math.Pow(0.1, decimalPlace));
  973. item.FallsPrice = decimal.Multiply(item.FallsPrice, (decimal)Math.Pow(0.1, decimalPlace));
  974. item.RaisesPrice = decimal.Multiply(item.RaisesPrice, (decimal)Math.Pow(0.1, decimalPlace));
  975. item.Settlement = decimal.Multiply(item.Settlement, (decimal)Math.Pow(0.1, decimalPlace));
  976. item.LastSettlement = decimal.Multiply(item.LastSettlement, (decimal)Math.Pow(0.1, decimalPlace));
  977. ////最先赋值昨收,以便计算其它字段颜色,以名LastClose Setter里使用太多属性通知改变
  978. ////最先赋值昨收,以便计算其它字段颜色,以名LastClose Setter里使用太多属性通知改变
  979. int roundInt = this.GoodsParameters != null ? this.GoodsParameters.HqExchFigures : 0;
  980. if (item.LastClose != 0 && !this.LastClose.Equals(item.LastClose))
  981. {
  982. ///暂时注释昨收,使用昨结算与分析系统保持一致
  983. // this.LastClose = Math.Round(item.LastClose, roundInt, MidpointRounding.AwayFromZero);
  984. // this.LastSettlement = Math.Round(item.LastSettlement, roundInt, MidpointRounding.AwayFromZero);
  985. }
  986. if (item.LastSettlement != 0 && !this.LastSettlement.Equals(item.LastSettlement))
  987. {
  988. this.LastSettlement = Math.Round(item.LastSettlement, roundInt, MidpointRounding.AwayFromZero);
  989. this.LastClose = Math.Round(item.LastSettlement, roundInt, MidpointRounding.AwayFromZero); ///暂时注释昨收,使用昨结算与分析系统保持一致
  990. }
  991. if (item.LastPositions != 0 && !this.LastPositions.Equals(item.LastPositions))
  992. {
  993. this.LastPositions = item.LastPositions;
  994. }
  995. if (item.RaisesPrice != 0 && !this.RaisesPrice.Equals(item.RaisesPrice))
  996. {
  997. this.RaisesPrice = item.RaisesPrice;
  998. }
  999. if (item.FallsPrice != 0 && !this.FallsPrice.Equals(item.FallsPrice))
  1000. {
  1001. this.FallsPrice = item.FallsPrice;
  1002. }
  1003. if (item.Inventory != 0 && !this.Inventory.Equals(item.Inventory))
  1004. {
  1005. this.Inventory = item.Inventory;
  1006. }
  1007. if (item.CurrentPrice > 0 && DateTime.MinValue.Equals(item.Date))
  1008. {
  1009. //现价大于0 且日期为最小值 丢掉
  1010. return;
  1011. }
  1012. ////只更新需要字段
  1013. ////if (item.BidPrice != 0 && !this.BidPrice.Equals(item.BidPrice)) this.BidPrice = Math.Round(item.BidPrice, roundInt, MidpointRounding.AwayFromZero); //item.BidPrice;
  1014. ////if (item.AskPrice != 0 && !this.AskPrice.Equals(item.AskPrice)) this.AskPrice = Math.Round(item.AskPrice, roundInt, MidpointRounding.AwayFromZero); //item.AskPrice;
  1015. #region 显示最新的行情
  1016. if (item.Date >= this.Date)
  1017. {
  1018. if (!this.BidPrice.Equals(item.BidPrice))
  1019. {
  1020. this.BidPrice = Math.Round(item.BidPrice, roundInt, MidpointRounding.AwayFromZero);
  1021. }
  1022. if (!this.AskPrice.Equals(item.AskPrice))
  1023. {
  1024. this.AskPrice = Math.Round(item.AskPrice, roundInt, MidpointRounding.AwayFromZero);
  1025. }
  1026. if (item.CurrentPrice != 0 && !this.CurrentPrice.Equals(item.CurrentPrice))
  1027. {
  1028. this.CurrentPrice = Math.Round(item.CurrentPrice, roundInt, MidpointRounding.AwayFromZero);
  1029. }
  1030. #region yxw 添加买卖档变更
  1031. if (!item.BidList[0].Equals(this.BidList[0]))
  1032. {
  1033. this.BidList[0] = item.BidList[0];
  1034. this.BidList[0].LastClose = this.LastClose;
  1035. }
  1036. if (!item.BidList[1].Equals(this.BidList[1]))
  1037. {
  1038. this.BidList[1] = item.BidList[1];
  1039. this.BidList[1].LastClose = this.LastClose;
  1040. }
  1041. if (!item.BidList[2].Equals(this.BidList[2]))
  1042. {
  1043. this.BidList[2] = item.BidList[2];
  1044. this.BidList[2].LastClose = this.LastClose;
  1045. }
  1046. if (!item.BidList[3].Equals(this.BidList[3]))
  1047. {
  1048. this.BidList[3] = item.BidList[3];
  1049. this.BidList[3].LastClose = this.LastClose;
  1050. }
  1051. if (!item.BidList[4].Equals(this.BidList[4]))
  1052. {
  1053. this.BidList[4] = item.BidList[4];
  1054. this.BidList[4].LastClose = this.LastClose;
  1055. }
  1056. if (!item.AskList[0].Equals(this.AskList[0]))
  1057. {
  1058. this.AskList[0] = item.AskList[0];
  1059. this.AskList[0].LastClose = this.LastClose;
  1060. }
  1061. if (!item.AskList[1].Equals(this.AskList[1]))
  1062. {
  1063. this.AskList[1] = item.AskList[1];
  1064. this.AskList[1].LastClose = this.LastClose;
  1065. }
  1066. if (!item.AskList[2].Equals(this.AskList[2]))
  1067. {
  1068. this.AskList[2] = item.AskList[2];
  1069. this.AskList[2].LastClose = this.LastClose;
  1070. }
  1071. if (!item.AskList[3].Equals(this.AskList[3]))
  1072. {
  1073. this.AskList[3] = item.AskList[3];
  1074. this.AskList[3].LastClose = this.LastClose;
  1075. }
  1076. if (!item.AskList[4].Equals(this.AskList[4]))
  1077. {
  1078. this.AskList[4] = item.AskList[4];
  1079. this.AskList[4].LastClose = this.LastClose;
  1080. }
  1081. #endregion
  1082. }
  1083. #endregion
  1084. this.Date = item.Date;
  1085. if (item.Open != 0 && !this.Open.Equals(item.Open))
  1086. {
  1087. this.Open = Math.Round(item.Open, roundInt, MidpointRounding.AwayFromZero); //item.Open;
  1088. }
  1089. if (item.High != 0 && !this.High.Equals(item.High))
  1090. {
  1091. this.High = Math.Round(item.High, roundInt, MidpointRounding.AwayFromZero); //item.High;
  1092. }
  1093. if (item.Low != 0 && !this.Low.Equals(item.Low))
  1094. {
  1095. this.Low = Math.Round(item.Low, roundInt, MidpointRounding.AwayFromZero);// item.Low;
  1096. }
  1097. if (item.Positions != 0 && !this.Positions.Equals(item.Positions))
  1098. {
  1099. this.Positions = item.Positions;
  1100. }
  1101. if (item.TotalVolume != 0 && !this.TotalVolume.Equals(item.TotalVolume))
  1102. {
  1103. this.TotalVolume = item.TotalVolume;
  1104. }
  1105. if (item.TotalTurnover != 0 && !this.TotalTurnover.Equals(item.TotalTurnover))
  1106. {
  1107. this.TotalTurnover = item.TotalTurnover;
  1108. }
  1109. if ( !this.BidVolume.Equals(item.BidVolume))
  1110. {
  1111. this.BidVolume = item.BidVolume;
  1112. }
  1113. if ( !this.AskVolume.Equals(item.AskVolume))
  1114. {
  1115. this.AskVolume = item.AskVolume;
  1116. }
  1117. if (item.DayAddPositions != 0 && !this.DayAddPositions.Equals(item.DayAddPositions))
  1118. {
  1119. this.DayAddPositions = item.DayAddPositions;
  1120. }
  1121. if (item.TradeTurnover != 0 && !this.TradeTurnover.Equals(item.TradeTurnover))
  1122. {
  1123. this.TradeTurnover = item.TradeTurnover;
  1124. }
  1125. if (item.AveragePrice != 0 && !this.AveragePrice.Equals(item.AveragePrice))
  1126. {
  1127. this.AveragePrice = item.AveragePrice;
  1128. }
  1129. if (item.QuantityRelativeRatio != 0 && !this.QuantityRelativeRatio.Equals(item.QuantityRelativeRatio))
  1130. {
  1131. this.QuantityRelativeRatio = item.QuantityRelativeRatio;
  1132. }
  1133. if (item.TurnoverRate != 0 && !this.TurnoverRate.Equals(item.TurnoverRate))
  1134. {
  1135. this.TurnoverRate = item.TurnoverRate;
  1136. }
  1137. if (item.PriceEarningRatio != 0 && !this.PriceEarningRatio.Equals(item.PriceEarningRatio))
  1138. {
  1139. this.PriceEarningRatio = item.PriceEarningRatio;
  1140. }
  1141. //to confirm
  1142. if (item.NegotiableShares != 0 && !this.NegotiableShares.Equals(item.NegotiableShares)) this.NegotiableShares = item.NegotiableShares;
  1143. if (item.MarketCapitalizations != 0 && !this.MarketCapitalizations.Equals(item.MarketCapitalizations)) this.MarketCapitalizations = item.MarketCapitalizations;
  1144. if (item.TotalEquity != 0 && !this.TotalEquity.Equals(item.TotalEquity)) this.TotalEquity = item.TotalEquity;
  1145. if (item.InSize != 0 && !this.InSize.Equals(item.InSize))
  1146. {
  1147. this.InSize = item.InSize;
  1148. }
  1149. if (item.OutSize != 0 && !this.OutSize.Equals(item.OutSize))
  1150. {
  1151. this.OutSize = item.OutSize;
  1152. }
  1153. ////if (item.WeiBi != 0 && !this.WeiBi.Equals(item.WeiBi)) this.WeiBi = item.WeiBi;
  1154. ////if (item.WeiCha != 0 && !this.WeiCha.Equals(item.WeiCha)) this.WeiCha = item.WeiCha;
  1155. ////to confirm
  1156. if (item.NegotiableShares != 0 && !this.NegotiableShares.Equals(item.NegotiableShares))
  1157. {
  1158. this.NegotiableShares = item.NegotiableShares;
  1159. }
  1160. if (item.MarketCapitalizations != 0 && !this.MarketCapitalizations.Equals(item.MarketCapitalizations))
  1161. {
  1162. this.MarketCapitalizations = item.MarketCapitalizations;
  1163. }
  1164. if (item.TotalEquity != 0 && !this.TotalEquity.Equals(item.TotalEquity))
  1165. {
  1166. this.TotalEquity = item.TotalEquity;
  1167. }
  1168. //if (item.AskQueueInfo != null && !this.AskQueueInfo.Equals(item.AskQueueInfo))
  1169. //{
  1170. this.AskQueueInfo = item.AskQueueInfo;
  1171. //}
  1172. //if (item.BidQueueInfo != null && !this.BidQueueInfo.Equals(item.BidQueueInfo))
  1173. //{
  1174. this.BidQueueInfo = item.BidQueueInfo;
  1175. // }
  1176. this.CurrentVolume = item.CurrentVolume; ////当前量
  1177. //根据现价更新最高最低价
  1178. if (CurrentPrice >= 0 && CurrentPrice > High)
  1179. {
  1180. High = CurrentPrice;
  1181. }
  1182. if (CurrentPrice >= 0 && (CurrentPrice < Low || Low <= 0))
  1183. {
  1184. Low = CurrentPrice;
  1185. }
  1186. if (this.Open == 0) //第一笔成交价为开盘价
  1187. {
  1188. this.Open = CurrentPrice;
  1189. }
  1190. }
  1191. /// <summary>
  1192. /// 更新除了最新价外的数据
  1193. /// </summary>
  1194. /// <param name="item"></param>
  1195. public void UpdateWithoutCurPrice(QuoteGoods item)
  1196. {
  1197. //根据现价更新最高最低价
  1198. if (CurrentPrice >= 0 && CurrentPrice > High)
  1199. {
  1200. High = CurrentPrice;
  1201. }
  1202. if (CurrentPrice >= 0 && (CurrentPrice < Low || Low <= 0))
  1203. {
  1204. Low = CurrentPrice;
  1205. }
  1206. }
  1207. ///// <summary>
  1208. ///// 从盘面数据更新
  1209. ///// </summary>
  1210. ///// <param name="dayQuote">The day quote.</param>
  1211. //public void UpdateFromDayQuote(DayQuote dayQuote)
  1212. //{
  1213. // if (dayQuote == null)
  1214. // {
  1215. // return;
  1216. // }
  1217. // ////最先赋值昨收,以便计算其它字段颜色,以名LastClose Setter里使用太多属性通知改变
  1218. // this.LastClose = dayQuote.PreClose;
  1219. // if (dayQuote.LastTime >= this.Date) //比当前时间小的不更新当前价格
  1220. // {
  1221. // this.AskPrice = dayQuote.Ask;
  1222. // this.AskVolume = dayQuote.AskVolume;
  1223. // this.BidPrice = dayQuote.Bid;
  1224. // this.BidVolume = dayQuote.BidVolume;
  1225. // this.CurrentPrice = dayQuote.Last;
  1226. // #region 买卖档 yxw
  1227. // #region 买卖价格
  1228. // this.BidList[0].Price = dayQuote.Bid;
  1229. // this.BidList[1].Price = dayQuote.Bid2;
  1230. // this.BidList[2].Price = dayQuote.Bid3;
  1231. // this.BidList[3].Price = dayQuote.Bid4;
  1232. // this.BidList[4].Price = dayQuote.Bid5;
  1233. // this.AskList[0].Price = dayQuote.Ask;
  1234. // this.AskList[1].Price = dayQuote.Ask2;
  1235. // this.AskList[2].Price = dayQuote.Ask3;
  1236. // this.AskList[3].Price = dayQuote.Ask4;
  1237. // this.AskList[4].Price = dayQuote.Ask5;
  1238. // #endregion
  1239. // #region 买卖量
  1240. // this.BidList[0].Volume = dayQuote.BidVolume;
  1241. // this.BidList[1].Volume = dayQuote.BidVolume2;
  1242. // this.BidList[2].Volume = dayQuote.BidVolume3;
  1243. // this.BidList[3].Volume = dayQuote.BidVolume4;
  1244. // this.BidList[4].Volume = dayQuote.BidVolume5;
  1245. // this.AskList[0].Volume = dayQuote.AskVolume;
  1246. // this.AskList[1].Volume = dayQuote.AskVolume2;
  1247. // this.AskList[2].Volume = dayQuote.AskVolume3;
  1248. // this.AskList[3].Volume = dayQuote.AskVolume4;
  1249. // this.AskList[4].Volume = dayQuote.AskVolume5;
  1250. // #endregion
  1251. // #endregion
  1252. // }
  1253. // this.CurrentVolume = dayQuote.LastVolume;
  1254. // this.Date = dayQuote.LastTime;
  1255. // this.High = dayQuote.Highest;
  1256. // this.LastSettlement = dayQuote.PreSettle;
  1257. // this.Low = dayQuote.Lowest;
  1258. // this.Open = dayQuote.Opened;
  1259. // this.Positions = dayQuote.PreHoldVolume;
  1260. // this.Settlement = dayQuote.Settle;
  1261. // this.TotalTurnover = dayQuote.TotalTurnover;
  1262. // this.TotalVolume = dayQuote.TotalVolume;
  1263. //}
  1264. /// <summary>
  1265. /// 清盘面
  1266. /// </summary>
  1267. public void ClearQuote()
  1268. {
  1269. ////最先赋值昨收,以便计算其它字段颜色,以名LastClose Setter里使用太多属性通知改变
  1270. this.LastClose = this.CurrentPrice;
  1271. this.Date = DateTime.MinValue;
  1272. this.AskPrice = 0;
  1273. this.AskVolume = 0;
  1274. this.BidPrice = 0;
  1275. this.BidVolume = 0;
  1276. this.CurrentPrice = 0;
  1277. this.CurrentVolume = 0;
  1278. this.High = 0;
  1279. this.LastSettlement = Settlement;
  1280. this.Low = 0;
  1281. this.Open = 0;
  1282. this.Settlement = 0;
  1283. this.TotalTurnover = 0;
  1284. this.TotalVolume = 0;
  1285. LastPositions = this.Positions;
  1286. this.Positions = 0;
  1287. #region 买卖档 yxw
  1288. #region 买卖价格
  1289. this.BidList[0].Price = 0;
  1290. this.BidList[1].Price = 0;
  1291. this.BidList[2].Price = 0;
  1292. this.BidList[3].Price = 0;
  1293. this.BidList[4].Price = 0;
  1294. this.AskList[0].Price = 0;
  1295. this.AskList[1].Price = 0;
  1296. this.AskList[2].Price = 0;
  1297. this.AskList[3].Price = 0;
  1298. this.AskList[4].Price = 0;
  1299. #endregion
  1300. #region 买卖量
  1301. this.BidList[0].Volume = 0;
  1302. this.BidList[1].Volume = 0;
  1303. this.BidList[2].Volume = 0;
  1304. this.BidList[3].Volume = 0;
  1305. this.BidList[4].Volume = 0;
  1306. this.AskList[0].Volume = 0;
  1307. this.AskList[1].Volume = 0;
  1308. this.AskList[2].Volume = 0;
  1309. this.AskList[3].Volume = 0;
  1310. this.AskList[4].Volume = 0;
  1311. #endregion
  1312. #endregion
  1313. }
  1314. #endregion Public Methods
  1315. #region Private Methods
  1316. /// <summary>
  1317. /// Gets the brush.
  1318. /// </summary>
  1319. /// <param name="source">The source.</param>
  1320. /// <param name="destination">The destination.</param>
  1321. /// <returns>Brush.</returns>
  1322. private Brush GetBrush(decimal source, decimal destination)
  1323. {
  1324. if (source == 0)
  1325. {
  1326. return DefaultBrush;
  1327. }
  1328. if (source > destination)
  1329. {
  1330. return AscBrush;
  1331. }
  1332. if (source < destination)
  1333. {
  1334. return DecBrush;
  1335. }
  1336. return DefaultBrush;
  1337. }
  1338. /// <summary>
  1339. /// Gets the brush.
  1340. /// </summary>
  1341. /// <param name="source">The source.</param>
  1342. /// <param name="destination">The destination.</param>
  1343. /// <returns>Brush.</returns>
  1344. private Brush GetBrush(double source, double destination)
  1345. {
  1346. if (source == 0)
  1347. {
  1348. return DefaultBrush;
  1349. }
  1350. if (source > destination)
  1351. {
  1352. return AscBrush;
  1353. }
  1354. if (source < destination)
  1355. {
  1356. return DecBrush;
  1357. }
  1358. return DefaultBrush;
  1359. }
  1360. /// <summary>
  1361. /// 获取默认格式化字符串
  1362. /// </summary>
  1363. /// <returns>System.String.</returns>
  1364. public string GetDefaultFormat()
  1365. {
  1366. if (this.Category == QuoteCategoryType.Forex)
  1367. {
  1368. return "#0.0000";
  1369. }
  1370. return "#0.00";
  1371. }
  1372. #endregion Private Methods
  1373. #endregion Methods
  1374. /// <summary>
  1375. /// 克隆对象
  1376. /// </summary>
  1377. /// <returns></returns>
  1378. public object Clone()
  1379. {
  1380. var temp = this.MemberwiseClone() as QuoteGoods;
  1381. if (temp == null)
  1382. {
  1383. return null;
  1384. }
  1385. this.AskList.CopyTo(temp.AskList, 0);
  1386. return temp;
  1387. }
  1388. /// <summary>
  1389. /// 商品是否有行情
  1390. /// </summary>
  1391. public bool IsShowQuote
  1392. {
  1393. get
  1394. {
  1395. if (this.GoodsParameters == null)
  1396. {
  1397. return false;
  1398. }
  1399. ////todo:商品运行状态通知实现后再使用下面代码
  1400. return true;
  1401. //// return (this.GoodsParameters.RunStatus == MarketGoodsStatus.List || this.GoodsParameters.RunStatus == MarketGoodsStatus.MARKET_OPEN);
  1402. }
  1403. }
  1404. /// <summary>
  1405. /// 交割商品名称(关联交易商品 存放交割商品名称)
  1406. /// </summary>
  1407. public string DeliveryGoodsName { get; set; }
  1408. /// <summary>
  1409. /// 交割商品名称/代码
  1410. /// </summary>
  1411. public string DeliveryGoodsNameCode
  1412. {
  1413. get
  1414. {
  1415. return DeliveryGoodsName + " " + DeliveryGoodsCode;
  1416. }
  1417. }
  1418. #region NEW FIELD MTP2.0
  1419. /// <summary>
  1420. /// 主辅商品比的主手数
  1421. /// </summary>
  1422. public uint XDeliveryRatio { get; set; }
  1423. /// <summary>
  1424. /// 主辅商品比的辅手数
  1425. /// </summary>
  1426. public uint PDeliveryRatio1 { get; set; }
  1427. public uint PDeliveryRatio2 { get; set; }
  1428. public uint P1Type { get; set; }
  1429. public uint P2Type { get; set; }
  1430. public uint P1value { get; set; }
  1431. public uint P2value { get; set; }
  1432. /// <summary>
  1433. /// 下单类型。普通下单/摘牌下单
  1434. /// </summary>
  1435. public eOrderFormType formType { get; set; }
  1436. /// <summary>
  1437. /// 挂牌、摘牌属性=》委托单号
  1438. /// </summary>
  1439. public long OrderId_Listing { get; set; }
  1440. /// <summary>
  1441. /// 挂牌、摘牌属性=》委托价格
  1442. /// </summary>
  1443. public decimal OrderPrice_Listing { get; set; }
  1444. /// <summary>
  1445. /// 最后交易日期
  1446. /// </summary>
  1447. public string LastTradeDate { get; set; }
  1448. /// <summary>
  1449. /// 交割商品代码(关联交易商品 存放交割商品代码)
  1450. /// </summary>
  1451. public string DeliveryGoodsCode { get; set; }
  1452. /// <summary>
  1453. /// 交割商品ID(关联交易商品 存放交割商品ID)
  1454. /// </summary>
  1455. public uint DeliveryGoodsId { get; set; }
  1456. /// <summary>
  1457. /// 交割起始日期NEW
  1458. /// </summary>
  1459. public string BeginDate { get; set; }
  1460. /// <summary>
  1461. /// 交割结束日期NEW
  1462. /// </summary>
  1463. public string EndDate { get; set; }
  1464. /// <summary>
  1465. /// 辅助交易商品ID
  1466. /// </summary>
  1467. public uint PGoodsID1 { get; set; }
  1468. /// <summary>
  1469. /// 辅助商品2
  1470. /// </summary>
  1471. public uint PGoodsID2 { get; set; }
  1472. /// <summary>
  1473. /// 最小交割手数
  1474. /// </summary>
  1475. public uint MinDeliveryQty { get; set; }
  1476. /// <summary>
  1477. /// 商品单位式NEW
  1478. /// </summary>
  1479. public string GoodsUnit { get; set; }
  1480. /// <summary>
  1481. /// 合约单位NEW
  1482. /// </summary>
  1483. public uint AgreeUnit { get; set; }
  1484. /// <summary>
  1485. /// 报价货币NEW
  1486. /// </summary>
  1487. public string Currency { get; set; }
  1488. /// <summary>
  1489. /// 是否交割 0:不交割1:要交割
  1490. /// </summary>
  1491. public uint DeliveryFlag { get; set; }
  1492. /// <summary>
  1493. /// 交割商品单位 string
  1494. /// </summary>
  1495. public string DeliveryGoodsUnit { get; set; }
  1496. /// <summary>
  1497. /// 商品要素列表
  1498. /// </summary>
  1499. public List<PriceMoveModel> GoodsPMList { get; set; }
  1500. #endregion
  1501. private double _inventory;
  1502. /// <summary>
  1503. /// 总库存量
  1504. /// </summary>
  1505. public double Inventory
  1506. {
  1507. get { return _inventory; }
  1508. set
  1509. {
  1510. Set(() => Inventory, ref _inventory, value);
  1511. RaisePropertyChanged(() => InventoryDisplay);
  1512. }
  1513. }
  1514. /// <summary>
  1515. /// 五档买委托队列
  1516. /// </summary>
  1517. public string BidQueueInfo { get; set; }
  1518. /// <summary>
  1519. /// 五档卖委托队列
  1520. /// </summary>
  1521. public string AskQueueInfo { get; set; }
  1522. /// <summary>
  1523. /// 外部行情是否有效
  1524. /// </summary>
  1525. public bool IsQuoteValid { get; set; }
  1526. public uint ClosePriceMode { get; set; }
  1527. public double ClosePriceParam { get; set; }
  1528. public uint Currencyid { get; set; }
  1529. public uint DelistingMode { get; set; }
  1530. public uint GoodsStatus { get; set; }
  1531. public uint GoodsType { get; set; }
  1532. public uint GroupID { get; set; }
  1533. public uint InnerDealMode { get; set; }
  1534. public uint IsBuyLimited { get; set; }
  1535. public uint Lotsize { get; set; }
  1536. public uint QtyDecimalPlace { get; set; }
  1537. public uint QuoteMinUnit { get; set; }
  1538. /// <summary>
  1539. /// 交易日
  1540. /// </summary>
  1541. public string TradeDate { get; set; }
  1542. }
  1543. }