public async Task ParentOrder() { await apiClient.CancelAllOrders(new CancelAllOrdersParameter { ProductCode = ProductCode.FxBtcJpy }); var parameter = new SendParentOrderParameter { OrderMethod = OrderMethod.IfDone, MinuteToExpire = 10000, TimeInForce = TimeInForce.GoodTilCanceled, Parameters = new[] { new ParentOrderDetailParameter { ProductCode = ProductCode.FxBtcJpy, ConditionType = ConditionType.Limit, Side = Side.Buy, Price = buyPrice, Size = OrderSize }, new ParentOrderDetailParameter { ProductCode = ProductCode.FxBtcJpy, ConditionType = ConditionType.Stop, Side = Side.Sell, TriggerPrice = sellPrice, Size = OrderSize } } }; var res1 = await apiClient.SendParentOrder(parameter); var parentOrderAcceptanceId = res1?.ParentOrderAcceptanceId; Assert.NotNull(parentOrderAcceptanceId); var health = await PublicApi.GetHealth(); ThreadSleep(health.Status); var trail = new SendParentOrderParameter { Parameters = new[] { new ParentOrderDetailParameter { ProductCode = ProductCode.FxBtcJpy, ConditionType = ConditionType.Trail, Side = Side.Buy, Offset = 30000, Size = OrderSize } } }; var resTrail = await apiClient.SendParentOrder(trail); var trailParentOrderAcceptanceId = resTrail?.ParentOrderAcceptanceId; Assert.NotNull(trailParentOrderAcceptanceId); ThreadSleep(health.Status); var resAll = await apiClient.GetParentOrders(ProductCode.FxBtcJpy, 10); Assert.NotNull(resAll); ThreadSleep(health.Status); var res2 = await apiClient.GetParentOrder(ProductCode.FxBtcJpy, parentOrderAcceptanceId : parentOrderAcceptanceId); Assert.NotNull(res2); await apiClient.CancelParentOrder(new CancelParentOrderParameter { ProductCode = ProductCode.FxBtcJpy, ParentOrderAcceptanceId = parentOrderAcceptanceId }); ThreadSleep(health.Status); var resTrail2 = await apiClient.GetParentOrder(ProductCode.FxBtcJpy, parentOrderAcceptanceId : trailParentOrderAcceptanceId); Assert.NotNull(resTrail2); await apiClient.CancelParentOrder(new CancelParentOrderParameter { ProductCode = ProductCode.FxBtcJpy, ParentOrderAcceptanceId = trailParentOrderAcceptanceId }); ThreadSleep(health.Status); await Task.WhenAll(Enumerable.Range(0, 3).Select(_ => apiClient.SendParentOrder(parameter))); ThreadSleep(health.Status); await apiClient.CancelAllOrders(new CancelAllOrdersParameter { ProductCode = ProductCode.FxBtcJpy }); ThreadSleep(health.Status); var res3 = await apiClient.GetParentOrders(ProductCode.FxBtcJpy); Assert.True(res3.Count(x => x.ProductCode == ProductCode.FxBtcJpy && x.ParentOrderState == ParentOrderState.Active) == 0); }