internal IBroadcastMessage CreateSETMessage(string message) { IBroadcastMessage result; try { string text = message.Substring(0, 2); switch (text) { case "TP": result = new TPMessage(message); return result; case "L+": result = new LSAccumulate(message); return result; case "PO": result = new POMessage(message); return result; case "B+": result = new BCTextMessage(message); return result; case "IS": result = new ISMessage(message); return result; case "IE": result = new IEMessage(message); return result; case "LO": this.loMessage.Unpack(message); result = this.loMessage; return result; case "MT": result = new MarketInfo(message); return result; case "PD": this.pdMessage.Unpack(message); result = this.pdMessage; return result; case "SC": this.scMessage.Unpack(message); result = this.scMessage; return result; case "SS": result = new SSMessage(message); return result; case "AA": this.aaMessage.Unpack(message); result = this.aaMessage; return result; case "NH": this.nhMessage.Unpack(message); result = this.nhMessage; return result; case "BA": result = new BAMessage(message); return result; case "0I": result = new OrderInfoClient(message); return result; case "0B": this.broadcastMessageClient.Unpack(message); result = this.broadcastMessageClient; return result; case "0G": this.dgwOrderReply.Unpack(message); result = this.dgwOrderReply; return result; } result = null; } catch (Exception ex) { throw ex; } return result; }
private void UpdateTicker(LSAccumulate msg, StockList.StockInformation realtimeStockInfo) { if (this.intzaTicker.InvokeRequired) { this.intzaTicker.Invoke(new ucTickerSlide.UpdateLastSaleTickerCallBack(this.UpdateTicker), new object[] { msg, realtimeStockInfo }); } else { try { if (realtimeStockInfo.Number > -1) { int num = this.intzaTicker.FocusItemIndex + 1; num++; if (num > this.intzaTicker.Rows) { num = 1; } if (num + 1 <= this.intzaTicker.Rows) { this.intzaTicker.ClearAllTextByRow(num); this.intzaTicker.EndUpdate(num); } STIControl.SortTableGrid.RecordItem recordItem = this.intzaTicker.Records(num - 1); recordItem.Fields("side").Text = msg.Side; if (realtimeStockInfo.Symbol.Length > 8) { recordItem.Fields("stock").Text = realtimeStockInfo.Symbol.Substring(0, 8) + "..."; } else { recordItem.Fields("stock").Text = realtimeStockInfo.Symbol; } recordItem.Fields("volume").Text = msg.Volume * (long)realtimeStockInfo.BoardLot; recordItem.Fields("price").Text = msg.LastPrice; recordItem.Fields("change").Text = realtimeStockInfo.ChangePrice; recordItem.Fields("pchg").Text = realtimeStockInfo.ChangePricePct; if (realtimeStockInfo.Symbol == ApplicationInfo.CurrStockInMktWatch) { recordItem.Fields("stock").Tag = "@F"; } else { recordItem.Fields("stock").Tag = string.Empty; } Color fontColor = MyColor.OpenColor; if (msg.Side == "B") { fontColor = MyColor.BuyColor; } else if (msg.Side == "S") { fontColor = MyColor.SellColor; } Color fontColor2 = Utilities.ComparePriceCFColor(msg.LastPrice, realtimeStockInfo); recordItem.Fields("stock").FontColor = fontColor2; recordItem.Fields("side").FontColor = fontColor; recordItem.Fields("volume").FontColor = fontColor; recordItem.Fields("price").FontColor = fontColor2; recordItem.Fields("change").FontColor = fontColor2; recordItem.Fields("pchg").FontColor = fontColor2; this.intzaTicker.SetFocusItem(num - 1); } } catch (Exception ex) { this.ShowError("UpdateLastSaleTicker", ex); } } }
public void Execute(LSAccumulate msgLS, StockList.StockInformation realtimeStockInfo) { foreach (LocalAutoTradeItem item in this._itemList) { if (item.StockName == realtimeStockInfo.Symbol && item.Status == AutoTradeConstant.STATUS_WAIT) { if (IsConditionMeet(msgLS, item, realtimeStockInfo)) { if (!this.bgwAutoSendOrder.IsBusy) { if (item.ConditionType == LocalAutoTradeItem.AutoTradeCondition.FOLLOW_BIGLOT) { item.OrdPrice = msgLS.LastPrice.ToString(); } _currentAutoItem = item; this.bgwAutoSendOrder.RunWorkerAsync(); } } } } }
public bool IsConditionMeet(LSAccumulate msgLS, LocalAutoTradeItem autoItem, StockList.StockInformation realtimeStockInfo) { switch (autoItem.ConditionType) { case LocalAutoTradeItem.AutoTradeCondition.COMMON : return CheckCommonCondition(msgLS, autoItem, realtimeStockInfo); case LocalAutoTradeItem.AutoTradeCondition.FOLLOW_BIGLOT : return CheckBiglotCondition(msgLS, autoItem, realtimeStockInfo); } return false; }
public bool CheckCommonCondition(LSAccumulate msgLS, LocalAutoTradeItem autoItem, StockList.StockInformation realtimeStockInfo) { switch (autoItem.OperatorType) { case AutoTradeConstant.OPERATOR_LESSER_EQUAL: { if (autoItem.OrdSide == "S") { if (msgLS.Side == "S") { decimal priceToCompare = autoItem.Value; if (msgLS.LastPrice == priceToCompare) { autoItem.FirstBidVol -= msgLS.Volume; if ((autoItem.FirstBidVol / 5) <= (autoItem.OrdVolume / realtimeStockInfo.BoardLot)) { return true; } } decimal bidPrice1; Decimal.TryParse(realtimeStockInfo.BidPrice1, out bidPrice1); if (bidPrice1 < priceToCompare) { return true; } } } return false; } } return false; }
public bool CheckBiglotCondition(LSAccumulate msgLS, LocalAutoTradeItem autoItem, StockList.StockInformation realtimeStockInfo) { if (autoItem.OrdSide == "S") { if ((msgLS.Side == "S") && (autoItem.Value < (msgLS.Volume * realtimeStockInfo.BoardLot) )) { return true; } } else { if ((msgLS.Side == "B") && (autoItem.Value < (msgLS.Volume * realtimeStockInfo.BoardLot))) { return true; } } return false; }
private void DrawTPBlinkColor(LSAccumulate msgLS) { if (this.intzaTP.InvokeRequired) { this.intzaTP.Invoke(new frmMarketWatch.DrawTPBlinkColorCallBack(this.DrawTPBlinkColor), new object[] { msgLS }); } else { try { if (ApplicationInfo.IsSupportTPBlinkColor) { int isBlink = 3; if (msgLS.Side == "S") { string b = Utilities.PriceFormat(msgLS.LastPrice); for (int i = 0; i < 5; i++) { if (this.intzaTP.Records(i).Fields("bidvolume").TempText == b) { this.intzaTP.Records(i).Fields("bidvolume").IsBlink = isBlink; break; } } } else if (msgLS.Side == "B") { string b = Utilities.PriceFormat(msgLS.LastPrice); for (int i = 0; i < 5; i++) { if (this.intzaTP.Records(i).Fields("offervolume").TempText == b) { this.intzaTP.Records(i).Fields("offervolume").IsBlink = isBlink; break; } } } if (base.IsAllowRender) { this.intzaTP.EndUpdate(); } } } catch (Exception ex) { this.ShowError("DrawTPBlinkColor", ex); } } }
private void DrawTPBBoBlink(int indexBBO, LSAccumulate msgLS) { try { if (ApplicationInfo.IsSupportTPBlinkColor) { if (msgLS.Side != string.Empty) { if (indexBBO > -1 && indexBBO < ApplicationInfo.FavStockPerPage) { int isBlink = 3; STIControl.ExpandTableGrid.RecordItem recordItem = this.intzaBBO.Records(indexBBO); decimal d = 0m; decimal.TryParse(recordItem.Fields("bid").Text.ToString(), out d); if (msgLS.LastPrice == d) { recordItem.Fields("bidvol").IsBlink = isBlink; if (base.IsAllowRender) { this.intzaBBO.EndUpdate(indexBBO); } } else { d = 0m; decimal.TryParse(recordItem.Fields("offer").Text.ToString(), out d); if (msgLS.LastPrice == d) { recordItem.Fields("offvol").IsBlink = isBlink; if (base.IsAllowRender) { this.intzaBBO.EndUpdate(indexBBO); } } } } } } } catch (Exception ex) { this.ShowError("DrawTPBBoBlink", ex); } }
private void AddItem(LSAccumulate msgLS, string symbol, decimal changePrice, decimal changePricePct, long boardLot) { if (this.IsMonitoring) { lock (((ICollection)this._bcMessages).SyncRoot) { this._bcMessages.Enqueue(new AlertManager.AlertBcItem(msgLS.MessageType, msgLS.LastPrice, msgLS.Volume, symbol, changePrice, changePricePct, boardLot)); } } }