private void button6_Click(object sender, EventArgs e) { //var conn = @"Data Source = C:\Users\AXB\Desktop\202009.db;Version = 3;"; var conn = @"Data Source = db\MarketData.db;Version = 3;"; var sql = "SELECT sql FROM sqlite_master WHERE type='table' and tbl_name = 'Kline' "; var table = DapperUtil.GetTable(DataBaseType.SQLITE, conn, sql); }
public static Task <DataTable> GetKlineRawDataTable(string symbol, string interval) { return(Task.Run(() => { return DapperUtil.GetTable(DataBaseType.SQLITE, ConstVar.Conn, $"select * from {CommonHelper.GetTableName(symbol, interval, true)}"); })); }
public static Task <DataTable> GetKlineAna(string symbol, string interval) { return(Task.Run(() => { var tableName = CommonHelper.GetTableName(symbol, interval); var sql = $@"select d.DateDiff 上币天数, '{symbol}' 交易对, a.Close, a.OpenTime, b.Low, b.Low_Time,(b.Low-a.Close)/a.Close [Low/Close], c.High, c.High_Time, (c.High-a.Close)/a.Close [High/Close], -1.0 Price ,-1.0 [Price/Close] from ( select Close, Opentime from {tableName} where opentime =(select min(opentime) from {tableName})) a cross join (select Low, opentime Low_Time from {tableName} where low =(select min(low) from {tableName} where id<>(SELECT CASE count(1) WHEN 1 THEN -1 ELSE min(id) END from {tableName})) limit 1) b cross join (select High, opentime High_Time from {tableName} where high =(select max(high) from {tableName} where id<>(SELECT CASE count(1) WHEN 1 THEN -1 ELSE min(id) END from {tableName})) limit 1) c cross join (select julianday('now','start of day') - (select julianday(min(OpenTime),'start of day') from {tableName}) + 1 DateDiff) d;"; return DapperUtil.GetTable(DataBaseType.SQLITE, ConstVar.Conn, sql); })); }