protected bool GetRepositoryID(Catalog.DataBase.ImitationGame game, string date) { try { using (var db = new GoblinBatDbContext(key)) return(db.Material.Where(o => o.Assets == game.Assets && o.Code.Equals(game.Code) && o.Commission == game.Commission && o.MarginRate == game.MarginRate && o.Strategy.Equals(game.Strategy) && o.RollOver.Equals(game.RollOver) && o.BaseTime == game.BaseTime && o.BaseShort == game.BaseShort && o.BaseLong == game.BaseLong && o.NonaTime == game.NonaTime && o.NonaShort == game.NonaShort && o.NonaLong == game.NonaLong && o.OctaTime == game.OctaTime && o.OctaShort == game.OctaShort && o.OctaLong == game.OctaLong && o.HeptaTime == game.HeptaTime && o.HeptaShort == game.HeptaShort && o.HeptaLong == game.HeptaLong && o.HexaTime == game.HexaTime && o.HexaShort == game.HexaShort && o.HexaLong == game.HexaLong && o.PentaTime == game.PentaTime && o.PentaShort == game.PentaShort && o.PentaLong == game.PentaLong && o.QuadTime == game.QuadTime && o.QuadShort == game.QuadShort && o.QuadLong == game.QuadLong && o.TriTime == game.TriTime && o.TriShort == game.TriShort && o.TriLong == game.TriLong && o.DuoTime == game.DuoTime && o.DuoShort == game.DuoShort && o.DuoLong == game.DuoLong && o.MonoTime == game.MonoTime && o.MonoShort == game.MonoShort && o.MonoLong == game.MonoLong && o.Date.Equals(date)).AsNoTracking().Any()); } catch (Exception ex) { new ExceptionMessage(ex.StackTrace); } return(false); }
public Models.Strategics GetImitationModel(Catalog.DataBase.ImitationGame game) => new Models.Strategics { Assets = game.Assets, Code = game.Code, Commission = game.Commission, MarginRate = game.MarginRate, Strategy = game.Strategy, RollOver = game.RollOver, BaseTime = game.BaseTime, BaseShort = game.BaseShort, BaseLong = game.BaseLong, NonaTime = game.NonaTime, NonaShort = game.NonaShort, NonaLong = game.NonaLong, OctaTime = game.OctaTime, OctaShort = game.OctaShort, OctaLong = game.OctaLong, HeptaTime = game.HeptaTime, HeptaShort = game.HeptaShort, HeptaLong = game.HeptaLong, HexaTime = game.HexaTime, HexaShort = game.HexaShort, HexaLong = game.HexaLong, PentaTime = game.PentaTime, PentaShort = game.PentaShort, PentaLong = game.PentaLong, QuadTime = game.QuadTime, QuadShort = game.QuadShort, QuadLong = game.QuadLong, TriTime = game.TriTime, TriShort = game.TriShort, TriLong = game.TriLong, DuoTime = game.DuoTime, DuoShort = game.DuoShort, DuoLong = game.DuoLong, MonoTime = game.MonoTime, MonoShort = game.MonoShort, MonoLong = game.MonoLong };
protected Dictionary <DateTime, string> GetInformation(Catalog.DataBase.ImitationGame game, string code) { try { var file = string.Empty; var info = new Dictionary <DateTime, string>(32); var temp = new Dictionary <string, long>(32); var contents = new Dictionary <string, string>(32); var now = DateTime.Now; using (var db = new GoblinBatDbContext(key)) { var count = 1; while (count-- <= 1) { var find = (count == 0 ? now : now.AddDays(count)).ToString("yyMMdd"); var exists = db.Material.Where(o => o.Date.Equals(find) && o.Assets == game.Assets && o.Code.Equals(game.Code) && o.Commission == game.Commission && o.MarginRate == game.MarginRate && o.Strategy.Equals(game.Strategy) && o.RollOver.Equals(game.RollOver) && o.BaseTime == game.BaseTime && o.BaseShort == game.BaseShort && o.BaseLong == game.BaseLong && o.NonaTime == game.NonaTime && o.NonaShort == game.NonaShort && o.NonaLong == game.NonaLong && o.OctaTime == game.OctaTime && o.OctaShort == game.OctaShort && o.OctaLong == game.OctaLong && o.HeptaTime == game.HeptaTime && o.HeptaShort == game.HeptaShort && o.HeptaLong == game.HeptaLong && o.HexaTime == game.HexaTime && o.HexaShort == game.HexaShort && o.HexaLong == game.HexaLong && o.PentaTime == game.PentaTime && o.PentaShort == game.PentaShort && o.PentaLong == game.PentaLong && o.QuadTime == game.QuadTime && o.QuadShort == game.QuadShort && o.QuadLong == game.QuadLong && o.TriTime == game.TriTime && o.TriShort == game.TriShort && o.TriLong == game.TriLong && o.DuoTime == game.DuoTime && o.DuoShort == game.DuoShort && o.DuoLong == game.DuoLong && o.MonoTime == game.MonoTime && o.MonoShort == game.MonoShort && o.MonoLong == game.MonoLong); if (exists.Any()) { var str = exists.First(); temp[str.Date] = str.Cumulative + str.Unrealized; contents[str.Date] = string.Concat(',', str.Unrealized, ',', str.Revenue, ',', str.Fees, ',', str.Cumulative, ',', str.Statistic); if (string.IsNullOrEmpty(file)) { file = string.Concat(str.BaseShort, '-', str.BaseLong, '-', str.MonoTime, '-', str.MonoShort, '-', str.MonoLong, '-', str.Strategy, '-', str.Primary, csv); } } else if (find.Equals("190721")) { break; } } } if (string.IsNullOrEmpty(file) == false && contents.Count > 0) { var queue = new Queue <string>(32); foreach (var kv in contents.OrderBy(o => o.Key)) { queue.Enqueue(string.Concat(kv.Key, kv.Value)); } new ExceptionMessage(file, queue); contents.Clear(); } var dicPrice = new Dictionary <long, double>(128); var dicShort = new Dictionary <string, double>(128); var dicLong = new Dictionary <string, double>(128); using (var db = new GoblinBatDbContext(key)) foreach (var dt in db.Futures.Where(o => o.Date % 0x3B9ACA00 == 0x9357BA0 && o.Code.Contains(code.Substring(0, 3)) && o.Code.Contains(code.Substring(5))).AsNoTracking().Select(o => new { o.Date, o.Price })) { dicPrice[dt.Date / 0x3B9ACA00] = dt.Price; } using (var db = new GoblinBatDbContext(key)) foreach (var chart in db.Charts.Where(o => (o.Base == game.BaseShort || o.Base == game.BaseLong) && o.Code.Equals(code) && o.Time == 405).AsNoTracking().Select(o => new { o.Date, o.Base, o.Value })) { if (chart.Base == game.BaseShort) { dicShort[chart.Date] = chart.Value; } if (chart.Base == game.BaseLong) { dicLong[chart.Date] = chart.Value; } } foreach (var kv in temp.OrderBy(o => o.Key)) { if (dicShort.TryGetValue(kv.Key, out double bs) && dicLong.TryGetValue(kv.Key, out double bl) && long.TryParse(kv.Key, out long dp) && dicPrice.TryGetValue(dp, out double price) && DateTime.TryParseExact(string.Concat(kv.Key, "154500"), date, CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTime infoDate)) { info[infoDate] = string.Concat(kv.Value, ';', price, ';', bs, ';', bl); } } return(info); } catch (Exception ex) { new ExceptionMessage(ex.StackTrace); } return(null); }
public bool OnReceiveRepositoryID(Catalog.DataBase.ImitationGame specifies) => GetRepositoryID(specifies, RecentDate);
public Dictionary <DateTime, string> OnReceiveInformation(Catalog.DataBase.ImitationGame number) => GetInformation(number, Code);