Example #1
0
        private void GetOpt10060Caller(Opt10060TransType opt10060TransType, string stockCode, string MaxDate, string MinDate)
        {
            if (_opt10060 != null)
            {
                _opt10060.Dispose();
                _opt10060 = null;
            }
            _opt10060 = new ClsOpt10060();
            TaskCompletionSource <bool> tcs = null;

            tcs = new TaskCompletionSource <bool>();
            if (tcs == null || tcs.Task.IsCompleted)
            {
                return;
            }

            DataTable   dtDate = new DataTable();
            KiwoomQuery kiwoom = new KiwoomQuery();

            _opt10060.SetInit(_FormId);

            switch (opt10060TransType)
            {
            case Opt10060TransType.PriceMaesu:
                WriteTextSafe(stockCode + "(" + ClsAxKH.GetMasterCodeName(stockCode) + ")" + " Price(매수)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaeSu);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "1", MaeMaeGb: "1", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.PriceMaedo:
                WaitTime();
                WriteTextSafe(stockCode + " Price(매도)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaedo);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "1", MaeMaeGb: "2", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.QtyMaesu:
                WaitTime();
                WriteTextSafe(stockCode + " QTY(매수)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060MaeSu);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "2", MaeMaeGb: "1", UnitG: "", nPrevNext: 0);
                break;

            case Opt10060TransType.QtyMaeDo:
                WaitTime();
                WriteTextSafe(stockCode + " QTY(매도)_" + _StockQueue.Count.ToString());
                ClsAxKH.AxKH_10060_OnReceived += new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060Maedo);
                _opt10060.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "2", MaeMaeGb: "2", UnitG: "", nPrevNext: 0);
                break;

            default:
                break;
            }

            tcs.SetResult(true);
        }
Example #2
0
        private void ExecPs(string stockCode)
        {
            if (_opt10060Ps != null)
            {
                _opt10060Ps.Dispose();
                _opt10060Ps = null;
            }
            _opt10060Ps = new ClsOpt10060();
            _opt10060Ps.Opt10060_OnReceived += new ClsOpt10060.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaeSu);

            WriteTextSafe(stockCode + " Price 매수 작업 중 ");

            Action StartExecPs = (() =>
            {
                _opt10060Ps.SetInit(_FormId + "01");
                _opt10060Ps.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName:  "", AmountQtyGb:  "1", MaeMaeGb: "1", UnitG: "1", nPrevNext: 0);
            });

            StartExecPs();

            return;
        }
Example #3
0
        private void ExecQd(string stockCode)
        {
            if (_opt10060Qd != null)
            {
                _opt10060Qd.Dispose();
                _opt10060Qd = null;
            }

            _opt10060Qd = new ClsOpt10060();
            _opt10060Qd.Opt10060_OnReceived += new ClsOpt10060.OnReceivedEventHandler(OnReceiveTrData_Opt10060QtyMaedo);

            WriteTextSafe(stockCode + " Qty 매도 작업 중 ");

            Task t = new Task(() =>
            {
                _opt10060Qd.SetInit(_FormId + "04");
                _opt10060Qs.JustRequest(StartDate: _stdDate, StockCode: stockCode, StockName: "", AmountQtyGb: "2", MaeMaeGb: "2", UnitG: "1", nPrevNext: 0);
            });

            t.Start();

            return;
        }