Ejemplo n.º 1
0
        /// <summary>
        /// List Orders
        /// <see href="https://scrapbox.io/BitFlyerDotNet/GetChildOrders">Online help</see>
        /// </summary>
        /// <param name="productCode"></param>
        /// <param name="orderState"></param>
        /// <param name="count"></param>
        /// <param name="before"></param>
        /// <param name="after"></param>
        /// <param name="childOrderId"></param>
        /// <param name="childOrderAcceptanceId"></param>
        /// <param name="parentOrderId"></param>
        /// <returns></returns>
        public Task <BitFlyerResponse <BfaChildOrder[]> > GetChildOrdersAsync(
            BfProductCode productCode,
            BfOrderState orderState,
            int count,
            uint before,
            uint after,
            string childOrderId,
            string childOrderAcceptanceId,
            string parentOrderId,
            CancellationToken ct
            )
        {
            var query = string.Format("product_code={0}{1}{2}{3}{4}{5}{6}{7}",
                                      productCode.ToEnumString(),
                                      orderState != BfOrderState.Unknown ? "&child_order_state=" + orderState.ToEnumString() : "",
                                      (count > 0)  ? $"&count={count}"   : "",
                                      (before > 0) ? $"&before={before}" : "",
                                      (after > 0)  ? $"&after={after}"   : "",
                                      !string.IsNullOrEmpty(childOrderId) ? "&child_order_id=" + childOrderId : "",
                                      !string.IsNullOrEmpty(childOrderAcceptanceId) ? "&child_order_acceptance_id=" + childOrderAcceptanceId : "",
                                      !string.IsNullOrEmpty(parentOrderId) ? "&parent_order_id=" + parentOrderId : ""
                                      );

            return(GetPrivateAsync <BfaChildOrder[]>(nameof(GetChildOrders), query, ct));
        }
Ejemplo n.º 2
0
        public IEnumerable <BfaChildOrder> GetChildOrders(BfProductCode productCode, BfOrderState orderState, uint before, Func <BfaChildOrder, bool> predicate)
        {
            while (true)
            {
                var orders = GetChildOrders(productCode, orderState, ReadCountMax, before).GetContent();
                if (orders.Length == 0)
                {
                    break;
                }

                foreach (var order in orders)
                {
                    if (!predicate(order))
                    {
                        yield break;
                    }
                    yield return(order);
                }

                if (orders.Length < ReadCountMax)
                {
                    break;
                }
                before = orders.Last().PagingId;
            }
        }
Ejemplo n.º 3
0
 public BitFlyerResponse <BfaChildOrder[]> GetChildOrders(
     BfProductCode productCode,
     BfOrderState orderState = BfOrderState.Unknown,
     int count                     = 0,
     uint before                   = 0,
     uint after                    = 0,
     string childOrderId           = null,
     string childOrderAcceptanceId = null,
     string parentOrderId          = null
     )
 => GetChildOrdersAsync(productCode, orderState, count, before, after, childOrderId, childOrderAcceptanceId, parentOrderId, CancellationToken.None).Result;
Ejemplo n.º 4
0
        public BitFlyerResponse <BfChildOrder[]> GetChildOrders(
            BfProductCode productCode,
            BfOrderState orderState = BfOrderState.Unknown,
            int count                     = 0,
            int before                    = 0,
            int after                     = 0,
            string childOrderId           = null,
            string childOrderAcceptanceId = null,
            string parentOrderId          = null
            )
        {
            var query = string.Format("product_code={0}{1}{2}{3}{4}{5}{6}{7}",
                                      productCode.ToEnumString(),
                                      orderState != BfOrderState.Unknown ? "&child_order_state=" + orderState.ToEnumString() : "",
                                      (count > 0)  ? $"&count={count}"   : "",
                                      (before > 0) ? $"&before={before}" : "",
                                      (after > 0)  ? $"&after={after}"   : "",
                                      !string.IsNullOrEmpty(childOrderId) ? "&child_order_id=" + childOrderId : "",
                                      !string.IsNullOrEmpty(childOrderAcceptanceId) ? "&child_order_acceptance_id=" + childOrderAcceptanceId : "",
                                      !string.IsNullOrEmpty(parentOrderId) ? "&parent_order_id=" + parentOrderId : ""
                                      );

            return(PrivateGet <BfChildOrder[]>(nameof(GetChildOrders), query));
        }
Ejemplo n.º 5
0
        public BitFlyerResponse <BfParentOrder[]> GetParentOrders(BfProductCode productCode, BfOrderState orderState = BfOrderState.Unknown, int count = 0, int before = 0, int after = 0)
        {
            var query = string.Format("product_code={0}{1}{2}{3}",
                                      productCode.ToEnumString(),
                                      orderState != BfOrderState.Unknown ? "&parent_order_state=" + orderState.ToEnumString() : "",
                                      (count > 0)  ? $"&count={count}"   : "",
                                      (before > 0) ? $"&before={before}" : "",
                                      (after > 0)  ? $"&after={after}"   : ""
                                      );

            return(PrivateGet <BfParentOrder[]>(nameof(GetParentOrders), query));
        }
Ejemplo n.º 6
0
 public BitFlyerResponse <BfaParentOrder[]> GetParentOrders(BfProductCode productCode, BfOrderState orderState = BfOrderState.Unknown, int count = 0, uint before = 0, uint after = 0)
 => GetParentOrdersAsync(productCode, orderState, count, before, after, CancellationToken.None).Result;
Ejemplo n.º 7
0
        /// <summary>
        /// List Parent Orders
        /// <see href="https://scrapbox.io/BitFlyerDotNet/GetParentOrders">Online help</see>
        /// </summary>
        /// <param name="productCode"></param>
        /// <param name="orderState"></param>
        /// <param name="count"></param>
        /// <param name="before"></param>
        /// <param name="after"></param>
        /// <returns></returns>
        public Task <BitFlyerResponse <BfaParentOrder[]> > GetParentOrdersAsync(BfProductCode productCode, BfOrderState orderState, int count, uint before, uint after, CancellationToken ct)
        {
            var query = string.Format("product_code={0}{1}{2}{3}",
                                      productCode.ToEnumString(),
                                      orderState != BfOrderState.Unknown ? "&parent_order_state=" + orderState.ToEnumString() : "",
                                      (count > 0)  ? $"&count={count}"   : "",
                                      (before > 0) ? $"&before={before}" : "",
                                      (after > 0)  ? $"&after={after}"   : ""
                                      );

            return(GetPrivateAsync <BfaParentOrder[]>(nameof(GetParentOrders), query, ct));
        }