Пример #1
0
        void StartProgress()
        {
            foreach (var quotes in Retrieve.Quotes)
            {
                if (quotes.Price != null && quotes.Volume != null)
                {
                    SendDatum?.Invoke(this, new Datum(quotes.Time, quotes.Price));

                    continue;
                }
                SendQuotes?.Invoke(this, new Quotes(quotes.Time, quotes.SellPrice, quotes.BuyPrice, quotes.SellQuantity, quotes.BuyQuantity, quotes.SellAmount, quotes.BuyAmount));
            }
        }
Пример #2
0
        int StartProgress(int length)
        {
            if (length > 2)
            {
                foreach (var quotes in Retrieve.Quotes)
                {
                    if (quotes.Price != null && quotes.Volume != null)
                    {
                        SendDatum?.Invoke(this, new Datum(quotes.Time, quotes.Price, quotes.Volume));

                        continue;
                    }
                    SendQuotes?.Invoke(this, new Quotes(quotes.Time, quotes.SellPrice, quotes.BuyPrice, quotes.SellQuantity, quotes.BuyQuantity, quotes.SellAmount, quotes.BuyAmount));
                }
                foreach (var qe in Retrieve.QuotesEnumerable)
                {
                    foreach (var quotes in qe.Value)
                    {
                        if (quotes.Price != null && quotes.Volume != null)
                        {
                            SendDatum?.Invoke(this, new Datum(quotes.Time, quotes.Price, quotes.Volume));

                            continue;
                        }
                        SendQuotes?.Invoke(this, new Quotes(quotes.Time, quotes.SellPrice, quotes.BuyPrice, quotes.SellQuantity, quotes.BuyQuantity, quotes.SellAmount, quotes.BuyAmount));
                    }
                }
                if (games.Count > 0 && SetStatisticalStorage(games) == false)
                {
                    Message = new Secret().Message;
                }
            }
            else
            {
                foreach (var kv in Retrieve.Charts)
                {
                    foreach (var chart in kv.Value)
                    {
                        SendDatum?.Invoke(this, new Datum(chart.Date, chart.Price, chart.Volume));
                    }
                }

                if (Charts.Count > 0 && SetBasicChart(Charts) && games.Count > 0 && SetStatisticalBulkStorage(games) == false)
                {
                    Message = new Secret().Message;
                }
            }
            return(statement == null ? 0 : statement.Count);
        }
Пример #3
0
 void FixUp(string[] param, string code)
 {
     if (code.Equals(API.GetFutureCodeByIndex(0)))
     {
         SendQuotes?.Invoke(this, new Quotes(new string[]
         {
             param[0],
             param[1],
             param[2],
             param[3],
             param[4],
             param[5],
             param[6],
             param[7],
             param[8],
             param[9]
         }, new string[]
         {
             param[15],
             param[16],
             param[17],
             param[18],
             param[19],
             param[20],
             param[21],
             param[22],
             param[23],
             param[24]
         }, new string[]
         {
             param[10],
             param[11],
             param[12],
             param[13],
             param[14],
             param[25],
             param[26],
             param[27],
             param[28],
             param[29]
         }, param[32], SellOrder, BuyOrder, string.Empty));
     }
     SetInsertCode(code, param[72], param[63]);
 }
Пример #4
0
        void OnReceiveRealData(object sender, _DKHOpenAPIEvents_OnReceiveRealDataEvent e)
        {
            var sb    = new StringBuilder(512);
            int index = Array.FindIndex(Enum.GetNames(typeof(RealType)), o => o.Equals(e.sRealType));

            if (index < 0)
            {
                return;
            }

            foreach (int fid in catalogReal[index])
            {
                sb.Append(API.GetCommRealData(e.sRealKey, fid)).Append(';');
            }

            var param = sb.ToString().Split(';');

            switch (index)
            {
            case 0b1:
                if (e.sRealKey.Equals(Code))
                {
                    SendDatum?.Invoke(this, new Datum(param));
                    SendTrend?.Invoke(this, new Trends(Trend, Volume));
                }
                return;

            case 0b10:
                if (e.sRealKey.Equals(Code))
                {
                    SendQuotes?.Invoke(this, new Quotes(new string[]
                    {
                        param[35],
                        param[27],
                        param[19],
                        param[11],
                        param[3],
                        param[7],
                        param[15],
                        param[23],
                        param[31],
                        param[39]
                    }, new string[]
                    {
                        param[36],
                        param[28],
                        param[20],
                        param[12],
                        param[4],
                        param[8],
                        param[16],
                        param[24],
                        param[32],
                        param[40]
                    }, new string[]
                    {
                        param[38],
                        param[30],
                        param[22],
                        param[14],
                        param[6],
                        param[10],
                        param[18],
                        param[26],
                        param[34],
                        param[42]
                    }, param[0], SellOrder, BuyOrder, string.Concat(param[44], ";", param[47])));
                }
                return;

            case 0b1000:
                if (e.sRealKey.Equals(Code))
                {
                    SendCurrent?.Invoke(this, new Current(Quantity, param));
                }

                return;

            case 0b1001:
                if (param[0].Equals("e") && DeadLine)
                {
                    DeadLine = false;

                    if (Temporary != null)
                    {
                        Temporary.SetStorage(Code);
                        SendCount?.Invoke(this, new NotifyIconText(-106));
                    }
                    else
                    {
                        OnReceiveBalance = false;
                    }
                }
                else if (param[0].Equals("3") && DeadLine == false)
                {
                    DeadLine           = true;
                    Delay.Milliseconds = 205;

                    if (Temporary == null || Collector)
                    {
                        OnReceiveBalance = true;
                    }
                }
                break;

            case 0xA:
                SendStocksDatum?.Invoke(this, new Stocks(e.sRealKey, param));
                return;

            case 0xB:
                SendStocksQuotes?.Invoke(this, new StocksQuotes(e.sRealKey, param[0b100]));
Пример #5
0
        private void OnReceiveData(string szTrCode)
        {
            Sb = new StringBuilder(128);

            foreach (var block in Array.Find(catalog, o => o.ToString().Contains(szTrCode.Substring(1))).GetOutBlock(Query.GetResData()))
            {
                for (int i = 0; i < Query.GetBlockCount(block.Name); i++)
                {
                    Sb.Append(Query.GetFieldData(block.Name, block.Field, i)).Append(';');
                }
            }

            switch (szTrCode)
            {
            case "t9943":
                foreach (var str in Sb.ToString().Split(';'))
                {
                    if (str.Substring(0, 3).Equals("101"))
                    {
                        new Secret(str);
                        SendCount?.Invoke(this, new NotifyIconText(Query.GetAccountName(Secret.Account), Query.GetAcctDetailName(Secret.Account), Query.GetAcctNickname(Secret.Account), str));
                        SellOrder = new Dictionary <string, double>();
                        BuyOrder  = new Dictionary <string, double>();
                        Trend     = new Dictionary <string, string>();
                        Real      = new Dictionary <string, XARealClass>();
                        Total     = new Queue <string>();

                        if (Query.LoadFromResFile(string.Concat(Path, "t2105.res")))
                        {
                            foreach (var block in new T2105().GetInBlock(Query.GetResData()))
                            {
                                Query.SetFieldData(block.Name, block.Field, block.Occurs, block.Property);
                            }

                            Delay.delay = 1000 / Query.GetTRCountPerSec("t2105");
                            request.RequestTrData(new Task(() => SendErrorMessage(Query.Request(false))));
                        }
                        if (TimerBox.Show(Secret.OnReceiveData, Secret.GoblinBat, MessageBoxButtons.OK, MessageBoxIcon.Information, 13579).Equals(DialogResult.OK))
                        {
                            foreach (var kv in real)
                            {
                                SetAPI(kv);
                            }

                            LookUpTheBalance();
                            SendCount?.Invoke(this, new NotifyIconText(7));
                        }
                        return;
                    }
                }
                return;

            case "t2105":
                LookUpTheDeposit();
                var quotes = Sb.ToString().Split(';');
                Name = quotes[0];
                SendQuotes?.Invoke(this, new Quotes(new string[]
                {
                    quotes[32],
                    quotes[26],
                    quotes[20],
                    quotes[14],
                    quotes[8],
                    quotes[9],
                    quotes[15],
                    quotes[21],
                    quotes[27],
                    quotes[33]
                }, new string[]
                {
                    quotes[34],
                    quotes[28],
                    quotes[22],
                    quotes[16],
                    quotes[10],
                    quotes[11],
                    quotes[17],
                    quotes[23],
                    quotes[29],
                    quotes[35]
                }, new string[]
                {
                    quotes[36],
                    quotes[30],
                    quotes[24],
                    quotes[18],
                    quotes[12],
                    quotes[13],
                    quotes[19],
                    quotes[25],
                    quotes[31],
                    quotes[37]
                }, quotes[42], SellOrder, BuyOrder, string.Empty));
                return;

            case "CFOBQ10500":
                var temp = Sb.ToString().Split(';');
                SendDeposit?.Invoke(this, new Deposit(new string[]
                {
                    temp[5],
                    temp[6],
                    temp[7],
                    temp[14],
                    temp[15],
                    string.Empty,
                    temp[16],
                    temp[17],
                    string.Empty,
                    temp[18],
                    temp[19],
                    string.Empty,
                    temp[23],
                    temp[20],
                    temp[21],
                    temp[11],
                    temp[12],
                    temp[13],
                    temp[8],
                    temp[9],
                    temp[24],
                    string.Empty,
                    temp[10],
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty
                }));
                return;

            case "t0441":
                if (Query.IsNext)
                {
                    Console.WriteLine(Secret.Account + "\t" + Sb);
                    var bal = Sb.ToString().Split(';');
                    SendBalance?.Invoke(this, new Balance(new string[]
                    {
                        bal[10],
                        Name,
                        bal[11],
                        bal[12],
                        bal[14],
                        bal[19],
                        bal[21],
                        bal[13],
                        bal[15],
                        bal[20]
                    }));
                }
                else
                {
                    var cts = Sb.ToString().Split(';');

                    if (cts[1].Equals(string.Empty) && cts[2].Equals(string.Empty))
                    {
                        return;
                    }

                    new Secret(cts[1], cts[2]);

                    foreach (var block in new T0441().GetInBlock(Query.GetResData()))
                    {
                        Query.SetFieldData(block.Name, block.Field, block.Occurs, block.Property);
                    }

                    Delay.delay = 1000 / Query.GetTRCountPerSec("t0441");
                    request.RequestTrData(new Task(() => SendErrorMessage(Query.Request(true))));
                }
                return;
            }
        }