コード例 #1
0
ファイル: SinaQuotationActor.cs プロジェクト: jxcjean/quanter
        private QuoteData _parseQuoteData(string data)
        {
            String[] items = data.Split(new char[] { ',' });
            if (items.Length < 10) return null;

            QuoteData bid = new QuoteData();

            bid.Alias = data.Substring(11, 8);
            if (bid.Alias.StartsWith("sz")) {
                bid.Symbol = bid.Alias.Substring(2, 6) + ".XSHE";
            } else
            {
                bid.Symbol = bid.Alias.Substring(2, 6) + ".XSHG";
            }

            bid.Name = items[0].Substring(21, items[0].Length - 21);    // var hq_str_sz150023="深成指B
            bid.Open = float.Parse(items[1]);
            bid.LastClose = float.Parse(items[2]);
            bid.CurrentPrice = float.Parse(items[3]);
            bid.High = float.Parse(items[4]);
            bid.Low = float.Parse(items[5]);
            //bid.Buy = decimal.Parse(items[6]);
            //bid.Sell = decimal.Parse(items[7]);
            bid.Volume = long.Parse(items[8]);
            bid.Turnover = float.Parse(items[9]);

            //bid.AddBuyGoodsData(new TickData.GoodsData(float.Parse(items[BUY_1_P]), int.Parse(items[BUY_1_A])));
            //bid.AddBuyGoodsData(new TickData.GoodsData(float.Parse(items[BUY_2_P]), int.Parse(items[BUY_2_A])));
            //bid.AddBuyGoodsData(new TickData.GoodsData(float.Parse(items[BUY_3_P]), int.Parse(items[BUY_3_A])));
            //bid.AddBuyGoodsData(new TickData.GoodsData(float.Parse(items[BUY_4_P]), int.Parse(items[BUY_4_A])));
            //bid.AddBuyGoodsData(new TickData.GoodsData(float.Parse(items[BUY_5_P]), int.Parse(items[BUY_5_A])));


            //bid.AddSellGoodsData(new TickData.GoodsData(float.Parse(items[SELL_1_P]), int.Parse(items[SELL_1_A])));
            //bid.AddSellGoodsData(new TickData.GoodsData(float.Parse(items[SELL_2_P]), int.Parse(items[SELL_2_A])));
            //bid.AddSellGoodsData(new TickData.GoodsData(float.Parse(items[SELL_3_P]), int.Parse(items[SELL_3_A])));
            //bid.AddSellGoodsData(new TickData.GoodsData(float.Parse(items[SELL_4_P]), int.Parse(items[SELL_4_A])));
            //bid.AddSellGoodsData(new TickData.GoodsData(float.Parse(items[SELL_5_P]), int.Parse(items[SELL_5_A])));

            bid.PushTime = items[31];
            return bid;
        }
コード例 #2
0
 protected override void onQuoteData(QuoteData data)
 {
     _log.Debug("Demo策略处理{0}报价数据", data.Symbol);
     this.buySecurities(new Securities( SecuritiesTypes.Stock, data.Symbol), data.SellPrice1, 100);
 }