public async Task LoadActiveSettings(string path, ActiveSettingsStore store) { /* * if(strategiesAll.Length != activeSettings.Length) * throw new Exception(new { strategiesAll = new { strategiesAll.Length }, activeSettings = new { activeSettings.Length } } + "" ); */ switch (store) { case ActiveSettingsStore.Gist: var tms = TradingMacrosByPair().ToList(); var strategies = (await Lib.ReadTestParametersFromGist(path)).ToList(); tms.Zip(strategies, (tm, settings) => new { tm, settings }) //.Do(x=> { // if(x.tm.BarPeriod + "" != x.settings[Lib.GetLambda(() => BarPeriod)]) // throw new Exception(new { x.tm.BarPeriod, BarPeriod2 = x.settings[Lib.GetLambda(() => BarPeriod)] } + ""); //}) .ForEach(x => x.tm.LoadActiveSettings(x.settings, path + "[" + x.tm.PairIndex + "]")); break; case ActiveSettingsStore.Local: LoadActiveSettings(path); break; default: throw new ArgumentException("Not implemented", new { store = store + "" } +""); } }
public async Task SaveActiveSettings(string path, ActiveSettingsStore store) { switch (store) { case ActiveSettingsStore.Gist: await SaveActiveSettingsToGist(path); break; case ActiveSettingsStore.Local: SaveActiveSettings(path); break; default: throw new ArgumentException("Not implemented", new { store = store + "" } +""); } }