コード例 #1
0
ファイル: InstrumentDAL.cs プロジェクト: damoye/QTS
        public static void Save(Instrument[] instrument)
        {
            new SQLiteCommand("DELETE FROM `instrument`", DALUtil.Connection).ExecuteNonQuery();
            var builder = new StringBuilder("REPLACE INTO `instrument` VALUES");

            foreach (var item in instrument)
            {
                builder.Append('(');
                DALUtil.AddField(builder, item.InstrumentID);
                DALUtil.AddField(builder, item.ExchangeID);
                DALUtil.AddField(builder, item.InstrumentName);
                DALUtil.AddField(builder, item.ExchangeInstID);
                DALUtil.AddField(builder, item.ProductID);
                DALUtil.AddField(builder, (int)item.ProductClass);
                DALUtil.AddField(builder, item.DeliveryYear);
                DALUtil.AddField(builder, item.DeliveryMonth);
                DALUtil.AddField(builder, item.MaxMarketOrderVolume);
                DALUtil.AddField(builder, item.MinMarketOrderVolume);
                DALUtil.AddField(builder, item.MaxLimitOrderVolume);
                DALUtil.AddField(builder, item.MinLimitOrderVolume);
                DALUtil.AddField(builder, item.VolumeMultiple);
                DALUtil.AddField(builder, item.PriceTick);
                DALUtil.AddField(builder, item.CreateDate);
                DALUtil.AddField(builder, item.OpenDate);
                DALUtil.AddField(builder, item.ExpireDate);
                DALUtil.AddField(builder, item.StartDelivDate);
                DALUtil.AddField(builder, item.EndDelivDate);
                DALUtil.AddField(builder, (int)item.InstLifePhase);
                DALUtil.AddField(builder, item.IsTrading);
                DALUtil.AddField(builder, (int)item.PositionType);
                DALUtil.AddField(builder, (int)item.PositionDateType);
                DALUtil.AddField(builder, item.LongMarginRatio);
                DALUtil.AddField(builder, item.ShortMarginRatio);
                DALUtil.AddField(builder, (int)item.MaxMarginSideAlgorithm);
                DALUtil.AddField(builder, item.UnderlyingInstrID);
                DALUtil.AddField(builder, item.StrikePrice);
                DALUtil.AddField(builder, (int)item.OptionsType);
                DALUtil.AddField(builder, item.UnderlyingMultiple);
                builder.Append((int)item.CombinationType);
                builder.Append("),");
            }
            builder.Remove(builder.Length - 1, 1);
            new SQLiteCommand(builder.ToString(), DALUtil.Connection).ExecuteNonQuery();
        }
コード例 #2
0
        public static void Save(List <Candle> candles)
        {
            var builder = new StringBuilder("REPLACE INTO candle VALUES");

            foreach (var item in candles)
            {
                builder.Append('(');
                DALUtil.AddField(builder, item.InstrumentID);
                DALUtil.AddField(builder, item.TradingDay.ToString("yyyy-MM-dd"));
                DALUtil.AddField(builder, item.CandleTime.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                DALUtil.AddField(builder, item.Open);
                DALUtil.AddField(builder, item.Close);
                DALUtil.AddField(builder, item.High);
                DALUtil.AddField(builder, item.Low);
                DALUtil.AddField(builder, item.Volume);
                DALUtil.AddLastField(builder, item.OpenInterest);
                builder.Append("),");
            }
            builder.Remove(builder.Length - 1, 1);
            new SQLiteCommand(builder.ToString(), DALUtil.Connection).ExecuteNonQuery();
        }
コード例 #3
0
ファイル: QuotationDAL.cs プロジェクト: damoye/QTS
        public static void Save(List <Quotation> quotations)
        {
            var builder = new StringBuilder("REPLACE INTO quotation VALUES");

            foreach (var item in quotations)
            {
                builder.Append('(');
                DALUtil.AddField(builder, item.TradingDay.ToString("yyyy-MM-dd"));
                DALUtil.AddField(builder, item.InstrumentID);
                DALUtil.AddField(builder, item.ExchangeID);
                DALUtil.AddField(builder, item.ExchangeInstID);
                DALUtil.AddField(builder, item.LastPrice);
                DALUtil.AddField(builder, item.PreSettlementPrice);
                DALUtil.AddField(builder, item.PreClosePrice);
                DALUtil.AddField(builder, item.PreOpenInterest);
                DALUtil.AddField(builder, item.OpenPrice);
                DALUtil.AddField(builder, item.HighestPrice);
                DALUtil.AddField(builder, item.LowestPrice);
                DALUtil.AddField(builder, item.Volume);
                DALUtil.AddField(builder, item.Turnover);
                DALUtil.AddField(builder, item.OpenInterest);
                DALUtil.AddField(builder, item.ClosePrice);
                DALUtil.AddField(builder, item.SettlementPrice);
                DALUtil.AddField(builder, item.UpperLimitPrice);
                DALUtil.AddField(builder, item.LowerLimitPrice);
                DALUtil.AddField(builder, item.PreDelta);
                DALUtil.AddField(builder, item.CurrDelta);
                DALUtil.AddField(builder, item.Time.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                DALUtil.AddField(builder, item.BidPrice1);
                DALUtil.AddField(builder, item.BidVolume1);
                DALUtil.AddField(builder, item.AskPrice1);
                DALUtil.AddField(builder, item.AskVolume1);
                builder.Append(item.AveragePrice);
                builder.Append("),");
            }
            builder.Remove(builder.Length - 1, 1);
            new SQLiteCommand(builder.ToString(), DALUtil.Connection).ExecuteNonQuery();
        }