Exemple #1
0
        protected internal override void OnReceiveData(string szTrCode)
        {
            var enumerable = GetOutBlocks();
            int i = 0, count = enumerable.Count - 1;

            string[] temp = new string[count];

            while (enumerable.Count > 0)
            {
                var param = enumerable.Dequeue();

                if (count > enumerable.Count)
                {
                    temp[i++] = GetFieldData(param.Block, param.Field, 0);
                }
            }
            var codes   = ConnectAPI.Codes.First(o => o.Code.Equals(Code));
            var refresh = new Codes
            {
                Code              = Code,
                Name              = temp[0x33].Trim(),
                MarginRate        = codes.MarginRate * (double.TryParse(temp[62], out double transactionMutiplier) ? transactionMutiplier : 0),
                MaturityMarketCap = temp[0x16].Substring(2),
                Price             = temp[1]
            };

            if (ConnectAPI.Codes.Remove(codes) && ConnectAPI.Codes.Add(refresh) &&
                GoblinBatClient.GetInstance().PutContext <Codes>(refresh).Result is int statusCode && statusCode == 0xC8 &&
                GetTRCountRequest(szTrCode) == 1)
            {
                Delay.Milliseconds = 0x3E8 / GetTRCountPerSec(szTrCode);
            }
        }
Exemple #2
0
        protected internal override void OnReceiveData(string szTrCode)
        {
            var enumerable = GetOutBlocks();
            int i = 0, count = enumerable.Count - 1;

            string[] temp = new string[count];

            while (enumerable.Count > 0)
            {
                var param = enumerable.Dequeue();

                if (count > enumerable.Count)
                {
                    temp[i++] = GetFieldData(param.Block, param.Field, 0);
                }
            }
            var codes   = ConnectAPI.Codes.First(o => o.Code.Equals(temp[0x3C]));
            var refresh = new Codes
            {
                Code              = temp[0x3C],
                Name              = codes.Code.StartsWith("1") ? temp[0].Split('F')[0].Trim() : temp[0].Remove(temp[0].Length - 2, 2),
                MarginRate        = codes.MarginRate,
                MaturityMarketCap = temp[0x17].Substring(2),
                Price             = temp[1]
            };

            if (ConnectAPI.Codes.Remove(codes) && ConnectAPI.Codes.Add(refresh) && GoblinBatClient.GetInstance().PutContext <Codes>(refresh).Result is int statusCode && statusCode == 0xC8 && GetTRCountRequest(szTrCode) == 1)
            {
                Delay.Milliseconds = 0x3E8 / GetTRCountPerSec(szTrCode);
            }
        }
Exemple #3
0
        internal Temporary(int length)
        {
            client = GoblinBatClient.GetInstance();

            if (CodeStorage == null)
            {
                CallUpTheCodesAsync(length).Wait();
            }
        }
Exemple #4
0
 public GoblinBat(dynamic cookie)
 {
     this.cookie = cookie;
     InitializeComponent();
     random             = new Random();
     client             = GoblinBatClient.GetInstance(cookie);
     strip.ItemClicked += OnItemClick;
     StartProgress(new Catalog.Privacies {
         Security = cookie
     });
 }
Exemple #5
0
        static void Main(string[] args)
        {
            var secrecy = new Secrecy();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (args != null && args.Length > 0)
            {
                var api = secrecy.GetPrivacyShare(args[0]);
                StartProgress(GoblinBatClient.GetInstance(args), api.Item1 ?? secrecy.GetAPI(GetResult(secrecy.Choose, secrecy.Name), args[0]), api.Item2);
            }
            GC.Collect();
            Process.GetCurrentProcess().Kill();
        }
Exemple #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();
 }
Exemple #7
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;
        }
Exemple #8
0
        internal IEnumerable <string> GetInformationOfCode(List <string> list, string[] market)
        {
            string exclusion, date = DistinctDate;

            Delay.Milliseconds = 0x259;

            for (int i = 2; i < 4; i++)
            {
                foreach (var om in axAPI.GetActPriceList().Split(';'))
                {
                    exclusion = axAPI.GetOptionCode(om.Insert(3, "."), i, date);

                    if (list.Exists(o => o.Equals(exclusion)))
                    {
                        continue;
                    }

                    list.Add(exclusion);
                }
            }
            Parallel.ForEach(Enum.GetNames(typeof(Market)), new ParallelOptions
            {
                MaxDegreeOfParallelism = (int)(Environment.ProcessorCount * 0.5)
            }, new Action <string>(async(sMarket) =>
            {
                if (Enum.TryParse(sMarket, out Market param))
                {
                    switch (param)
                    {
                    case Market.장내:
                    case Market.코스닥:
                    case Market.ETF:
                        for (int i = 0; i < market.Length; i++)
                        {
                            var state = axAPI.GetMasterStockState(market[i]);

                            if (state.Contains("거래정지") && await GoblinBatClient.GetInstance().PutContext <Codes>(new Codes
                            {
                                Code = market[i],
                                Name = axAPI.GetMasterCodeName(market[i]),
                                MaturityMarketCap = state,
                                Price = axAPI.GetMasterLastPrice(market[i])
                            }) < int.MaxValue)
                            {
                                market[i] = string.Empty;
                            }
                        }
                        break;

                    default:
                        foreach (var str in axAPI.GetCodeListByMarket(((int)param).ToString()).Split(';'))
                        {
                            var index = Array.FindIndex(market, o => o.Equals(str));

                            if (index > -1)
                            {
                                market[index] = string.Empty;
                            }
                        }
                        break;
                    }
                }
            }));
            var stack = CatalogStocksCode(market.OrderByDescending(o => o));

            list[1] = axAPI.GetFutureCodeByIndex(0x18);
            list.Add(axAPI.GetFutureCodeByIndex(0xD));

            foreach (var str in axAPI.GetSFutureList(string.Empty).Split('|'))
            {
                if (string.IsNullOrEmpty(str) == false)
                {
                    var temp = str.Split('^');

                    if (temp[2].Equals(date) == false)
                    {
                        list.Add(temp[0]);
                    }

                    date = temp[2];
                }
            }
            while (stack.Count > 0)
            {
                yield return(stack.Pop());
            }

            foreach (var code in list)
            {
                yield return(code);
            }
        }
Exemple #9
0
 public HoldingStocks(ScenarioAccordingToTrend strategics, Tuple <List <ConvertConsensus>, List <ConvertConsensus> > consensus, GoblinBatClient client) : base(strategics)
 {
     OrderNumber     = new Dictionary <string, dynamic>();
     Consensus       = consensus;
     this.strategics = strategics;
     this.client     = client;
 }
Exemple #10
0
        protected async Task MoveStorageSpace(char initial)
        {
            try
            {
                var client = GoblinBatClient.GetInstance(initial.ToString());
                var stack  = new Stack <string>();
                using (var db = new GoblinBatDbContext(key))
                    foreach (var temp in db.Codes.OrderBy(o => o.Code).Select(o => new { o.Code, o.Name, o.Info }).AsNoTracking())
                    {
                        stack.Push(temp.Code);
                    }

                while (stack.Count > 0)
                {
                    Catalog.Retention retention;
                    var code    = stack.Pop();
                    var stocks  = new Queue <Emergency.Stocks>(1024);
                    var options = new Queue <Emergency.Options>(1024);
                    var futures = new Queue <Emergency.Futures>(1024);

                    if (code.Length == 8 && (code.StartsWith("101") || code.StartsWith("106")))
                    {
                        using (var db = new GoblinBatDbContext(key))
                            foreach (var f in db.Futures.Where(o => o.Code.Equals(code)).AsNoTracking().OrderBy(o => o.Date))
                            {
                                futures.Enqueue(new Emergency.Futures
                                {
                                    Code      = f.Code,
                                    Date      = f.Date.ToString(),
                                    Price     = f.Price.ToString(),
                                    Volume    = f.Volume,
                                    Retention = f.Date.ToString().Substring(0, 12)
                                });
                                if (futures.Count > 2000000)
                                {
                                    retention = await client.EmergencyContext(futures);

                                    futures.Clear();
                                }
                            }
                        retention = await client.EmergencyContext(futures);
                    }
                    if (code.Length == 8 && (code.StartsWith("2") || code.StartsWith("3")))
                    {
                        using (var db = new GoblinBatDbContext(key))
                            foreach (var o in db.Options.Where(o => o.Code.Equals(code)).AsNoTracking().OrderBy(o => o.Date))
                            {
                                options.Enqueue(new Emergency.Options
                                {
                                    Code      = o.Code,
                                    Date      = o.Date.ToString(),
                                    Price     = o.Price.ToString(),
                                    Volume    = o.Volume,
                                    Retention = o.Date.ToString().Substring(0, 12)
                                });
                                if (options.Count > 2000000)
                                {
                                    retention = await client.EmergencyContext(options);

                                    options.Clear();
                                }
                            }
                        retention = await client.EmergencyContext(options);
                    }
                    if (code.Length == 6)
                    {
                        using (var db = new GoblinBatDbContext(key))
                            foreach (var s in db.Stocks.Where(o => o.Code.Equals(code)).AsNoTracking().OrderBy(o => o.Date))
                            {
                                stocks.Enqueue(new Emergency.Stocks
                                {
                                    Code      = s.Code,
                                    Date      = s.Date.ToString(),
                                    Price     = s.Price.ToString(),
                                    Volume    = s.Volume,
                                    Retention = s.Date.ToString().Substring(0, 12)
                                });
                                if (stocks.Count > 2000000)
                                {
                                    retention = await client.EmergencyContext(stocks);

                                    stocks.Clear();
                                }
                            }
                        retention = await client.EmergencyContext(stocks);
                    }
                    SendMessage(stack.Count);
                }
            }
            catch (Exception ex)
            {
                new ExceptionMessage(ex.StackTrace);
            }
        }
Exemple #11
0
 internal Temporary(int length)
 {
     client = GoblinBatClient.GetInstance();
     CallUpTheCodesAsync(length).Wait();
 }