/// <summary> /// geojsonからデータを取得する /// </summary> /// <param name="dirPath"></param> /// <returns></returns> public string StoreJsonData(string dirPath) { if (dirPath == "") { return(""); } try { _course_point_list = new List <CoursePoint>(); //IEnumerable<string> files = Directory.EnumerateFiles(dirPath, "*"); var files = Directory.EnumerateFileSystemEntries(dirPath, "*.json", SearchOption.AllDirectories); foreach (string str in files) { Console.WriteLine(str); CoursePoint model = Util.ReadJson(str); _course_point_list.Add(model); } _course_list = MergeCourse(DuplicationCheck(_course_csv_list), _course_point_list); this.CourseText = _course_list; } catch (Exception e) { Console.WriteLine(e); this.LogText = e.StackTrace; } return(dirPath); }
private void ExecuteShouldThrowError(Route inputRoute, CoursePoint inputCoursePoint) { Assert.Throws <TcxCoreException>( () => _sut.Execute( new AddCoursePointInput { Route = inputRoute, NewCoursePoint = inputCoursePoint })); }
public void Execute_Should_add_point_if_matching_trackpoint_exists() { double lat1 = 1; double lon1 = 2; DateTime t1 = new DateTime(2019, 8, 16, 12, 45, 59); var inputRoute = GetRouteWithOneTrackPoint(lat1, lon1, t1); var result = _sut.Execute( new AddCoursePointInput { Route = inputRoute, NewCoursePoint = GetCoursePoint(lat1, lon1, t1) }); result.Route.CoursePoints.Count.ShouldBe(1); CoursePoint coursePoint = result.Route.CoursePoints.First(); VerifyCoursePoint(coursePoint, lat1, lon1, t1); }
private async Task TradingTest(double delta, double kGrad) { var tm = FileIO.deserializeDataContract <TradeMan>("C:\\Markt\\ltc"); var treader = tm["PLN", "BTC_LTC"]; treader.MinSell = 0; treader.MaxBuy = double.MaxValue; treader.Tracker.Sett = new TrackSettings() { Delta = delta, KGrad = kGrad }; var period = new DatePeriod(new DateTime(2018, 04, 13, 00, 0, 0), new DateTime(2018, 04, 25)); var courseData = treader.Market.GetData(period).ToArray(); foreach (CourseItem item in courseData) { if (item.date == new DateTime(2017, 10, 19, 19, 50, 0)) { } var coursePoint = new CoursePoint(item.course, item.date); await treader.Trade(coursePoint); //Debug.WriteLine("{0}|{1}", coursePoint, item.delta); } int ptCount = courseData.Length; //var sred = m.Value.CourseData.Sum(p => p.course / ptCount); var invest = treader.Complited.Sum(o => o.BuyOrder.Amount); var margin = treader.Complited.Sum(c => (c.SellOrder.Price - c.BuyOrder.Price - 0.005 * c.SellOrder.Price) / c.BuyOrder.Price); var percent = margin; if (treader.Complited.Count > -1 && percent > -1) { Debug.WriteLine("kGrad ={0} d ={1} %= {2}", kGrad, delta, percent); Debug.WriteLine("Compl ={0} List ={1}", treader.Complited.Count, treader.Sellers.Count); } }
public void CoursePoint_constructor_creates_type_undefined() { var p = new CoursePoint(1, 1); p.Type.ShouldBe(CoursePoint.PointType.Undefined); }
public void CoursePoint_constructor_creates_empty_string_for_notes() { var p = new CoursePoint(1, 1); p.Notes.ShouldBe(""); }
/// <summary> /// Set Type field</summary> /// <param name="type_">Nullable field value to be set</param> public void SetType(CoursePoint? type_) { SetFieldValue(5, 0, type_, Fit.SubfieldIndexMainField); }
private static void AddNewPoint(CoursePoint newPoint, List <CoursePoint> coursePoints) { coursePoints.Add(newPoint); coursePoints.Sort((x, y) => x.TimeStamp.CompareTo(y.TimeStamp)); }
private static void VerifyCoursePoint(CoursePoint coursePoint, double lat1, double lon1, DateTime t1) { coursePoint.Lattitude.ShouldBe(lat1); coursePoint.Longitude.ShouldBe(lon1); coursePoint.TimeStamp.ShouldBe(t1); }