//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public Main() { InitializeComponent(); fConnect = new FOnConnect(OnConnect); GC.KeepAlive(fConnect); fQuoteUpdate = new FOnGetStockIdx(OnQuoteUpdate); GC.KeepAlive(fQuoteUpdate); fNotifyTicks = new FOnNotifyTicks(OnNotifyTicks); GC.KeepAlive(fNotifyTicks); fOnNotifyBest5 = new FOnGetStockIdx(OnNotifyBest5); GC.KeepAlive(fOnNotifyBest5); fOverseaProducts = new FOnOverseaProducts(OnOverseaProducts); GC.KeepAlive(fOverseaProducts); fNotifyServerTime = new FOnNotifyServerTime(OnNotifyServerTime); GC.KeepAlive(fNotifyServerTime); fNotifyKLineData = new FOnNotifyKLineData(OnNotifyKLineData); GC.KeepAlive(fNotifyKLineData); fOnNotifyTicksGet = new FOnNotifyTicksGet(OnNotifyTicksGet); GC.KeepAlive(fOnNotifyTicksGet); m_Logger = new Logger(); }
public Form1() { fData = new FOnData(OnData); GC.KeepAlive(fData); fConnect = new FOnConnect(OnConnect); GC.KeepAlive(fConnect); fDisconnect = new FOnConnect(OnDisconnect); GC.KeepAlive(fDisconnect); fComplete = new FOnComplete(OnComplete); GC.KeepAlive(fComplete); InitializeComponent(); }
//---------------------------------------------------------------------- // Component Event //---------------------------------------------------------------------- private void Main_Load(object sender, EventArgs e) { fData = new FOnData(OnData); GC.KeepAlive(fData); fOrderAsync = new FOnOrderAsyncReport(OnOrderAsyncReport); GC.KeepAlive(fOrderAsync); fConnect = new FOnConnect(OnConnect); GC.KeepAlive(fConnect); fDisconnect = new FOnConnect(OnDisconnect); GC.KeepAlive(fDisconnect); fComplete = new FOnComplete(OnComplete); GC.KeepAlive(fComplete); fOnExecutionReport = new FOnGetExecutionReoprt(OnExecutionReport); GC.KeepAlive(fOnExecutionReport); GC.SuppressFinalize(fOnExecutionReport); }
public static extern int SKOSQuoteLib_AttachConnectCallBack(FOnConnect Connect);
public static extern int RegisterOnDisconnectCallBack(FOnConnect Connect);
//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public ClientMain(string[] args) { //開啟之後特殊模式判別,雙擊開啟不會有任何特殊模式 string strMode = ""; int iMode = 0; try { strMode = args[0]; iMode = int.Parse(strMode); } catch { } switch (iMode) { case 0: quoteProgramMode = QuoteProgramModeOS.QPM_Neutural; Console.WriteLine("當前模式為 Client 一般雙擊開啟"); break; case 1: quoteProgramMode = QuoteProgramModeOS.QPM_AllProduct; Console.WriteLine("當前模式為 Server 取得當前商品列表"); break; case 3: quoteProgramMode = QuoteProgramModeOS.QPM_MarketAM; Console.WriteLine("當前模式為 Client 小日經上午盤中作單模式"); break; case 4: quoteProgramMode = QuoteProgramModeOS.QPM_AMMarketTickGet; Console.WriteLine("當前模式為 Client 小日經上午盤後Tick資訊擷取,上午倉位紀錄"); break; case 5: quoteProgramMode = QuoteProgramModeOS.QPM_MarketPM; Console.WriteLine("當前模式為 Client 小日經下午盤作單模式"); break; case 6: quoteProgramMode = QuoteProgramModeOS.QPM_AfterMarket; Console.WriteLine("當前模式為 Client 小日經下午盤後Tick資訊擷取,寫入每日歷史紀錄"); break; } InitializeComponent(); fConnect = new FOnConnect(OnConnect); GC.KeepAlive(fConnect); fQuoteUpdate = new FOnGetStockIdx(OnQuoteUpdate); GC.KeepAlive(fQuoteUpdate); fNotifyTicks = new FOnNotifyTicks(OnNotifyTicks); GC.KeepAlive(fNotifyTicks); fOnNotifyBest5 = new FOnGetStockIdx(OnNotifyBest5); GC.KeepAlive(fOnNotifyBest5); fOverseaProducts = new FOnOverseaProducts(OnOverseaProducts); GC.KeepAlive(fOverseaProducts); fNotifyServerTime = new FOnNotifyServerTime(OnNotifyServerTime); GC.KeepAlive(fNotifyServerTime); fNotifyKLineData = new FOnNotifyKLineData(OnNotifyKLineData); GC.KeepAlive(fNotifyKLineData); fOnNotifyTicksGet = new FOnNotifyTicksGet(OnNotifyTicksGet); GC.KeepAlive(fOnNotifyTicksGet); m_Logger = new Logger(); client = ScsServiceClientBuilder.CreateClient<IOSQuoteService>(new ScsTcpEndPoint("127.0.0.1", 10083)); g_marketStartTime_AM = new DateTime(todate.Year, todate.Month, todate.Day, 9, 0, 0); g_marketEndTime_AM = new DateTime(todate.Year, todate.Month, todate.Day, 15, 15, 59); g_marketStartTime_PM = new DateTime(todate.Year, todate.Month, todate.Day, 16, 29, 59); DateTime nxDate = todate.AddDays(1); g_marketEndTime_PM = new DateTime(nxDate.Year, nxDate.Month, nxDate.Day, 3, 0, 0); //上午收盤前10分,啟動timer時間 g_marketNearEndTime_AM = g_marketEndTime_AM.AddMinutes(-10); //上午收盤前10分,啟動timer時間 g_marketNearEndTime_PM = g_marketEndTime_PM.AddMinutes(-10); this.tabControl1.SelectTab(1); }
//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public ServMain(string[] args) { //開啟之後特殊模式判別,雙擊開啟不會有任何特殊模式 string strMode = ""; int iMode = 0; try { strMode = args[0]; iMode = int.Parse(strMode); } catch { } switch (iMode) { case 0: quoteProgramMode = QuoteProgramModeOS.QPM_Neutural; Console.WriteLine("當前模式為 Server 一般雙擊開啟"); break; case 1: quoteProgramMode = QuoteProgramModeOS.QPM_AllProduct; Console.WriteLine("當前模式為 Server 取得當前商品列表"); break; case 2: quoteProgramMode = QuoteProgramModeOS.QPM_MarketKLGetter; Console.WriteLine("當前模式為 Server 昨日下午盤K棒資訊擷取"); break; case 3: quoteProgramMode = QuoteProgramModeOS.QPM_MarketAM; Console.WriteLine("當前模式為 Server 小日經上午盤中作單模式"); break; case 4: quoteProgramMode = QuoteProgramModeOS.QPM_AMMarketTickGet; Console.WriteLine("當前模式為 Server 小日經上午盤後Tick資訊擷取,上午倉位紀錄"); break; case 5: quoteProgramMode = QuoteProgramModeOS.QPM_MarketPM; Console.WriteLine("當前模式為 Server 小日經下午盤作單模式"); break; case 6: quoteProgramMode = QuoteProgramModeOS.QPM_AfterMarket; Console.WriteLine("當前模式為 Server 小日經下午盤後Tick資訊擷取,寫入每日歷史紀錄"); break; } InitializeComponent(); fConnect = new FOnConnect(OnConnect); GC.KeepAlive(fConnect); fQuoteUpdate = new FOnGetStockIdx(OnQuoteUpdate); GC.KeepAlive(fQuoteUpdate); fNotifyTicks = new FOnNotifyTicks(OnNotifyTicks); GC.KeepAlive(fNotifyTicks); fOnNotifyBest5 = new FOnGetStockIdx(OnNotifyBest5); GC.KeepAlive(fOnNotifyBest5); fOverseaProducts = new FOnOverseaProducts(OnOverseaProducts); GC.KeepAlive(fOverseaProducts); fNotifyServerTime = new FOnNotifyServerTime(OnNotifyServerTime); GC.KeepAlive(fNotifyServerTime); fNotifyKLineData = new FOnNotifyKLineData(OnNotifyKLineData); GC.KeepAlive(fNotifyKLineData); fOnNotifyTicksGet = new FOnNotifyTicksGet(OnNotifyTicksGet); GC.KeepAlive(fOnNotifyTicksGet); // Order Lib fOrderAsync = new OrderReply.FOnOrderAsyncReport(OnOrderAsyncReport); GC.KeepAlive(fOrderAsync); fOnExecutionReport = new OrderReply.FOnGetExecutionReoprt(OnExecutionReport); GC.KeepAlive(fOnExecutionReport); GC.SuppressFinalize(fOnExecutionReport); // Reply Lib fData = new OrderReply.FOnData(OnReceiveReplyData); GC.KeepAlive(fData); fRConnect = new OrderReply.FOnConnect(OnRConnect); GC.KeepAlive(fConnect); fDisconnect = new OrderReply.FOnConnect(OnRDisconnect); GC.KeepAlive(fDisconnect); fComplete = new OrderReply.FOnComplete(OnComplete); GC.KeepAlive(fComplete); m_Logger = new Logger(); m_Tick = new TICK(); // 繪圖初始 StockPointList _stklist = new StockPointList(); StockPointList _ema11Plist = new StockPointList(); StockPointList _ema22Plist = new StockPointList(); this.AsyncEventHandler += new AsyncEventArgs(_AsyncEventHandler); m_updGraphDelegate = new updGraphDelegate(updGraph); CreateGraph(zg1, _stklist, _ema11Plist, _ema22Plist); // 啟動策略,更新繪圖 dayTradeSt = new JNAutoDayTrade_Strategy(Application.StartupPath,this); //更新繪圖資訊 DrawGraphOnce(dayTradeSt.m_KLdata_30Min, dayTradeSt.EMA11.records, dayTradeSt.EMA22.records); // 取得商品資訊已經搬移到client ,一定是server mode //if( // (quoteProgramMode==QuoteProgramModeOS.QPM_MarketAM) || // (quoteProgramMode == QuoteProgramModeOS.QPM_AMMarketTickGet) || // (quoteProgramMode == QuoteProgramModeOS.QPM_MarketPM) || // (quoteProgramMode == QuoteProgramModeOS.QPM_AfterMarket) // ) bServerMode = true; //今天日期 DateTime todate = DateTime.Now; // Server 不分上下午,只需開收盤時間 g_marketStartTime_AM = new DateTime(todate.Year, todate.Month, todate.Day, 9, 0, 0); DateTime nxDate = todate.AddDays(1); g_marketEndTime_PM = new DateTime(nxDate.Year, nxDate.Month, nxDate.Day, 3, 0, 0); this.timer2.Interval = 100; this.timer2.Start(); }