Ejemplo n.º 1
0
 public static void Debug_SumYK()
 {
     U_Console.ClearDenbug();
     DebugTitle("e累计盈亏↓");
     RequestTxS();
     txS.Sort((a, b) => - a.sumYK.CompareTo(b.sumYK));
     StockTx.DebugList(txS);
     DebugSum(todayYK, toadyYKRate, sumYK, sumCB, sumSZ);
 }
Ejemplo n.º 2
0
 public void EndUpdate()
 {
     U_Console.ClearDenbug(true);
     isDebugStock = false;
 }
Ejemplo n.º 3
0
        IEnumerator RequestTx(SortType sortType)
        {
            List <StockTx> stockTxS   = new List <StockTx>();
            float          sumSZ      = 0;
            float          sumYK      = 0;
            float          allLastSZ  = 0;
            float          todayAllYK = 0;
            float          sumCB      = 0;

            float          toadyAllYKRate = 0;
            List <StockDb> dbS            = GetAllDbS(enShowType);

            foreach (StockDb db in dbS)
            {
                string url = 拼接Url(db.id);
                WWW    www = new WWW(url);
                yield return(www);

                StockTx tx = new StockTx(www.text);
                tx.sz             = db.count * float.Parse(tx.nowPri);
                tx.todayYingkui   = tx.increase * db.count;//这样计算,当天买卖,盈利是有问题的。
                tx.cbPri          = db.cbPrice;
                tx.sumYK          = db.count * float.Parse(tx.nowPri) - db.cb;
                tx.allYingkuiRate = tx.sumYK / db.cb * 100;
                tx.ratio          = db.ratio;
                sumSZ            += tx.sz;
                sumYK            += tx.sumYK;
                sumCB            += db.cb;
                stockTxS.Add(tx);
                allLastSZ  += float.Parse(tx.lastDayPri) * db.count;
                todayAllYK += tx.todayYingkui;
            }
            float allSelledYK = GetSelledIncrease(enShowType);

            if (!isOnlyShowChiCang)
            {
                sumYK += allSelledYK;
            }
            string total = "";

            if (stockTxS.Count == dbS.Count)
            {
                toadyAllYKRate = todayAllYK / allLastSZ;
                total          = DebugSum_WithoutZhishu(todayAllYK, toadyAllYKRate, sumYK, sumCB, sumSZ) + "|";
            }
            #region Zhishu
            List <string> zhishuS = new List <string>()
            {
                "000001", "399001", "399006"
            };
            List <StockTx> zhishuTx = new List <StockTx>();
            foreach (var item in zhishuS)
            {
                string url = 拼接Url(item);
                WWW    www = new WWW(url);
                yield return(www);

                if (www.error != null)
                {
                    Debug.LogError("获取地址错误");
                    yield break;
                }
                string  res = www.text;
                StockTx tx  = new StockTx(res);
                zhishuTx.Add(tx);
            }
            string strZhishuInfo;
            if (zhishuTx.Count == 3)
            {
                StockTx sh = zhishuTx.FirstOrDefault(s => s.id == "000001");
                StockTx sz = zhishuTx.FirstOrDefault(s => s.id == "399001");
                StockTx cy = zhishuTx.FirstOrDefault(s => s.id == "399006");
                if (show指数数值)
                {
                    strZhishuInfo = "上" + float.Parse(sh.nowPri).ToStringF0() + " " + sh.increPer.ToStringF2() + "%"
                                    + "  创" + float.Parse(cy.nowPri).ToStringF0() + " " + cy.increPer.ToStringF2() + "%"
                                    + "  深" + float.Parse(sz.nowPri).ToStringF0() + " " + sz.increPer.ToStringF2() + "%\t|";
                }
                else
                {
                    strZhishuInfo = "上" + cy.increPer.ToStringF2() + "%  创" + sz.increPer.ToStringF2() + "%  深" + sz.increPer.ToStringF2() + "%\t|";
                }
                if (isDebugStock)
                {
                    U_Console.ClearDenbug();
                    //最终是在此处打印的,是为了让他同一时间闪出来,控制台刷新感更小
                    DebugStockS(stockTxS, sortType);
                    if (isShowSelledYK)
                    {
                        if (allSelledYK > 0)
                        {
                            Debug.Log("清仓累计:\t+" + allSelledYK);
                        }
                        else
                        {
                            Debug.Log("清仓累计:\t" + allSelledYK);
                        }
                    }
                    if (isIndexAndTotalSameLine)
                    {
                        Debug.Log(total + "  " + strZhishuInfo);
                    }
                    else
                    {
                        Debug.Log(total);
                        Debug.Log(strZhishuInfo);
                    }
                }
            }
            #endregion
        }
 public static void ClearDenbug()
 {
     U_Console.ClearDenbug();
 }