private bool IsValidPrice(string price, StockList.StockInformation tmpStockInfo) { bool result; try { if (price != null) { if (price == "ATO" || price == "ATC" || price == "MP" || price == "MO" || price == "ML") { result = true; return result; } } if (!FormatUtil.Isnumeric(price)) { result = false; return result; } int num = price.IndexOf('.'); string text = string.Empty; if (num > -1) { text = price.Substring(num + 1); if (text.Length < 2) { result = false; return result; } if (text.Length > 2) { result = false; return result; } } if (Convert.ToDecimal(price) <= 0m || Convert.ToDecimal(price) < tmpStockInfo.Floor || Convert.ToDecimal(price) > tmpStockInfo.Ceiling) { result = false; return result; } } catch (Exception ex) { this.ShowError("IsValidPrice", ex); } result = true; 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 ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (!base.IsLoadingData) { try { if (message.MessageType == "IS") { if (this.currentPage == "View Oddlot") { if (this._stockInfoSET != null) { ISMessage iSMessage = (ISMessage)message; if (iSMessage.Symbol == ".SET") { this.ViewOddLotMktTotal(iSMessage.OddlotAccValue, iSMessage.OddlotAccVolume); if (base.IsAllowRender) { this.intzaViewOddLotInfo.EndUpdate(); } } } } } if (realtimeStockInfo != null) { if (this._stockInfoSET != null && realtimeStockInfo.Number == this._stockInfoSET.Number) { if (message.MessageType == "TP") { if (this.currentPage == "Stock in Play") { TPMessage tPMessage = (TPMessage)message; this.StockInPlayUpdateTopPrice(tPMessage.Side, tPMessage.Price1, tPMessage.Price2, tPMessage.Price3, tPMessage.Price4, tPMessage.Price5, tPMessage.Volume1 * (long)realtimeStockInfo.BoardLot, tPMessage.Volume2 * (long)realtimeStockInfo.BoardLot, tPMessage.Volume3 * (long)realtimeStockInfo.BoardLot, tPMessage.Volume4 * (long)realtimeStockInfo.BoardLot, tPMessage.Volume5 * (long)realtimeStockInfo.BoardLot); if (base.IsAllowRender) { this.intzaStockInPlay.EndUpdate(); } } else if (this.currentPage == "View Oddlot") { TPMessage tPMessage = (TPMessage)message; this.ViewOddLot_TopPrice(tPMessage.Side, tPMessage.Price1, tPMessage.Price2, tPMessage.Price3, tPMessage.Price4, tPMessage.Price5, tPMessage.Volume1, tPMessage.Volume2, tPMessage.Volume3, tPMessage.Volume4, tPMessage.Volume5); if (base.IsAllowRender) { this.intzaViewOddLot.Redraw(); } } } else if (message.MessageType == "L+") { LSAccumulate lSAccumulate = (LSAccumulate)message; if (this.currentPage == "Stock in Play") { this.StockInPlayUpdateBuySellVolume(lSAccumulate.Side, lSAccumulate.LastPrice, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, lSAccumulate.Deals); if (lSAccumulate.Side == "B") { this._buyDeals += lSAccumulate.Deals; } else if (lSAccumulate.Side == "S") { this._sellDeals += lSAccumulate.Deals; } this.StockInPlayUpdateTotalVolumeAndTotalDeals(lSAccumulate.BuyVolume, lSAccumulate.SellVolume, lSAccumulate.OpenVolume); if (base.IsAllowRender) { this.intzaStockInPlay.EndUpdate(); } } else if (this.currentPage == "Sale by Price") { if (this.SaleByPriceUpdateBuySell(lSAccumulate.LastPrice, lSAccumulate.Side, lSAccumulate.Deals, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, false)) { this.intzaSaleByPrice.Sort("price", SortType.Desc); } if (base.IsAllowRender) { this.intzaSaleByPrice.EndUpdate(); } if (lSAccumulate.Side == "B") { this.wcGraphVolume.UpdateData((double)lSAccumulate.LastPrice, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, 0L); } else if (lSAccumulate.Side == "S") { this.wcGraphVolume.UpdateData((double)lSAccumulate.LastPrice, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, 0L, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot); } else { this.wcGraphVolume.UpdateData((double)lSAccumulate.LastPrice, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, 0L, 0L); } if (base.IsAllowRender) { this.wcGraphVolume.EndUpdate(); } } else if (this.currentPage == "Sale by Time") { decimal avg = 0m; if (lSAccumulate.AccVolume > 0L) { avg = lSAccumulate.AccValue / (lSAccumulate.AccVolume * (long)realtimeStockInfo.BoardLot); } this.SaleByTimeUpdateGridData(lSAccumulate.Side, lSAccumulate.LastPrice, lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot, realtimeStockInfo.ChangePrice, avg, lSAccumulate.LastTime, -1); if (base.IsAllowRender) { this.intzaSaleByTime.EndUpdate(); } } if (realtimeStockInfo.Number == this._stockInfoSET.Number) { this.UpdatePriceInfo(lSAccumulate.LastPrice, realtimeStockInfo.HighPrice, realtimeStockInfo.LowPrice); this.UpdateAllVolume(lSAccumulate.DealInMain, lSAccumulate.AccVolume * (long)this._stockInfoSET.BoardLot, lSAccumulate.AccValue, lSAccumulate.OpenVolume * (long)this._stockInfoSET.BoardLot, lSAccumulate.BuyVolume * (long)this._stockInfoSET.BoardLot, lSAccumulate.SellVolume * (long)this._stockInfoSET.BoardLot); if (lSAccumulate.Side == string.Empty) { this.UpdateOpenOrProjectOpenPrice(ApplicationInfo.MarketState, ApplicationInfo.MarketSession, lSAccumulate.LastPrice); } this.UpdateMainBoardValue(lSAccumulate.DealInMain, lSAccumulate.AccVolume * (long)this._stockInfoSET.BoardLot, lSAccumulate.AccValue); if (base.IsAllowRender) { this.intzaInfo.EndUpdate(); this.intzaVolumeByBoard.EndUpdate(); } this.UpdateStockTicker(lSAccumulate.LastPrice, lSAccumulate.Side, Convert.ToInt64(lSAccumulate.Volume * (long)this._stockInfoSET.BoardLot), lSAccumulate.LastTime, -1); if (base.IsAllowRender) { this.intzaLS.Redraw(); } } if (base.IsAllowRender) { this.intzaInfo.Redraw(); this.intzaLS.Redraw(); this.intzaVolumeByBoard.Redraw(); } } else if (message.MessageType == "PD") { if (realtimeStockInfo.Number == this._stockInfoSET.Number) { PDMessage pDMessage = (PDMessage)message; this.UpdateBigLotValue(pDMessage.BiglotDeals, pDMessage.BiglotAccValue, pDMessage.BiglotAccVolume); if (base.IsAllowRender) { this.intzaVolumeByBoard.EndUpdate(); } } } else if (message.MessageType == "LO") { LOMessage lOMessage = (LOMessage)message; if (this.currentPage == "View Oddlot") { this.ViewOddLotShowStockVolume(lOMessage.Price, lOMessage.OddlotDeals, lOMessage.OddlotAccVolume, lOMessage.OddlotAccValue); if (base.IsAllowRender) { this.intzaInfo.EndUpdate(); } this.UpdateStockTicker(lOMessage.Price, lOMessage.Side, lOMessage.Volume, lOMessage.LastTime, -1); if (base.IsAllowRender) { this.intzaLS.Redraw(); } } } else if (message.MessageType == "PO") { POMessage pOMessage = (POMessage)message; if (ApplicationInfo.MarketState == "M") { this.UpdateProjectedClosePrice(pOMessage.ProjectedPrice); } else { this.UpdateOpenOrProjectOpenPrice(ApplicationInfo.MarketState, ApplicationInfo.MarketSession, pOMessage.ProjectedPrice); } this.UpdateProjectedVolume(pOMessage.ProjectedVolume); if (base.IsAllowRender) { this.intzaInfo.EndUpdate(); } if (base.IsAllowRender) { this.intzaInfo.EndUpdate(); } } else if (message.MessageType == "SS") { if (realtimeStockInfo.Number == this._stockInfoSET.Number) { this.UpdateFromSS(realtimeStockInfo); if (base.IsAllowRender) { this.intzaInfo.EndUpdate(); } } } } } } catch (Exception ex) { this.ShowError("ReceiveMessage", ex); } } }
private void BestOpen_UpdateByLS(int rowIndex, decimal avg, long openVolume, decimal highPrice, decimal lowPrice, decimal lastPrice, decimal openPrice, decimal priorOrBreakclose, StockList.StockInformation stockInfo) { try { RecordItem recordItem = null; if (rowIndex > -1) { recordItem = this.intzaBestOpen.Records(rowIndex); } if (recordItem != null) { recordItem.Fields("stock").Text = stockInfo.Symbol; recordItem.Fields("stock").Tag = stockInfo.DisplayFlag; if (openPrice > 0m) { decimal num = 0m; decimal num2 = 0m; if (priorOrBreakclose > 0m && openPrice > 0m) { num = openPrice - priorOrBreakclose; num2 = num / priorOrBreakclose * 100m; } recordItem.Fields("open_price").Text = openPrice; recordItem.Fields("chg").Text = num; recordItem.Fields("pchg").Text = num2; } Color fontColor = Utilities.ComparePriceCFColor(lastPrice, stockInfo); recordItem.Fields("stock").FontColor = fontColor; if (openPrice > 0m) { fontColor = Utilities.ComparePriceCFColor(openPrice, stockInfo); recordItem.Fields("open_price").FontColor = fontColor; recordItem.Fields("chg").FontColor = fontColor; recordItem.Fields("pchg").FontColor = fontColor; } if (priorOrBreakclose > 0m) { recordItem.Fields("prior").Text = priorOrBreakclose; } recordItem.Fields("last").Text = lastPrice; recordItem.Fields("high").Text = highPrice; recordItem.Fields("low").Text = lowPrice; recordItem.Fields("avg").Text = avg; if (openVolume > -1L) { recordItem.Fields("open_volume").Text = openVolume; recordItem.Fields("open_volume").FontColor = recordItem.Fields("open_price").FontColor; } recordItem.Fields("prior").FontColor = MyColor.UnChgColor; recordItem.Fields("last").FontColor = Utilities.ComparePriceCFColor(lastPrice, stockInfo); recordItem.Fields("high").FontColor = Utilities.ComparePriceCFColor(highPrice, stockInfo); recordItem.Fields("low").FontColor = Utilities.ComparePriceCFColor(lowPrice, stockInfo); recordItem.Fields("avg").FontColor = Utilities.ComparePriceCFColor(avg, stockInfo); } } catch (Exception ex) { this.ShowError("BestOpenPriceUpdateToGridByLS", ex); } }
private void BestPOpen_UpdateByLS(RecordItem rec, decimal avg, decimal highPrice, decimal lowPrice, decimal openPrice, long openVolume, StockList.StockInformation stockInfo) { try { if (rec != null) { rec.Fields("avg").Text = avg; rec.Fields("high").Text = highPrice; rec.Fields("low").Text = lowPrice; rec.Fields("avg").FontColor = Utilities.ComparePriceCFColor(avg, stockInfo); rec.Fields("high").FontColor = Utilities.ComparePriceCFColor(highPrice, stockInfo); rec.Fields("low").FontColor = Utilities.ComparePriceCFColor(lowPrice, stockInfo); if (openPrice > -1m) { rec.Fields("ovolume1").Text = openVolume; rec.Fields("open1").Text = openPrice; Color fontColor = Utilities.ComparePriceCFColor(openPrice, stockInfo); rec.Fields("open1").FontColor = fontColor; rec.Fields("ovolume1").FontColor = fontColor; } } } catch (Exception ex) { this.ShowError("BestProjectedOpenPriceUpdateByLS", ex); } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { try { if (!base.IsLoadingData) { if (this.currentPage == "Top Active") { if (realtimeStockInfo != null && (message.MessageType == "L+" || message.MessageType == "PD")) { this.TopActiveUpdateRealTimes(message, realtimeStockInfo); } } else if (this.currentPage == "Best Projected Open") { if (realtimeStockInfo != null) { if (!(realtimeStockInfo.MarketId != this.marketIdProjectedOpenPrice)) { if (this.boardTypeProjectedOpenPrice == frmStockRanking.BoardTypes.M) { if (realtimeStockInfo.StockBoard != "M") { return; } } else if (realtimeStockInfo.StockBoard != "F") { return; } if (message.MessageType == "L+") { LSAccumulate lSAccumulate = (LSAccumulate)message; int num = this.intzaProjectedOpen.FindIndex("stock", realtimeStockInfo.Symbol); if (num > -1) { decimal avg = 0m; if (lSAccumulate.AccVolume > 0L) { avg = lSAccumulate.AccValue / (lSAccumulate.AccVolume * (long)realtimeStockInfo.BoardLot); } decimal openPrice = -1m; long openVolume = 0L; if (lSAccumulate.Side == string.Empty) { openPrice = lSAccumulate.LastPrice; openVolume = lSAccumulate.Volume * (long)realtimeStockInfo.BoardLot; } this.BestPOpen_UpdateByLS(this.intzaProjectedOpen.Records(num), avg, realtimeStockInfo.HighPrice, realtimeStockInfo.LowPrice, openPrice, openVolume, realtimeStockInfo); if (base.IsAllowRender) { this.intzaProjectedOpen.EndUpdate(num); } } } else if (message.MessageType == "PO") { if (!(ApplicationInfo.MarketState == "M")) { int num = this.intzaProjectedOpen.FindIndex("stock", realtimeStockInfo.Symbol); if (num > -1) { POMessage pOMessage = (POMessage)message; this.BestPOpen_UpdateByPO(num, pOMessage.ProjectedPrice, -1m, realtimeStockInfo); if (base.IsAllowRender) { this.intzaProjectedOpen.EndUpdate(num); } } } } } } } else if (this.currentPage == "Best Projected Close") { if (realtimeStockInfo == null) { if (message.MessageType == "SC") { this.intzaProjectedClose.Invalidate(); } } else if (!(ApplicationInfo.MarketState == "P") && !(ApplicationInfo.MarketState == "O")) { if (!(realtimeStockInfo.MarketId != this.marketIdProjectedClosePrice)) { if (this.boardTypeProjectedClosePrice == frmStockRanking.BoardTypes.M) { if (realtimeStockInfo.StockBoard != "M") { return; } } else if (realtimeStockInfo.StockBoard != "F") { return; } if (message.MessageType == "PO") { int num2 = this.intzaProjectedClose.FindIndex("stock", realtimeStockInfo.Symbol); if (num2 > -1) { POMessage pOMessage = (POMessage)message; this.BestPClose_UpdateByPO(num2, pOMessage.ProjectedPrice, realtimeStockInfo); if (base.IsAllowRender) { this.intzaProjectedClose.EndUpdate(num2); } } } } } } else if (this.currentPage == "Best Open Price") { if (message.MessageType == "L+") { } } } } catch (Exception ex) { this.ShowError("ReceiveMessage", ex); } }
private void TopActiveUpdateToGrid(int rowIndex, frmStockRanking.RecordData recordData, StockList.StockInformation realStockInfo) { if (this.intzaTopActive.InvokeRequired) { this.intzaTopActive.Invoke(new frmStockRanking.TopActiveUpdateToGridCallBack(this.TopActiveUpdateToGrid), new object[] { rowIndex, recordData, realStockInfo }); } else { try { RecordItem recordItem; if (rowIndex >= 0) { recordItem = this.intzaTopActive.Records(rowIndex); } else { recordItem = this.intzaTopActive.Find("stock", recordData.Stock); if (recordItem == null) { recordItem = this.intzaTopActive.Records(this.maxRecordTopActive - 1); } } recordItem.Fields("stock").Text = recordData.Stock; recordItem.Fields("stock").Tag = recordData.DisplayFlag; recordItem.Fields("deals").Text = recordData.Deals; recordItem.Fields("volume").Text = recordData.AccVolume; recordItem.Fields("value").Text = recordData.AccValue; decimal num = 0m; if (recordData.AccVolume > 0L) { num = Math.Round(recordData.AccValue / recordData.AccVolume, 2); } recordItem.Fields("avg").Text = num; recordItem.Fields("high").Text = recordData.HighPrice; recordItem.Fields("low").Text = recordData.LowPrice; recordItem.Fields("last").Text = recordData.LastPrice; recordItem.Fields("swing").Text = recordData.Swing; recordItem.Fields("pswing").Text = recordData.SwingPct; recordItem.Fields("chg").Text = recordData.ChangePrice; recordItem.Fields("pchg").Text = recordData.ChangePricePct; Color fontColor = Utilities.ComparePriceCFColor(recordData.LastPrice, realStockInfo); recordItem.Fields("stock").FontColor = fontColor; recordItem.Fields("deals").FontColor = fontColor; recordItem.Fields("volume").FontColor = fontColor; recordItem.Fields("value").FontColor = fontColor; recordItem.Fields("last").FontColor = fontColor; recordItem.Fields("chg").FontColor = fontColor; recordItem.Fields("pchg").FontColor = fontColor; recordItem.Fields("swing").FontColor = fontColor; recordItem.Fields("pswing").FontColor = fontColor; recordItem.Fields("avg").FontColor = Utilities.ComparePriceCFColor(num, realStockInfo); recordItem.Fields("high").FontColor = Utilities.ComparePriceCFColor(recordData.HighPrice, realStockInfo); recordItem.Fields("low").FontColor = Utilities.ComparePriceCFColor(recordData.LowPrice, realStockInfo); } catch (Exception ex) { this.ShowError("TopActiveUpdateToGrid", ex); } } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (!this.isLoading) { if (message.MessageType == "IE") { IEMessage iEMessage = (IEMessage)message; IndexStat.IndexItem indexItem = ApplicationInfo.IndexStatInfo[iEMessage.Symbol]; if (indexItem != null) { int num = this.intzaSector.FindIndex("symbol", indexItem.Symbol); if (num > -1) { this._recvDataRealTime.Symbol = indexItem.Symbol; this._recvDataRealTime.Number = indexItem.Number; this._recvDataRealTime.AccVolume = iEMessage.AccVolume; this._recvDataRealTime.AccValue = iEMessage.AccValue; this._recvDataRealTime.Index = iEMessage.IndexValue; IndexStat.IndexItem indexItem2 = ApplicationInfo.IndexStatInfo[".SET"]; if (indexItem2 != null) { if (indexItem2.AccValue > 0m) { this._recvDataRealTime.Mkt = iEMessage.AccValue / indexItem2.AccValue * 100m; } } this._recvDataRealTime.IndexPrior = indexItem.Prior; this.UpdateToGrid(num + 1, this._recvDataRealTime); if (base.IsAllowRender) { this.intzaSector.EndUpdate(num); } } } } else if (message.MessageType.ToUpper() == "IS") { ISMessage iSMessage = (ISMessage)message; this.ShowSetIndex(iSMessage.Symbol); if (base.IsAllowRender) { this.intzaSET.EndUpdate(); } if (iSMessage.Symbol == ".SET") { this.MarketInfoUpdateByMT(iSMessage.MainAccVolume, iSMessage.MainAccValue, iSMessage.OddlotAccVolume, iSMessage.OddlotAccValue, iSMessage.BiglotAccVolume, iSMessage.BiglotAccValue, iSMessage.ForeignAccVolume, iSMessage.ForeignAccValue); this.MarketInfoUpdateByIS(iSMessage.Tick, iSMessage.Trin, iSMessage.SecurityUp, iSMessage.SecurityDown, iSMessage.SecurityNoChange, iSMessage.UpVolume * 1000L, iSMessage.DownVolume * 1000L, iSMessage.NoChangeVolume * 1000L); } if (base.IsAllowRender) { this.intzaMarketInfo.EndUpdate(); this.intzaBoard.Redraw(); } } } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (!this.isLoadingData) { try { string messageType = message.MessageType; if (messageType != null) { if (!(messageType == "0I")) { if (messageType == "0B") { if (ApplicationInfo.SupportFreewill) { BroadCastOrderMessageClient broadCastOrderMessageClient = (BroadCastOrderMessageClient)message; if (ApplicationInfo.CanReceiveMessage(broadCastOrderMessageClient.EntryID)) { ApplicationInfo.RemoveOrderNoFromAutoRefreshList("", broadCastOrderMessageClient.Reserve2); } } } } else { this.ReceiveOrderInfo(message); } } } catch (Exception ex) { this.ShowError("ReceiveMessage", ex); } } }
public void AddItem(StockList.StockInformation stockInfo) { try { if (!this.items.ContainsKey(stockInfo.Number)) { this.items.Add(stockInfo.Number, stockInfo); } if (!this.itemsName.ContainsKey(stockInfo.Symbol)) { this.itemsName.Add(stockInfo.Symbol, stockInfo.Number); } } catch (Exception ex) { throw ex; } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { this.ViewOrderBox.ReceiveMessage(message, realtimeStockInfo); }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { try { string messageType = message.MessageType; if (messageType != null) { if (!(messageType == "0G")) { if (!(messageType == "0B")) { if (!(messageType == "0I")) { if (messageType == "SC") { if (ApplicationInfo.MarketState == "R") { if (this._frmConfirm != null) { this._frmConfirm.CloseMe(); } } } } else { OrderInfoClient orderInfoClient = (OrderInfoClient)message; if (orderInfoClient.Account == ApplicationInfo.AccInfo.CurrentAccount) { this.StartTimerLoadCredit(); ApplicationInfo.RemoveOrderNoFromAutoRefreshList(orderInfoClient.OrderNumber.ToString(), orderInfoClient.Reserve2); if (ApplicationInfo.SupportFreewill && (orderInfoClient.Reserve2 == "R" + this._returnOrderNumberFromServer.ToString() || orderInfoClient.Reserve2 == "OFFLINE")) { this._returnOrderNumberFromServer = -1L; if (ApplicationInfo.SupportOrderTimes) { if (this._currTimes + 1 <= this._OrdTimes) { this._currTimes++; Thread thread = new Thread(new ThreadStart(this.threadSendTimes)); thread.Start(); } else if (this._frmConfirm != null) { this._frmConfirm.CloseMe(); } } else if (this._frmConfirm != null) { this._frmConfirm.CloseMe(); } } } } } else if (ApplicationInfo.SupportFreewill) { BroadCastOrderMessageClient broadCastOrderMessageClient = (BroadCastOrderMessageClient)message; if (ApplicationInfo.CanReceiveMessage(broadCastOrderMessageClient.EntryID)) { ApplicationInfo.RemoveOrderNoFromAutoRefreshList("", broadCastOrderMessageClient.Reserve2); this.ShowMessageInFormConfirm(broadCastOrderMessageClient.Content, frmOrderFormConfirm.OpenStyle.Error); } } } else { this.ReceiveDGWReplyMessage(message); } } } catch (Exception ex) { this.ShowError("SendOrder:ReceiveMessage", ex); } }
private string CalculateValue(long volume, string price, string side, StockList.StockInformation stockInfo) { string result = string.Empty; decimal d = 0m; try { if (stockInfo != null && stockInfo.Number > 0) { if (price == "ATO" || price == "ATC" || price == "MP" || price == "MO" || price == "ML") { if (side == "B" || side == "C") { d = stockInfo.Ceiling; } else if (side == "S" || side == "H") { d = stockInfo.Floor; } } else { decimal.TryParse(price, out d); } decimal num = volume * d; result = FormatUtil.PriceFormat(num, 2, ""); } } catch (Exception ex) { this.ShowError("CalculateValue", ex); } return result; }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { AutoTradeManager.Instance.ReceiveMessage(message, realtimeStockInfo); }
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; }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (this.FormState != ClientBaseForm.ClientBaseFormState.Closing) { if (!this._isLoading) { try { if (this._canRecv && this._currPage == "CHART") { string messageType = message.MessageType; if (messageType != null) { if (messageType == "L+") { if (realtimeStockInfo != null && realtimeStockInfo.Symbol == this._currSymbol && !realtimeStockInfo.IsOddLot) { LSAccumulate lSAccumulate = (LSAccumulate)message; string text = string.Concat(new object[] { this._currSymbol, ";", lSAccumulate.Side, ";", lSAccumulate.LastPrice, ";", lSAccumulate.Volume, ";", lSAccumulate.LastTime.Replace(":", "") }); JSObject dOMWindow = this.webControl1.WebView.GetDOMWindow(); JSFunction jSFunction = (JSFunction)this.webControl1.WebView.EvalScript("dataInSTI"); object obj = jSFunction.Invoke(dOMWindow, new object[] { text }); } } } } } catch (Exception ex) { this.ShowError("ReceiveMessage", ex); } } } }
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; }
private void TopActiveUpdateRealTimes(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (base.InvokeRequired) { base.Invoke(new frmStockRanking.TopActiveUpdateRealTimesCallBack(this.TopActiveUpdateRealTimes), new object[] { message, realtimeStockInfo }); } else { try { if (this.activeGroupTypeTopActive == frmStockRanking.ActiveGroupTypes.MostActive_BigLot) { if (message.MessageType != "PD") { return; } } else if (!this.TopActiveVerifyBoard(realtimeStockInfo)) { return; } this.recDataRealTimeTopActive.Stock = ""; this.recDataRealTimeTopActive.StockNumber = 0; this.recDataRealTimeTopActive.AccVolume = 0L; this.recDataRealTimeTopActive.AccValue = 0m; this.recDataRealTimeTopActive.LastPrice = 0m; this.recDataRealTimeTopActive.HighPrice = 0m; this.recDataRealTimeTopActive.LowPrice = 0m; this.recDataRealTimeTopActive.Deals = 0; this.recDataRealTimeTopActive.ChangePrice = 0m; this.recDataRealTimeTopActive.ChangePricePct = 0m; this.recDataRealTimeTopActive.Swing = 0m; this.recDataRealTimeTopActive.SwingPct = 0m; this.recDataRealTimeTopActive.DisplayFlag = ""; this.recDataRealTimeTopActive.Prior = 0m; if (message.MessageType == "L+") { LSAccumulate lSAccumulate = (LSAccumulate)message; this.recDataRealTimeTopActive.StockNumber = lSAccumulate.SecurityNumber; this.recDataRealTimeTopActive.AccVolume = lSAccumulate.AccVolume * (long)realtimeStockInfo.BoardLot; this.recDataRealTimeTopActive.AccValue = lSAccumulate.AccValue; this.recDataRealTimeTopActive.LastPrice = lSAccumulate.LastPrice; this.recDataRealTimeTopActive.HighPrice = realtimeStockInfo.HighPrice; this.recDataRealTimeTopActive.LowPrice = realtimeStockInfo.LowPrice; this.recDataRealTimeTopActive.Deals = lSAccumulate.DealInMain; } else if (message.MessageType == "PD") { PDMessage pDMessage = (PDMessage)message; this.recDataRealTimeTopActive.StockNumber = pDMessage.SecurityNumber; this.recDataRealTimeTopActive.AccVolume = pDMessage.BiglotAccVolume; this.recDataRealTimeTopActive.AccValue = pDMessage.BiglotAccValue; this.recDataRealTimeTopActive.LastPrice = pDMessage.LastPrice; this.recDataRealTimeTopActive.HighPrice = pDMessage.HighPrice; this.recDataRealTimeTopActive.LowPrice = pDMessage.LowPrice; this.recDataRealTimeTopActive.Deals = pDMessage.BiglotDeals; } this.recDataRealTimeTopActive.DisplayFlag = realtimeStockInfo.DisplayFlag; this.recDataRealTimeTopActive.Stock = realtimeStockInfo.Symbol; this.recDataRealTimeTopActive.Prior = realtimeStockInfo.PriorPrice; if (realtimeStockInfo.PriorPrice > 0m && this.recDataRealTimeTopActive.LastPrice > 0m) { this.recDataRealTimeTopActive.ChangePrice = this.recDataRealTimeTopActive.LastPrice - realtimeStockInfo.PriorPrice; this.recDataRealTimeTopActive.ChangePricePct = this.recDataRealTimeTopActive.ChangePrice / realtimeStockInfo.PriorPrice * 100m; } if (realtimeStockInfo.PriorPrice > 0m && this.recDataRealTimeTopActive.LowPrice > 0m && this.recDataRealTimeTopActive.HighPrice > 0m) { this.recDataRealTimeTopActive.Swing = this.recDataRealTimeTopActive.HighPrice - this.recDataRealTimeTopActive.LowPrice; this.recDataRealTimeTopActive.SwingPct = this.recDataRealTimeTopActive.Swing / realtimeStockInfo.PriorPrice * 100m; } int num = -1; switch (this.activeGroupTypeTopActive) { case frmStockRanking.ActiveGroupTypes.MostActive_Main: case frmStockRanking.ActiveGroupTypes.MostActive_Foreign: { decimal d; if (decimal.TryParse(this.intzaTopActive.Records(this.maxTopTopActive).Fields("value").Text.ToString(), out d)) { if (this.recDataRealTimeTopActive.AccValue <= d) { return; } } break; } case frmStockRanking.ActiveGroupTypes.Gainer_Main: case frmStockRanking.ActiveGroupTypes.Gainer_Foreign: num = this.intzaTopActive.FindIndex("stock", realtimeStockInfo.Symbol); if (num == -1) { if (this.recDataRealTimeTopActive.ChangePrice <= 0m) { return; } decimal d2 = 0m; if (decimal.TryParse(this.intzaTopActive.Records(this.maxTopTopActive).Fields("pchg").Text.ToString(), out d2)) { if (this.recDataRealTimeTopActive.ChangePricePct <= d2) { return; } } } else if (this.recDataRealTimeTopActive.ChangePricePct <= 0m) { this.TopActive_ClearRecord(num); return; } break; case frmStockRanking.ActiveGroupTypes.Loser_Main: case frmStockRanking.ActiveGroupTypes.Loser_Foreign: num = this.intzaTopActive.FindIndex("stock", realtimeStockInfo.Symbol); if (num == -1) { if (this.recDataRealTimeTopActive.ChangePricePct >= 0m) { return; } decimal d2 = 0m; if (decimal.TryParse(this.intzaTopActive.Records(this.maxTopTopActive).Fields("pchg").Text.ToString(), out d2)) { if (this.recDataRealTimeTopActive.ChangePricePct >= d2) { return; } } } else if (this.recDataRealTimeTopActive.ChangePricePct >= 0m) { this.TopActive_ClearRecord(num); return; } break; case frmStockRanking.ActiveGroupTypes.MostSwing_Main: case frmStockRanking.ActiveGroupTypes.MostSwing_Foreign: num = this.intzaTopActive.FindIndex("stock", realtimeStockInfo.Symbol); if (num == -1) { if (this.recDataRealTimeTopActive.SwingPct <= 0m) { return; } decimal d3; if (decimal.TryParse(this.intzaTopActive.Records(this.maxTopTopActive).Fields("pswing").Text.ToString(), out d3)) { if (this.recDataRealTimeTopActive.SwingPct <= d3) { return; } } } else if (this.recDataRealTimeTopActive.SwingPct <= 0m) { this.TopActive_ClearRecord(num); return; } break; } this.TopActiveUpdateToGrid(num, this.recDataRealTimeTopActive, realtimeStockInfo); this.intzaTopActive.Sort(this.sortByNameTopActive, this.sortTypeTopActive); if (base.IsAllowRender) { this.intzaTopActive.Redraw(); } } catch (Exception ex) { this.ShowError("TopActiveUpdateRealTimes", 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(); } } } } }
private bool TopActiveVerifyBoard(StockList.StockInformation realtimeStockInfo) { bool result = false; try { if (realtimeStockInfo.MarketId == this.marketIdTopActive) { switch (this.activeGroupTypeTopActive) { case frmStockRanking.ActiveGroupTypes.MostActive_Main: case frmStockRanking.ActiveGroupTypes.Gainer_Main: case frmStockRanking.ActiveGroupTypes.Loser_Main: case frmStockRanking.ActiveGroupTypes.MostSwing_Main: if (realtimeStockInfo.StockBoard == "M") { result = true; } goto IL_A6; case frmStockRanking.ActiveGroupTypes.MostActive_BigLot: result = true; goto IL_A6; } if (realtimeStockInfo.StockBoard == "F") { result = true; } IL_A6:; } } catch (Exception ex) { this.ShowError("TopActiveVerifyBoard", ex); } return result; }
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; }
private bool BestPClose_UpdateByPO(int recIndex, decimal poClose, StockList.StockInformation stockInfo) { bool result = true; try { RecordItem recordItem = this.intzaProjectedClose.Records(recIndex); if (recordItem != null) { decimal num = 0m; decimal.TryParse(recordItem.Fields("last").Text.ToString(), out num); decimal num2 = 0m; decimal num3 = 0m; if (num > 0m && poClose > 0m) { num2 = poClose - num; num3 = num2 / num * 100m; } recordItem.Fields("chg").Text = num2; recordItem.Fields("pchg").Text = num3; recordItem.Fields("poclose").Text = poClose; Color fontColor = Utilities.ComparePriceCFColor(poClose, stockInfo); recordItem.Fields("poclose").FontColor = fontColor; recordItem.Fields("chg").FontColor = fontColor; recordItem.Fields("pchg").FontColor = fontColor; } } catch (Exception ex) { this.ShowError("BestProjectedClosePriceUpdateByPO", ex); } return result; }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { //if (ApplicationInfo.AutoTradeType > 0) //{ // return; //} try { string messageType = message.MessageType; if (messageType != null) { if (messageType == "L+") { this.Execute((LSAccumulate)message, realtimeStockInfo); } else if (messageType == "TP") { UpdateVolum((TPMessage)message, realtimeStockInfo); } } } catch (Exception ex) { throw ex; } }
private bool BestPOpen_UpdateByPO(int rowIndex, decimal poPrice, decimal priorOrBkCls, StockList.StockInformation stockInfo) { bool flag = true; bool result; try { if (rowIndex <= -1) { result = false; return result; } RecordItem recordItem = this.intzaProjectedOpen.Records(rowIndex); recordItem.Fields("stock").Text = stockInfo.Symbol; recordItem.Fields("stock").Tag = stockInfo.DisplayFlag; if (priorOrBkCls == -1m) { decimal.TryParse(recordItem.Fields("prior").Text.ToString(), out priorOrBkCls); } else { recordItem.Fields("prior").Text = priorOrBkCls; } decimal num = 0m; decimal num2 = 0m; if (priorOrBkCls > 0m && poPrice > 0m) { num = poPrice - priorOrBkCls; num2 = num / priorOrBkCls * 100m; } recordItem.Fields("chg").Text = num; recordItem.Fields("pchg").Text = num2; recordItem.Fields("po").Text = poPrice; Color fontColor = Utilities.ComparePriceCFColor(poPrice, priorOrBkCls, stockInfo); recordItem.Fields("stock").FontColor = fontColor; recordItem.Fields("chg").FontColor = fontColor; recordItem.Fields("pchg").FontColor = fontColor; recordItem.Fields("po").FontColor = fontColor; recordItem.Fields("prior").FontColor = MyColor.UnChgColor; } catch (Exception ex) { this.ShowError("BestProjectedOpenPriceUpdateByPO", ex); } result = flag; return result; }
public void UpdateVolum(TPMessage msgLS, StockList.StockInformation realtimeStockInfo) { foreach (LocalAutoTradeItem item in this._itemList) { if (item.StockName == realtimeStockInfo.Symbol && item.Status == AutoTradeConstant.STATUS_WAIT) { if (msgLS.Side == "B") { item.FirstBidVol = msgLS.Volume1; item.SecondBidVol = msgLS.Volume2; } else if (msgLS.Side == "S") { item.FirstOfferVol = msgLS.Volume1; item.SecondOfferVol = msgLS.Volume2; } else { //Don't know if there is any side } } } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { try { if (!this._isTickerLoading) { if (message.MessageType == "L+") { if (this._filterType == frmTickerSetting.filterType.ALL_MARKET || this._filterType == frmTickerSetting.filterType.SET_ONLY) { this.UpdateTicker((LSAccumulate)message, realtimeStockInfo); } else if (this._filterType == frmTickerSetting.filterType.SYMBOL) { if (ApplicationInfo.TickerStockList.Contains(realtimeStockInfo.Symbol)) { this.UpdateTicker((LSAccumulate)message, realtimeStockInfo); } } else if (this._filterType == frmTickerSetting.filterType.FAV1 || this._filterType == frmTickerSetting.filterType.FAV2 || this._filterType == frmTickerSetting.filterType.FAV3 || this._filterType == frmTickerSetting.filterType.FAV4 || this._filterType == frmTickerSetting.filterType.FAV5) { if (ApplicationInfo.FavStockList[this._favListPage].Contains(realtimeStockInfo.Symbol)) { this.UpdateTicker((LSAccumulate)message, realtimeStockInfo); } } } } } catch (Exception ex) { this.ShowError("SecurityInfo::RecvMessage", ex); } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (!base.IsLoadingData) { try { string messageType = message.MessageType; if (messageType != null) { if (!(messageType == "TP")) { if (!(messageType == "L+")) { if (messageType == "SS") { int num = ApplicationInfo.FavStockList[this._currFavPage].IndexOf(realtimeStockInfo.Symbol); if (num > -1 && num < 8) { this._bidControl[num].ReceiveMessage(message, realtimeStockInfo); } } } else { int num = ApplicationInfo.FavStockList[this._currFavPage].IndexOf(realtimeStockInfo.Symbol); if (num > -1 && num < 8) { this._bidControl[num].ReceiveMessage(message, realtimeStockInfo); } } } else { int num = ApplicationInfo.FavStockList[this._currFavPage].IndexOf(realtimeStockInfo.Symbol); if (num > -1 && num < 8) { this._bidControl[num].ReceiveMessage(message, realtimeStockInfo); } } } } catch (Exception ex) { this.ShowError("SecurityInfo::RecvMessage", ex); } } }
private void UpdateFromSS(StockList.StockInformation realtimeStockInfo) { if (this.intzaInfo.InvokeRequired) { this.intzaInfo.Invoke(new frmStockSummary.UpdateFromSSCallBack(this.UpdateFromSS), new object[] { realtimeStockInfo }); } else { try { this.intzaInfo.Item("ceiling").Text = realtimeStockInfo.Ceiling.ToString(); this.intzaInfo.Item("floor").Text = realtimeStockInfo.Floor.ToString(); this.intzaInfo.Item("prior").Text = Utilities.PriceFormat(realtimeStockInfo.PriorPrice, 2, 0); this.intzaInfo.Item("flag").Text = realtimeStockInfo.DisplayFlag; } catch (Exception ex) { this.ShowError("UpdateFromSS", ex); } } }
public void ReceiveMessage(IBroadcastMessage message, StockList.StockInformation realtimeStockInfo) { if (!base.IsLoadingData) { try { if (ApplicationInfo.SupportFreewill) { string messageType = message.MessageType; if (messageType != null) { if (messageType == "0I") { OrderInfoClient orderInfoClient = (OrderInfoClient)message; if (this._isSending && (orderInfoClient.Reserve2 == "R" + this._currOrdNoPending || orderInfoClient.Reserve2 == "OFFLINE")) { if (this._lstOrder.Count > 0) { this._currSeqLineNo = this._lstOrder[0]; this._lstOrder.Remove(this._currSeqLineNo); Thread thread = new Thread(new ThreadStart(this.SendFreewillOrder)); thread.Start(); } else { this._isSending = false; } } } } } } catch (Exception ex) { this.ShowError("ReceiveMessage", ex); } } }