示例#1
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
示例#2
0
        Connect(Privacies privacy, ShareInvest.Catalog.XingAPI.LoadServer load)
        {
            if (ConnectServer(load.Server, 0x4E21) &&
                Login(privacy.Identity, privacy.Password, privacy.Certificate, 0, string.IsNullOrEmpty(privacy.Certificate) == false) &&
                IsLoadAPI())
            {
                _IXASessionEvents_Event_Login += OnEventConnect;
                Disconnect += Dispose;
                secrecy     = new Secrecy();
                Request     = Delay.GetInstance(0xCD);

                while (TimerBox.Show(secrecy.Connection, load.Date, MessageBoxButtons.OK, MessageBoxIcon.Information, 0xC57).Equals(DialogResult.OK))
                {
                    if (Accounts != null)
                    {
                        Request.Run();

                        return;
                    }
                }
            }
            else
            {
                Dispose();
            }
        }
示例#3
0
        public ConnectAPI(Privacies privacy)
        {
            int index = 0;

            this.privacy = privacy;
            InitializeComponent();

            foreach (Control control in Controls)
            {
                FindControlRecursive(control);
            }

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites                             = new Secrecy().Decipher(privacy.Security, privacy.SecurityAPI);
                textCertificate.Text                  = securites[index++];
                textPassword.Text                     = securites[++index];
                textIdentity.Text                     = securites[++index];
                checkPrivacy.CheckState               = CheckState.Checked;
                textPassword.UseSystemPasswordChar    = true;
                textCertificate.UseSystemPasswordChar = true;
            }
            var now = DateTime.Now;

            Codes      = new HashSet <Codes>();
            Strategics = new HashSet <IStrategics>();
            querys     = (now.Hour == 0xF && now.Minute < 0x2D || now.Hour < 0xF) && now.Hour > 4 ? new IQuerys <SendSecuritiesAPI>[] { new CFOBQ10500(), new T0441() } : new IQuerys <SendSecuritiesAPI>[] { new CCEBQ10500(), new CCEAQ50600() };
            Stocks     = new T8411();
            Options    = new T8414();
            JIF        = new JIF();
        }
示例#4
0
 internal static Connect GetInstance(Privacies privacy, ShareInvest.Catalog.XingAPI.LoadServer load)
 {
     if (API == null)
     {
         HoldingStock = new Dictionary <string, Holding>();
         API          = new Connect(privacy, load);
     }
     return(API);
 }
示例#5
0
        public ConnectAPI(Privacies privacy)
        {
            this.privacy = privacy;
            InitializeComponent();

            if (string.IsNullOrEmpty(privacy.SecurityAPI) == false)
            {
                securites = new Security().Decipher(privacy.Security, privacy.SecuritiesAPI, privacy.SecurityAPI);
                checkAccount.CheckState = CheckState.Checked;
            }
            Strategics = new HashSet <IStrategics>();
        }
示例#6
0
 internal SecuritiesAPI(Consensus consensus, GoblinBatClient client, Privacies privacy, ISecuritiesAPI <SendSecuritiesAPI> com)
 {
     this.com       = com;
     this.privacy   = privacy;
     this.consensus = consensus;
     this.client    = client;
     random         = new Random();
     stocks         = new List <string>();
     futures        = new List <string>();
     options        = new List <string>();
     InitializeComponent();
     icon   = new string[] { mono, duo, tri, quad };
     colors = new Color[] { Color.Maroon, Color.Ivory, Color.DeepSkyBlue };
     GetTheCorrectAnswer = new int[privacy.Security.Length];
     infoCodes           = new Dictionary <string, Codes>();
     strip.ItemClicked  += OnItemClick;
     timer.Start();
 }
示例#7
0
        public async Task <double> PutContext(Privacies param)
        {
            try
            {
                Coin = 0;
                var response = await client.ExecuteAsync(new RestRequest(security.RequestCodes(param), Method.PUT, DataFormat.Json).AddJsonBody(param, security.ContentType), source.Token);

                if (response != null && response.RawBytes != null && response.RawBytes.Length > 0)
                {
                    Coin += security.GetSettleTheFare(response.RawBytes.Length);
                    SendMessage(Coin);
                }
                return(JsonConvert.DeserializeObject <double>(response.Content) + Coin);
            }
            catch (Exception ex)
            {
                SendMessage(ex.StackTrace);
            }
            return(Coin);
        }
示例#8
0
        internal SatisfyConditionsAccordingToTrends(Privacies privacies, GoblinBatClient client)
        {
            InitializeComponent();
            this.privacies       = privacies;
            this.client          = client;
            data.ColumnCount     = 9;
            data.BackgroundColor = Color.FromArgb(0x79, 0x85, 0x82);
            data.Columns[0].Name = "종목코드";
            data.Columns[1].Name = "종목명";
            data.Columns[data.Columns.Count - 1].Name = "AC";
            var now = DateTime.Now;

            for (int i = 2; i < data.ColumnCount - 1; i++)
            {
                var quarter = GetQuarter(now.AddMonths(i == 2 ? 1 : ((i - 2) * 3) + 1));
                data.Columns[i].Name = quarter;
                var split = quarter.Split('/');
                string.Concat("label", label[i - 2], "Quarter").FindByName <Label>(this).Text = string.Concat("'", split[0], "년 ", split[1].Replace("0", string.Empty), "월");
            }
            data.SortCompare += DataSortCompare;
            data.CellClick   += DataCellClick;
            buttonSave.Click += ButtonClick;
            link.Click       += ButtonClick;
        }
示例#9
0
        public async Task <string> SetPrivacy(Privacies privacy)
        {
            Privacy = privacy;
            string str = "도깨비방망이";

            if (string.IsNullOrEmpty(privacy.Account) == false)
            {
                switch (privacy.Account)
                {
                case "F":
                    if (comboCommission.Items.Count == 0 && comboStrategics.Items.Count == 0)
                    {
                        foreach (var commission in commissionFutures)
                        {
                            comboCommission.Items.Add(commission.ToString("P4"));
                        }

                        comboStrategics.Items.AddRange(new object[] { tf });
                    }
                    str    = "선물옵션";
                    Length = 8;
                    comboCommission.SelectedIndex = Array.FindIndex(commissionFutures, o => o == privacy.Commission);
                    break;

                case "S":
                    if (comboCommission.Items.Count == 0 && comboStrategics.Items.Count == 0)
                    {
                        foreach (var commission in commissionStocks)
                        {
                            comboCommission.Items.Add(commission.ToString("P3"));
                        }

                        comboStrategics.Items.AddRange(new object[] { st, ts });
                    }
                    str    = "위탁종합";
                    Length = 6;
                    comboCommission.SelectedIndex = Array.FindIndex(commissionStocks, o => o == privacy.Commission);
                    break;
                }
                if (await client.GetContext(new Codes {
                }, Length) is List <Codes> list)
                {
                    var stack = new Stack <Codes>();

                    foreach (var item in list)
                    {
                        if (FilteringItems(item))
                        {
                            stack.Push(item);
                        }
                    }

                    string[] codes = new string[stack.Count], names = new string[stack.Count];

                    while (stack.Count > 0)
                    {
                        var temp = stack.Pop();

                        if (Codes.Add(temp))
                        {
                            codes[stack.Count] = temp.Code;
                            names[stack.Count] = temp.Name;
                        }
                    }
                    var source = new AutoCompleteStringCollection();
                    source.AddRange(codes);
                    source.AddRange(names);
                    textCode.AutoCompleteCustomSource = source;
                    textCode.AutoCompleteMode         = AutoCompleteMode.Append;
                    textCode.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                }
                if (string.IsNullOrEmpty(privacy.CodeStrategics) == false)
                {
                    SuspendLayout();

                    foreach (var strategics in privacy.CodeStrategics.Split(';'))
                    {
                        var color  = Color.FromArgb(0x79, 0x85, 0x82);
                        var select = Codes.FirstOrDefault(o => o.Code.Equals(strategics.Substring(2, Length)));
                        tab.Controls.Add(new TabPage
                        {
                            BackColor   = Color.Transparent,
                            BorderStyle = BorderStyle.FixedSingle,
                            ForeColor   = Color.Black,
                            Location    = new Point(4, 0x22),
                            Margin      = new Padding(0),
                            Name        = strategics.Substring(2, Length),
                            TabIndex    = Index++,
                            Text        = strategics.Substring(2, Length),
                            ToolTipText = strategics.Substring(0, 2)
                        });
                        switch (strategics.Substring(0, 2))
                        {
                        case string tf when tf.Equals("TF") && Length == 8:
                            if (select.MarginRate > 0 && string.IsNullOrEmpty(select.Price) == false)
                            {
                                var view = new TrendFollowingBasicFutures(select);

                                tab.TabPages[tab.TabPages.Count - 1].Controls.Add(view);
                                view.Dock = DockStyle.Fill;
                                view.TransmuteStrategics(strategics.Substring(10, 1).Equals("1"), strategics.Substring(11).Split('.'));
                                panel.RowStyles[0].Height = 0x83 + 0x23;
                            }

                            break;

                        case string ts when ts.Equals("TS") && Length == 6:
                            if (string.IsNullOrEmpty(select.MaturityMarketCap) == false && string.IsNullOrEmpty(select.Price) == false)
                            {
                                var view = new TrendsInStockPrices(select);

                                tab.TabPages[tab.TabPages.Count - 1].Controls.Add(view);
                                view.Dock = DockStyle.Fill;
                                view.TransmuteStrategics(strategics.Substring(8).Split('.'));
                                panel.RowStyles[0].Height = 0xCD + 0x23;
                            }

                            break;
                        }
                        var lasttabrect = tab.GetTabRect(tab.TabPages.Count - 1);
                        tab.TabPages[tab.TabPages.Count - 1].BackColor = color;
                        tab.SelectTab(tab.TabPages.Count - 1);
                        tab.CreateGraphics().FillRectangle(new SolidBrush(color), new RectangleF(lasttabrect.X + lasttabrect.Width + tab.Left, tab.Top + lasttabrect.Y, tab.Width - (lasttabrect.X + lasttabrect.Width), lasttabrect.Height));
                    }
                    ResumeLayout();
                }
            }
            return(str);
        }
示例#10
0
 static void StartProgress(dynamic client, ISecuritiesAPI <SendSecuritiesAPI> api, Privacies privacy) => Application.Run(new SecuritiesAPI(new Consensus(privacy.Security), client, privacy, api));
示例#11
0
 static void StartProgress(ISecuritiesAPI api, Privacies privacy) => Application.Run(new SecuritiesAPI(privacy, api));