Example #1
0
        /// <summary>
        /// 预告净利润同比增长下限
        /// </summary>
        /// <param name="strWindCode"></param>
        /// <param name="dtReportDate"></param>
        public static WindData windProfitNoticeChangeMin(String strWindCode, DateTime dtReportDate)
        {
            WindData wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "profitnotice_changemin", dtReportDate, dtReportDate);

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Example #2
0
    // public void doubleArraySize()
    // {
    //     size = 300;
    //     Vector3[,,] newWindArray = new Vector3[size * 2, size * 2, size * 2];
    //     int halfSize = size / 2;
    //     for (int i = 0; i < size; i++)
    //     {
    //         for (int j = 0; j < size; j++)
    //         {
    //             for (int k = 0; k < size; k += 8)
    //             {
    //                 newWindArray[i + halfSize, j + halfSize, k + 0] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 1] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 2] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 3] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 4] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 5] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 6] = windArray[i, j, k + 0];
    //                 newWindArray[i + halfSize, j + halfSize, k + 7] = windArray[i, j, k + 0];
    //             }
    //         }
    //     }


    //     for (int i = 0; i < halfSize; i++)
    //     {
    //         for (int j = 0; j < halfSize; j++)
    //         {
    //             for (int k = 0; k < halfSize; k += 8)
    //             {
    //                 newWindArray[i, j, k + 0] = Vector3.zero;
    //                 newWindArray[i, j, k + 1] = Vector3.zero;
    //                 newWindArray[i, j, k + 2] = Vector3.zero;
    //                 newWindArray[i, j, k + 3] = Vector3.zero;
    //                 newWindArray[i, j, k + 4] = Vector3.zero;
    //                 newWindArray[i, j, k + 5] = Vector3.zero;
    //                 newWindArray[i, j, k + 6] = Vector3.zero;
    //                 newWindArray[i, j, k + 7] = Vector3.zero;
    //             }
    //         }
    //     }

    //     size = size * 2;
    //     for (int i = halfSize; i < size; i++)
    //     {
    //         for (int j = halfSize; j < size; j++)
    //         {
    //             for (int k = halfSize; k < size; k += 8)
    //             {
    //                 newWindArray[i, j, k + 0] = Vector3.zero;
    //                 newWindArray[i, j, k + 1] = Vector3.zero;
    //                 newWindArray[i, j, k + 2] = Vector3.zero;
    //                 newWindArray[i, j, k + 3] = Vector3.zero;
    //                 newWindArray[i, j, k + 4] = Vector3.zero;
    //                 newWindArray[i, j, k + 5] = Vector3.zero;
    //                 newWindArray[i, j, k + 6] = Vector3.zero;
    //                 newWindArray[i, j, k + 7] = Vector3.zero;
    //             }
    //         }
    //     }
    // }

    public void addObject(WindData data)
    {
        windObjectsData.Add(data.index, data);
        Vector3[ , , ] windArray = null;

        switch (data.geometryData.geometryType)
        {
        case GeometryData.GeometryType.CUBE:
            windArray = getCubeWindArray((CubeGeometryData)data.geometryData, data.intensity, data.interference);
            break;

        case GeometryData.GeometryType.SPHERE:
            windArray = getSphereWindArray((SphereGeometryData)data.geometryData, data.intensity, data.interference);
            break;

        case GeometryData.GeometryType.CYLINDER:
            windArray = getCylinderWindArray((CylinderGeometryData)data.geometryData, data.intensity, data.interference);
            break;

        default:
            break;
        }
        windArrayData.Add(data.index, windArray);

        addUpdateArray(data.index);
    }
Example #3
0
        /// <summary>
        /// 風の有効フラグ切り替え
        /// </summary>
        /// <param name="windId"></param>
        /// <param name="sw"></param>
        public void SetEnable(int windId, bool sw, Transform target)
        {
            if (windId >= 0)
            {
                WindData data = windDataList[windId];
                data.SetEnable(sw);

                // 連動トランスフォームを登録/解除
                if (sw)
                {
                    if (data.transformIndex == -1)
                    {
                        data.transformIndex = Bone.AddBone(target);
                    }
                }
                else
                {
                    if (data.transformIndex >= 0)
                    {
                        Bone.RemoveBone(data.transformIndex);
                        data.transformIndex = -1;
                    }
                }

                windDataList[windId] = data;
            }
        }
Example #4
0
 /// <summary>
 /// Check the data returned by Wind is correct
 /// </summary>
 /// <param name="wd">Wind Data Format</param>
 public static void windEnsureNoErr(WindData wd)
 {
     if (wd.errorCode != 0)
     {
         throw new Exception("windEnsureConnect: " + wd.GetErrorMsg());
     }
 }
Example #5
0
        public static MTable getTable(WindData wd, params object[] colTypes)
        {
            MTable ret = new MTable();

            ret.FillTable(getRecords(wd, colTypes));
            return(ret);
        }
Example #6
0
        private void Excute_Click(object sender, EventArgs e)
        {
            InitializeChart();
            this.myChart.Series.Clear();

            string strStartDate = this.startDateTimePicker.Text;
            string strEndDate   = this.endDateTimePicker.Text;

            WindAPI w = new WindAPI();

            w.start();

            WindData wd = null;

            if (this.radioButton_KQ.Checked)
            {
                wd = w.edb("M5407921", strStartDate, strEndDate, "");
            }
            else
            {
                wd = w.edb("M0000272", strStartDate, strEndDate, "");
            }

            w.stop();

            UpdateChart(wd);
        }
Example #7
0
        public static void test1()
        {
            WindAPI w = new WindAPI();

            w.start();
            WindData wd = w.wsi("510050.SH", "open,high,low,close", "2016-07-26 09:00:00", "2016-07-26 14:56:12", "");
        }
Example #8
0
        private void UpdateChart(WindData wd)
        {
            SetChartTitle();

            if (wd.GetDataLength() < 1 || wd.GetTimeLength() < 1)
            {
                return;
            }

            if (!(wd.data is double[]))
            {
                return;
            }
            double[] closeData = (double[])wd.data;
            if (closeData.Length != wd.GetTimeLength())
            {
                return;
            }

            AddChartSerie();
            Series ser     = this.myChart.Series[0];
            double dClose  = 0.0;
            string strDate = string.Empty;

            for (int i = 0; i < closeData.Length; i++)
            {
                dClose = closeData[i];
                ser.Points.AddXY(wd.timeList[i].ToString("yy/MM"), dClose);
            }
        }
Example #9
0
        public List <OptionInfo> readFromWind(string underlying = "510050.SH", string market = "sse")
        {
            string marketStr = "";

            if (market == "sse")
            {
                marketStr = ".SH";
            }
            WindAPI           wapi     = Platforms.GetWindAPI();
            WindData          wd       = wapi.wset("optioncontractbasicinfo", "exchange=" + market + ";windcode=" + underlying + ";status=all");
            int               len      = wd.codeList.Length;
            int               fieldLen = wd.fieldList.Length;
            List <OptionInfo> items    = new List <OptionInfo>(len);

            object[] dm = (object[])wd.data;
            for (int k = 0; k < len; k++)
            {
                items.Add(new OptionInfo
                {
                    optionCode         = (string)dm[k * fieldLen + 0] + marketStr,
                    optionName         = (string)dm[k * fieldLen + 1],
                    executeType        = (string)dm[k * fieldLen + 5],
                    strike             = (double)dm[k * fieldLen + 6],
                    contractMultiplier = (double)dm[k * fieldLen + 7],
                    optionType         = (string)dm[k * fieldLen + 4],
                    startDate          = (DateTime)dm[k * fieldLen + 9],
                    endDate            = (DateTime)dm[k * fieldLen + 10]
                });
            }
            return(items);
        }
Example #10
0
        public static WindData fetchOHLCInfo(String strWindCode, DateTime dtBegin, DateTime dtEnd)
        {
            WindData wd = ConnWind.w.wsd(strWindCode, "open,high,low,close", dtBegin.ToShortDateString(), dtEnd.ToShortDateString(), "");

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Example #11
0
        public static WindData windNetProfitBelongToParComSH(String strWindCode, DateTime dtReportDate)
        {
            WindData wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "np_belongto_parcomsh", dtReportDate, dtReportDate, "rptType=1");

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Example #12
0
    void Start()
    {
        updateParticlesKernel = ParticleUpdater.FindKernel("UpdateParticles");

        WindData[] data         = new WindData[ParticleCount];
        Vector4[]  positionData = new Vector4[ParticleCount];

        particlesBuffer         = new ComputeBuffer(ParticleCount, particleStride);
        particlePositionsBuffer = new ComputeBuffer(ParticleCount, particlePositionsStride);

        for (int i = 0; i < ParticleCount; i++)
        {
            data[i].originalPosition = GetRandomPointInCube();
            data[i].currentPosition  = data[i].originalPosition;
            data[i].time             = UnityEngine.Random.value * ParticleLifetime;
        }

        particlesBuffer.SetData(data);

        quadPoints = new ComputeBuffer(6, quadStride);
        quadPoints.SetData(new[]
        {
            new Vector3(-.5f, .5f),
            new Vector3(.5f, .5f),
            new Vector3(.5f, -.5f),
            new Vector3(.5f, -.5f),
            new Vector3(-.5f, -.5f),
            new Vector3(-.5f, .5f)
        });

        Texture3D assembledTexture = TextureGenerator.GetAssembledTexture();

        ParticleUpdater.SetTexture(updateParticlesKernel, "MapTexture", assembledTexture);
        ParticleMaterial.SetTexture("MapTexture", assembledTexture);
    }
        /// <summary>
        /// 从万德数据库中读取交易日信息数据。
        /// </summary>
        private void GetDataFromWindDataBase()
        {
            int theLastDay = 0;

            if (tradeDaysOfDataBase.Count > 0)
            {
                theLastDay = tradeDaysOfDataBase[tradeDaysOfDataBase.Count - 1];
            }
            //万德API接口的类。
            WindAPI w = new WindAPI();

            w.start();
            //从万德数据库中抓取交易日信息。
            WindData days = w.tdays("20100101", "20161231", "");

            //将万德中读取的数据转化成object数组的形式。
            object[] dayData = days.data as object[];
            foreach (object item in dayData)
            {
                DateTime today = (DateTime)item;
                int      now   = DateTimeToInt(today);
                if (now > theLastDay)
                {
                    tradeDaysOfDataBase.Add(now);
                }
            }
            w.stop();
        }
Example #14
0
        protected override List <OptionMinute> readFromWind(string code, DateTime date)
        {
            WindAPI  w = Platforms.GetWindAPI();
            DateTime date1 = date.Date, date2 = date.Date.AddDays(1);
            WindData wd       = w.wsi(code, "open,high,low,close,volume,amt,oi", date1, date2, "periodstart=09:30:00;periodend=15:00:00;Fill=Previous");
            int      len      = wd.timeList.Length;
            int      fieldLen = wd.fieldList.Length;

            var items = new List <OptionMinute>(len);

            if (wd.data is double[])
            {
                double[]   dataList = (double[])wd.data;
                DateTime[] timeList = wd.timeList;
                for (int k = 0; k < len; k++)
                {
                    items.Add(new OptionMinute
                    {
                        time         = timeList[k],
                        open         = (double)dataList[k * fieldLen + 0],
                        high         = (double)dataList[k * fieldLen + 1],
                        low          = (double)dataList[k * fieldLen + 2],
                        close        = (double)dataList[k * fieldLen + 3],
                        volume       = (double)dataList[k * fieldLen + 4],
                        amount       = (double)dataList[k * fieldLen + 5],
                        openInterest = (double)dataList[k * fieldLen + 6]
                    });
                }
            }

            return(items);
        }
Example #15
0
        /// <summary>
        /// 获取股票列表的信息。
        /// </summary>
        /// <param name="market">市场</param>
        /// <returns>商品期货信息列表</returns>
        public List <stockFormat> GetStockList(string indexName)
        {
            List <stockFormat> myList = new List <stockFormat>();
            //按日期遍历,添加股票信息。
            WindAPI w = new WindAPI();

            w.start();
            string[] dateStr = { "2013-06-01", "2013-12-01", "2014-06-01", "2014-12-01", "2015-06-01", "2015-12-01", "2016-06-01", "2016-06-20" };
            foreach (var item in dateStr)
            {
                WindData wd        = w.wset("sectorconstituent", "date=" + item + ";windcode=" + indexName);
                object[] stockList = wd.data as object[];
                int      num       = stockList.Length / 3;
                for (int i = 0; i < num; i++)
                {
                    stockFormat myStock = new stockFormat();
                    myStock.market = "SH";
                    myStock.code   = Convert.ToString(stockList[i * 3 + 1]).Substring(0, 6);
                    myStock.name   = (string)stockList[i * 3 + 2];
                    if (myList.Contains(myStock) == false)
                    {
                        myList.Add(myStock);
                    }
                }
            }
            w.stop();
            return(myList);
        }
Example #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            string accountID, password, accountType;

            accountID   = textBox1.Text;
            password    = textBox2.Text;
            accountType = types[comboBox3.SelectedIndex];
            WindData wd = w.tlogon("0000", "0", accountID, password, accountType, "");

            this.Visible = false;
            if (wd.errorCode == 0)
            {
                //MessageBox.Show("登录成功!");
                Form1        bmain = new Form1();
                DialogResult dr    = bmain.ShowDialog();
                if (dr == DialogResult.Cancel && showLogon)
                {
                    this.Visible = true;
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(Convert.ToString(((object[, ])wd.data)[4, 0]));
                this.Visible = true;
            }
        }
Example #17
0
        public void DoIt()
        {
            string  strErrorMsg;
            WindAPI w = new WindAPI();

            //登录WFT
            int nRetCode = w.start();

            if (0 != nRetCode)//登录失败
            {
                strErrorMsg = w.getErrorMsg(nRetCode);
                Console.Write(strErrorMsg);
                return;
            }

            //登录账号
            Console.Write("\r\ntlogon……");
            WindData wd         = w.tlogon("0000", "0", "w081496501", "******", "SHSZ");
            string   strLogonId = wd.GetLogonId();

            wd = w.tquery("Trade");

            return;

            //下单浦发银行
            wd = w.torder("600000.SH", "Buy", "12.0", "200", "OrderType=LMT;LogonID=" + strLogonId);//单账户登录可以不指定LogonId=1
            //获取下单ID
            string strRequestID1 = wd.GetOrderRequestID();

            Console.WriteLine("RequestID=" + strRequestID1);

            //下单白云机场
            wd = w.torder("600004.SH", "Buy", "12.00", "300", "OrderType=LMT;LogonID=" + strLogonId);//单账户登录可以不指定LogonId=1
            //获取下单ID
            string strRequestID2 = wd.GetOrderRequestID();

            //查询
            Console.WriteLine("query……");
            wd = w.tquery("Order", "RequestID=" + strRequestID1);
            //获取浦发银行OrderNumber
            string strOrderNumber = wd.GetOrderNumber();

            //浦发银行撤单
            Console.WriteLine("cancel……");
            wd = w.tcancel(strOrderNumber);

            //再次查询
            Console.WriteLine("query after cancel……");
            wd = w.tquery("Order");
            string strQueryInfoAfter = WindDataMethod.WindDataToString(wd, "tquery");

            Console.Write(strQueryInfoAfter);

            //登出
            Console.WriteLine("tlogout……");
            w.tlogout();

            //退出WindAPI
            w.stop();
        }
Example #18
0
        private string GetDataByFiledName(WindData wd, string strFiledName)
        {
            if (wd.errorCode != 0)
            {
                return(string.Empty);
            }

            int nFieldIndex = -1;

            for (int i = 0; i < wd.fieldList.Length; i++)
            {
                if (0 == string.Compare(wd.fieldList[i], strFiledName, true))
                {
                    nFieldIndex = i;
                    break;
                }
            }

            if (-1 == nFieldIndex)
            {
                return(string.Empty);
            }

            object[,] obj = (object[, ])wd.data;
            return(obj[nFieldIndex, 0].ToString());
        }
Example #19
0
        public static DataNode ParseItem(WindData item, string type)
        {
            object[,] result = (object[, ])item.getDataByFunc(type, false);

            if (item.GetFieldLength() < 3)
            {
                return(null);
            }

            string l = result[0, 2].ToString();

            if (l.Length == 5)
            {
                l = "0" + l;
            }

            DateTime t = DateTime.Now.Date;

            if (item.timeList != null)
            {
                t = item.timeList[0].Date;
            }

            t += DateTime.ParseExact(l, "HHmmss", CultureInfo.InvariantCulture).TimeOfDay;

            var info = new DataNode()
            {
                code   = item.codeList[0],
                price  = decimal.Parse(result[0, 0].ToString()),
                volume = int.Parse(result[0, 1].ToString()),
                time   = t,
            };

            return(info);
        }
Example #20
0
            public void getResult(ulong reqid, WindData data)
            {
                DataTable dt = WDDataAdapter.getRecords(data);
                List <DetailStringClass> retList = WDDataAdapter.GetList(dt);

                AfterUpdate(Data);
            }
Example #21
0
        protected override List <StockDaily> readFromWind(string code, DateTime dateStart, DateTime dateEnd, string tag = null, IDictionary <string, object> options = null)
        {
            WindAPI  w        = Platforms.GetWindAPI();
            WindData wd       = w.wsd(code, "open,high,low,close,volume,amt,adjfactor,settle,pre_close,pre_settle", dateStart, dateEnd, "Fill=Previous");
            int      len      = wd.timeList.Length;
            int      fieldLen = wd.fieldList.Length;

            var items = new List <StockDaily>(len * fieldLen);

            if (wd.data is double[])
            {
                double[]   dataList = (double[])wd.data;
                DateTime[] timeList = wd.timeList;
                for (int k = 0; k < len; k++)
                {
                    items.Add(new StockDaily
                    {
                        time         = timeList[k],
                        open         = dataList[k * fieldLen + 0],
                        high         = dataList[k * fieldLen + 1],
                        low          = dataList[k * fieldLen + 2],
                        close        = dataList[k * fieldLen + 3],
                        volume       = dataList[k * fieldLen + 4],
                        amount       = dataList[k * fieldLen + 5],
                        adjustFactor = dataList[k * fieldLen + 6],
                        settle       = dataList[k * fieldLen + 7],
                        preClose     = dataList[k * fieldLen + 8],
                        preSettle    = dataList[k * fieldLen + 9]
                    });
                }
            }

            return(items);
        }
Example #22
0
        public static DataNode[] ParseData(WindData item, string type)
        {
            if (item.errorCode != 0)
            {
                if (((object[])item.data)[0].ToString().Equals("No Content", StringComparison.OrdinalIgnoreCase))
                {
                    return(null);
                }
            }

            object[,] result = (object[, ])item.getDataByFunc(type, false);

            var info = new DataNode[item.GetTimeLength()];

            for (int i = 0; i < info.Length; i++)
            {
                info[i] = new DataNode()
                {
                    price  = decimal.Parse(result[i, 0].ToString()),
                    volume = int.Parse(result[i, 1].ToString()),
                    time   = item.timeList[i],
                    code   = item.codeList[0],
                }
            }
            ;

            return(info);
        }
        public override List <FuturesDaily> readFromWind(string code, DateTime dateStart, DateTime dateEnd, string tag = null, IDictionary <string, object> options = null)
        {
            WindAPI  w        = Platforms.GetWindAPI();
            WindData wd       = w.wsd(code, "open,high,low,close,volume,amt", dateStart, dateEnd, "Fill=Previous");
            int      len      = wd.timeList.Length;
            int      fieldLen = wd.fieldList.Length;

            var items = new List <FuturesDaily>(len * fieldLen);

            if (wd.data is double[])
            {
                double[]   dataList = (double[])wd.data;
                DateTime[] timeList = wd.timeList;
                for (int k = 0; k < len; k++)
                {
                    items.Add(new FuturesDaily
                    {
                        time   = timeList[k],
                        open   = (double)dataList[k * fieldLen + 0],
                        high   = (double)dataList[k * fieldLen + 1],
                        low    = (double)dataList[k * fieldLen + 2],
                        close  = (double)dataList[k * fieldLen + 3],
                        volume = (double)dataList[k * fieldLen + 4],
                        amount = (double)dataList[k * fieldLen + 5]
                    });
                }
            }
            return(items);
        }
Example #24
0
        public static WindData fetchTimeSeriesSecInfo(String strWindCode, string strCodeType, DateTime dtBegin, DateTime dtEnd, string strOthers = "")
        {
            WindData wd = ConnWind.w.wsd(strWindCode, strCodeType, dtBegin.ToShortDateString(), dtEnd.ToShortDateString(), strOthers);

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Example #25
0
        public void myCallback(ulong reqId, WindData wd)
        {
            //用户代码区域
            //订阅返回数据存放在WindData参数wd中,可以对其进行分析操作
            var data     = wd.data as double[];
            var codeList = wd.codeList as string[];

            if (data != null)
            {
                int      length = data.Length / 6;
                double   last, ask1, askv1, bid1, bidv1;
                TimeSpan now;
                for (int i = 0; i < length; i++)
                {
                    ask1  = data[i * 6];
                    askv1 = data[i * 6 + 1];
                    bid1  = data[i * 6 + 2];
                    bidv1 = data[i * 6 + 3];
                    last  = data[i * 6 + 4];
                    int time   = (int)data[i * 6 + 5];
                    var hour   = time / 10000;
                    var minute = time % 10000 / 100;
                    var second = time % 100;
                    now = new TimeSpan(hour, minute, second);
                    dataList[codeList[i]] = new Level1Data()
                    {
                        last = last, ask1 = ask1, askv1 = askv1, bid1 = bid1, bidv1 = bidv1, time = now
                    };
                    // Console.WriteLine("time: {6}, localtime: {7}, code: {5}, last: {0},ask1: {1},askv1: {2},bid1: {3},bidv1: {4}", last, ask1, askv1, bid1, bidv1,codeList[i],now.ToString(),DateTime.Now.TimeOfDay.ToString());
                }
            }
        }
        public static DataColumn[] GetDataColumns(this WindData wData)
        {
            var     colNames  = wData.fieldList;
            var     colLength = colNames.Length;
            dynamic arrayData = ConvertToArray(wData.data);
            var     dc        = new DataColumn[colLength];
            bool    success   = true;
            int     k         = 0;

            try
            {
                while (k <= 10000)
                {
                    for (int i = k * colLength; i < (k + 1) * colLength; ++i)
                    {
                        success = true;
                        var re = arrayData[i];
                        if (re.GetType() == typeof(System.DBNull))
                        {
                            success = false;
                            break;
                        }
                    }
                    if (success == true)
                    {
                        for (int i = k * colLength; i < (k + 1) * colLength; ++i)
                        {
                            var re = arrayData[i];
                            dc[i - k * colLength] = new DataColumn(colNames[i - k * colLength], re.GetType());
                        }
                        break;
                    }
                    k++;
                }
            }
            catch (Exception e)
            {
                if (success == false)
                {
                    Console.WriteLine("数据缺失,存在DBNULL类型!");
                    for (int i = 0; i < colLength; ++i)
                    {
                        var re = arrayData[i];
                        if (re.GetType() == typeof(System.DBNull))
                        {
                            dc[i] = new DataColumn(colNames[i], typeof(String));
                        }
                        else
                        {
                            dc[i] = new DataColumn(colNames[i], re.GetType());
                        }
                    }
                }
            }



            return(dc);
        }
Example #27
0
        public static MTable getTable(WindData wd)
        {
            MTable ret = new MTable();

            ret.FillTable(getRecords(wd));

            return(ret);
        }
Example #28
0
        private void button2_Click(object sender, EventArgs e)
        {
            WindData  wd          = ConnWindData.fetchSectorConstituent(DateTime.Now, "全部A股");
            DataTable dtStock     = ConnWindData.convertWindDatatoTable(wd);
            String    strWindCode = Utilities.UtilityTable.getCodeStringFromDataTableCol(dtStock, 1);

            Strategy.EarningPositivePreannouncement.PreannouncementConditionFilter(dtStock, new DateTime(2016, 6, 30));
        }
Example #29
0
        /// <summary>
        /// 从万德API获取
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        List <DateTime> readFromWind(DateTime startTime, DateTime endTime)
        {
            WindAPI  wapi = Platforms.GetWindAPI();
            WindData wd   = wapi.tdays(startTime, endTime, "");
            var      wdd  = (object[])wd.data;

            return(wdd.Select(x => (DateTime)x).ToList());
        }
Example #30
0
        private List <FuturesMinute> readByParameters(string code, DateTime date, string paramters)
        {
            WindAPI  w     = Platforms.GetWindAPI();
            DateTime date2 = new DateTime(date.Year, date.Month, date.Day, 15, 0, 0);
            DateTime date1 = DateUtils.PreviousTradeDay(date).AddHours(17);
            //获取日盘数据
            WindData wd       = w.wsi(code, "open,high,low,close,volume,amt,oi", date1, date2, paramters);
            int      len      = wd.timeList.Length;
            int      fieldLen = wd.fieldList.Length;
            var      items    = new List <FuturesMinute>(len);

            if (wd.data is double[])
            {
                double[]   dataList = (double[])wd.data;
                DateTime[] timeList = wd.timeList;
                for (int k = 0; k < len; k++)
                {
                    items.Add(new FuturesMinute
                    {
                        tradeday     = date,
                        time         = timeList[k],
                        open         = (double)dataList[k * fieldLen + 0],
                        high         = (double)dataList[k * fieldLen + 1],
                        low          = (double)dataList[k * fieldLen + 2],
                        close        = (double)dataList[k * fieldLen + 3],
                        volume       = (double)dataList[k * fieldLen + 4],
                        amount       = (double)dataList[k * fieldLen + 5],
                        openInterest = (double)dataList[k * fieldLen + 6]
                    });
                }
            }

            //【原版】如果该时间段第1个时间点的close为NAN,则放弃该时间段的所有数据
            //if (items.Count>0 && double.IsNaN(items[0].close)==true)
            //{
            //    return new List<FuturesMinute>();
            //}

            //判断该时间段前25条数据是否含有真正的数据(至少一条数据)
            List <FuturesMinute> tempItem = items.GetRange(0, 25);
            bool haveData = items.Any(x => double.IsNaN(x.close) != true);

            //【新版1】如果该时间段前5个时间点的close为NAN,则放弃该时间段的所有数据
            //if (items.Count > 0 && double.IsNaN(items[0].close) && double.IsNaN(items[1].close) &&
            //    double.IsNaN(items[2].close) && double.IsNaN(items[3].close) && double.IsNaN(items[4].close))
            //{
            //    return new List<FuturesMinute>();
            //}

            //【新版2】如果该时间段前20个时间点的close为NAN,则放弃该时间段的所有数据
            if (items.Count > 0 && haveData == false)
            {
                return(new List <FuturesMinute>());
            }


            return(items);
        }