//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public Form1() { InitializeComponent(); m_pSKCenter = new SKCenterLib(); m_pSKCenter2 = new SKCenterLib(); m_pSKOrder = new SKOrderLib(); skOrder1.OrderObj = m_pSKOrder; m_pSKReply = new SKReplyLib(); skReply1.SKReplyLib = m_pSKReply; m_pSKQuote = new SKQuoteLib(); skQuote1.SKQuoteLib = m_pSKQuote; SetQuoteAuto(); m_pSKOSQuote = new SKOSQuoteLib(); skosQuote1.SKOSQuoteLib = m_pSKOSQuote; m_pSKOOQuote = new SKOOQuoteLib(); skooQuote1.SKOOQuoteLib = m_pSKOOQuote; m_pSKCenter2.OnShowAgreement += new _ISKCenterLibEvents_OnShowAgreementEventHandler(this.OnShowAgreement); m_pSKCenter2.OnNotifySGXAPIOrderStatus += new _ISKCenterLibEvents_OnNotifySGXAPIOrderStatusEventHandler(this.m_pSKCenter_OnSGXAPIOrderStatus); }
//public UserControl userControl2 { get; set; } public Form1() { InitializeComponent(); m_pSKCenter = new SKCenterLib(); m_pSKCenter2 = new SKCenterLib(); m_pSKQuote = new SKQuoteLib(); skQuote1.SKQuoteLib = m_pSKQuote; m_pSKOSQuote = new SKOSQuoteLib(); m_pSKCenter2.OnShowAgreement += new _ISKCenterLibEvents_OnShowAgreementEventHandler(this.OnShowAgreement); m_pSKReply = new SKReplyLib(); skReply1.SKReplyLib = m_pSKReply; m_pSKReply.OnReplyMessage += new _ISKReplyLibEvents_OnReplyMessageEventHandler(this.OnAnnouncement); txtAccount.Text = System.Configuration.ConfigurationManager.AppSettings.Get("Username"); txtPassWord.Text = System.Configuration.ConfigurationManager.AppSettings.Get("Password"); StatusListBox.Items.Add("DB Conn: " + connectionstr); StatusListBox.Items.Add("TradeSession: " + (util.GetTradeSession() == 1? "AM盤":"全盤")); util.RecordLog(connectionstr, "SKQuote login, Session:" + (util.GetTradeSession() == 1 ? "Morning session" : "Night session"), util.INFO); }
/// <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; //} }
public Form1() { InitializeComponent(); skc = new SKCenterLib(); skr = new SKReplyLib(); skr.OnReplyMessage += new _ISKReplyLibEvents_OnReplyMessageEventHandler(OnAnnouncement); skq = new SKQuoteLib(); skq.OnConnection += new _ISKQuoteLibEvents_OnConnectionEventHandler(OnConnection); skq.OnNotifyTicks += new _ISKQuoteLibEvents_OnNotifyTicksEventHandler(OnNotifyTicks); }
public Capital(string sid, string password) { this.sid = sid; this.password = password; m_pSKCenter = new SKCenterLib(); m_pSKReply = new SKReplyLib(); m_pSKReply.OnReplyMessage += new _ISKReplyLibEvents_OnReplyMessageEventHandler(this.OnAnnouncement); Login(); m_SKQuoteLib = new SKCOMLib.SKQuoteLib(); m_SKQuoteLib.OnConnection += new _ISKQuoteLibEvents_OnConnectionEventHandler(m_SKQuoteLib_OnConnection); m_SKQuoteLib.OnNotifyHistoryTicks += new _ISKQuoteLibEvents_OnNotifyHistoryTicksEventHandler(m_SKQuoteLib_OnNotifyHistoryTicks); m_SKQuoteLib.OnNotifyTicks += new _ISKQuoteLibEvents_OnNotifyTicksEventHandler(m_SKQuoteLib_OnNotifyTicks); }
//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public Form1() { InitializeComponent(); m_pSKCenter = new SKCenterLib(); m_pSKCenter2 = new SKCenterLib(); m_pSKOrder = new SKOrderLib(); skOrder1.OrderObj = m_pSKOrder; m_pSKReply = new SKReplyLib(); skReply1.SKReplyLib = m_pSKReply; m_pSKCenter2.OnShowAgreement += new _ISKCenterLibEvents_OnShowAgreementEventHandler(this.OnShowAgreement); txtAccount.Text = System.Configuration.ConfigurationManager.AppSettings.Get("Username"); txtPassWord.Text = System.Configuration.ConfigurationManager.AppSettings.Get("Password"); }
//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public Form1() { InitializeComponent(); m_pSKCenter = new SKCenterLib(); m_pSKOrder = new SKOrderLib(); skOrder1.OrderObj = m_pSKOrder; m_pSKReply = new SKReplyLib(); skReply1.SKReplyLib = m_pSKReply; m_pSKQuote = new SKQuoteLib(); skQuote1.SKQuoteLib = m_pSKQuote; m_pSKOSQuote = new SKOSQuoteLib(); skosQuote1.SKOSQuoteLib = m_pSKOSQuote; m_pSKOOQuote = new SKOOQuoteLib(); skooQuote1.SKOOQuoteLib = m_pSKOOQuote; }
public Form1() { InitializeComponent(); m_pSKCenterLib = new SKCenterLib(); m_pSKQuoteLib = new SKQuoteLib(); m_pSKReply = new SKReplyLib(); dStockList = new Dictionary <string, string>(); dMarketValue = new Dictionary <string, long>(); m_pSKReply.OnReplyMessage += new _ISKReplyLibEvents_OnReplyMessageEventHandler(OnAnnouncement); //讀取股票清單 StreamReader str = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\StockList.txt"); strStocks = str.ReadLine(); str.Close(); string strQtyStocks; //讀取股票總股數 str = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\QtyStock.txt"); strQtyStocks = str.ReadLine(); str.Close(); //讀取設定檔 str = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\Setting.txt"); str.ReadLine(); string[] strTemp = str.ReadLine().Split(','); strID = strTemp[0]; strPassword = strTemp[1]; dOneValue = Convert.ToDouble(str.ReadLine().Split(',')[0]); dProportion = Convert.ToDouble(str.ReadLine().Split(',')[0]); str.Close(); string[] strStock = strStocks.Split(','); string[] strQtyStock = strQtyStocks.Split(','); for (int i = 0; i < strStock.Length; i++) { dStockList.Add(strStock[i], strQtyStock[i]); dMarketValue.Add(strStock[i], 0); } }
//---------------------------------------------------------------------- // Initialize //---------------------------------------------------------------------- public Form1() { InitializeComponent(); m_pSKCenter = new SKCenterLib(); m_pSKOrder = new SKOrderLib(); skOrder1.OrderObj = m_pSKOrder; m_pSKReply = new SKReplyLib(); skReply1.SKReplyLib = m_pSKReply; m_pSKQuote = new SKQuoteLib(); skQuote1.SKQuoteLib = m_pSKQuote; m_pSKOSQuote = new SKOSQuoteLib(); skosQuote1.SKOSQuoteLib = m_pSKOSQuote; m_pSKOOQuote = new SKOOQuoteLib(); skooQuote1.SKOOQuoteLib = m_pSKOOQuote; m_pSKCenter.OnShowAgreement += new _ISKCenterLibEvents_OnShowAgreementEventHandler(this.OnShowAgreement); }
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 InitSkcomLib() { _skCenter = new SKCenterLib(); _skReply = new SKReplyLib(); _skQuotes = new SKQuoteLib(); }