/// <summary> /// 回報初始化 /// </summary> private void ReplyInitialize() { m_CenterLib = new SKCenterLib(); m_ReplyLib = new SKReplyLib(); #if DEBUG m_CenterLib.SKCenterLib_Debug(true); #endif m_ReplyLib.OnData += OnData; m_ReplyLib.OnConnect += OnConnect; m_ReplyLib.OnDisconnect += OnDisconnect; m_ReplyLib.OnComplete += OnComplete; int code; if ((code = m_CenterLib.SKCenterLib_Login(m_Account, m_Password)) == OK) { m_Order = new Dictionary <string, Order>(); Connect(); } //int ret = -1; //ret = Functions.SKReplyLib_Initialize(m_Account, m_Password); //switch (ret) //{ // case 0: // Functions.RegisterOnConnectCallBack(m_fConnect); // Functions.RegisterOnDisconnectCallBack(m_fDisconnect); // Functions.RegisterOnDataCallBack(m_fData); // Functions.RegisterOnCompleteCallBack(m_fComplete); // m_Order = new Dictionary<string, Order>(); // Connect(); // break; // case 2003: // default: // break; //} }
private void btnInitialize_Click(object sender, EventArgs e) { //[-for API exam switch-0513-add-] if (Chk_Env.Checked == true) { m_pSKCenter.SKCenterLib_ResetServer("morder1.capital.com.tw"); } m_nCode = m_pSKCenter.SKCenterLib_Login(txtAccount.Text.Trim().ToUpper(), txtPassWord.Text.Trim()); if (m_nCode == 0) { WriteMessage("登入成功"); skOrder1.LoginID = txtAccount.Text.Trim().ToUpper(); skReply1.LoginID = txtAccount.Text.Trim().ToUpper(); skQuote1.LoginID = txtAccount.Text.Trim().ToUpper(); skosQuote1.LoginID = txtAccount.Text.Trim().ToUpper(); } else { WriteMessage(m_nCode); } }
private void Form1_Load(object sender, EventArgs e) { m_pSKQuoteLib.OnConnection += new _ISKQuoteLibEvents_OnConnectionEventHandler(SKQuoteLib_OnConnection); m_pSKQuoteLib.OnNotifyQuote += new _ISKQuoteLibEvents_OnNotifyQuoteEventHandler(SKQuoteLib_OnNotifyQuote); int nCode = m_pSKCenterLib.SKCenterLib_Login(strID, strPassword); nCode = m_pSKQuoteLib.SKQuoteLib_EnterMonitor(); }
private void btnInitialize_Click(object sender, EventArgs e) { m_nCode = m_pSKCenter.SKCenterLib_Login(txtAccount.Text.Trim().ToUpper(), txtPassWord.Text.Trim()); if (m_nCode == 0) { WriteMessage("登入成功"); skQuote1.LoginID = txtAccount.Text.Trim().ToUpper(); } else { WriteMessage(m_nCode); } }
private void button1_Click(object sender, EventArgs e) { m_nCode = m_pSKCenter2.SKCenterLib_Login(txtAccount.Text.Trim().ToUpper(), txtPassWord.Text.Trim()); if (m_nCode == 0) { //skOrder21.LoginID = txtAccount2.Text.Trim().ToUpper(); skQuote1.LoginID2 = txtAccount.Text.Trim().ToUpper(); WriteMessage("登入成功"); //skosQuote1.LoginID = txtAccount2.Text.Trim().ToUpper(); } else { WriteMessage(m_nCode); } }
private void btnInitialize_Click(object sender, EventArgs e) { if (ckBox_OrderM.Checked == true) { m_nCode = m_pSKCenter.SKCenterLib_LoginOrderM(txtAccount.Text.Trim().ToUpper(), txtPassWord.Text.Trim()); } else { if (checkSGXDMA.Checked == true) { m_pSKCenter.SKCenterLib_SetAuthority(0); } else { m_pSKCenter.SKCenterLib_SetAuthority(1); } //[-for API exam switch-0513-add-] if (Chk_Env.Checked == true) { m_pSKCenter.SKCenterLib_ResetServer("morder1.capital.com.tw"); } m_nCode = m_pSKCenter.SKCenterLib_Login(txtAccount.Text.Trim().ToUpper(), txtPassWord.Text.Trim()); } if (m_nCode == 0) { WriteMessage(DateTime.Now.TimeOfDay.ToString() + "登入成功"); skOrder1.LoginID = txtAccount.Text.Trim().ToUpper(); skOrder1.ContinuousTrading = ckBox_OrderM.Checked;//[for OrderM] skReply1.LoginID = txtAccount.Text.Trim().ToUpper(); skReply1.OrderM = ckBox_OrderM.Checked;//[for OrderM] skQuote1.LoginID = txtAccount.Text.Trim().ToUpper(); skosQuote1.LoginID = txtAccount.Text.Trim().ToUpper(); } else { WriteMessage(m_nCode); } }
private void Button1_Click(object sender, EventArgs e) { acc = textBox1.Text; pw = textBox2.Text; connect_status = skc.SKCenterLib_Login(acc, pw); if (connect_status == 0) { msg_update("登入成功"); connect_status = skq.SKQuoteLib_EnterMonitor(); if (connect_status == 0) { msg_update("連線成功"); } else { msg_update("連線錯誤代碼: " + Convert.ToString(connect_status)); } } else { msg_update("登入錯誤代碼: " + Convert.ToString(connect_status)); } }
static void Main(string[] args) { SKCenterLib m_pSKCenter = new SKCenterLib(); SKReplyLib m_pSKReply = new SKReplyLib(); //skReply1.SKReplyLib = m_pSKReply; SKQuoteLib m_SKQuoteLib = new SKQuoteLib(); //skQuote1.SKQuoteLib = m_pSKQuote; SKOSQuoteLib m_pSKOSQuote = new SKOSQuoteLib(); //skosQuote1.SKOSQuoteLib = m_pSKOSQuote; SKOOQuoteLib m_pSKOOQuote = new SKOOQuoteLib(); int m_nCode = m_pSKCenter.SKCenterLib_Login("M121591178", "1q2w3e4r"); if (m_nCode == 0) { Console.WriteLine("登入成功!!"); } else { Console.WriteLine("登入失敗!!"); } //connection m_SKQuoteLib.OnConnection += new _ISKQuoteLibEvents_OnConnectionEventHandler(m_SKQuoteLib_OnConnection); m_SKQuoteLib.OnNotifyQuote += new _ISKQuoteLibEvents_OnNotifyQuoteEventHandler(m_SKQuoteLib_OnNotifyQuote); m_SKQuoteLib.OnNotifyHistoryTicks += new _ISKQuoteLibEvents_OnNotifyHistoryTicksEventHandler(m_SKQuoteLib_OnNotifyHistoryTicks); m_SKQuoteLib.OnNotifyTicks += new _ISKQuoteLibEvents_OnNotifyTicksEventHandler(m_SKQuoteLib_OnNotifyTicks); m_SKQuoteLib.OnNotifyBest5 += new _ISKQuoteLibEvents_OnNotifyBest5EventHandler(m_SKQuoteLib_OnNotifyBest5); m_SKQuoteLib.OnNotifyKLineData += new _ISKQuoteLibEvents_OnNotifyKLineDataEventHandler(m_SKQuoteLib_OnNotifyKLineData); m_SKQuoteLib.OnNotifyServerTime += new _ISKQuoteLibEvents_OnNotifyServerTimeEventHandler(m_SKQuoteLib_OnNotifyServerTime); m_SKQuoteLib.OnNotifyMarketTot += new _ISKQuoteLibEvents_OnNotifyMarketTotEventHandler(m_SKQuoteLib_OnNotifyMarketTot); m_SKQuoteLib.OnNotifyMarketBuySell += new _ISKQuoteLibEvents_OnNotifyMarketBuySellEventHandler(m_SKQuoteLib_OnNotifyMarketBuySell); m_SKQuoteLib.OnNotifyMarketHighLow += new _ISKQuoteLibEvents_OnNotifyMarketHighLowEventHandler(m_SKQuoteLib_OnNotifyMarketHighLow); m_SKQuoteLib.OnNotifyMACD += new _ISKQuoteLibEvents_OnNotifyMACDEventHandler(m_SKQuoteLib_OnNotifyMACD); m_SKQuoteLib.OnNotifyBoolTunel += new _ISKQuoteLibEvents_OnNotifyBoolTunelEventHandler(m_SKQuoteLib_OnNotifyBoolTunel); m_SKQuoteLib.OnNotifyFutureTradeInfo += new _ISKQuoteLibEvents_OnNotifyFutureTradeInfoEventHandler(m_SKQuoteLib_OnNotifyFutureTradeInfo); m_SKQuoteLib.OnNotifyStrikePrices += new _ISKQuoteLibEvents_OnNotifyStrikePricesEventHandler(m_SKQuoteLib_OnNotifyStrikePrices); m_SKQuoteLib.OnNotifyStockList += new _ISKQuoteLibEvents_OnNotifyStockListEventHandler(m_SKQuoteLib_OnNotifyStockList); string[] Stocks = txtStocks.Text.Trim().Split(new Char[] { ',' }); foreach (string s in Stocks) { SKSTOCK pSKStock = new SKSTOCK(); int nCode = m_SKQuoteLib.SKQuoteLib_GetStockByNo(s.Trim(), ref pSKStock); OnUpDateDataRow(pSKStock); if (nCode == 0) { OnUpDateDataRow(pSKStock); } } m_nCode = m_SKQuoteLib.SKQuoteLib_RequestStocks(ref sPage, txtStocks.Text.Trim()); }
public void Login() { m_nCode = m_pSKCenter.SKCenterLib_Login(sid.ToUpper(), password); OnActionExecuted("Login"); }