Esempio n. 1
0
        /// <summary>
        /// Send a New Order
        /// <see href="https://scrapbox.io/BitFlyerDotNet/SendChildOrder">Online help</see>
        /// </summary>
        /// <param name="productCode"></param>
        /// <param name="orderType"></param>
        /// <param name="side"></param>
        /// <param name="price"></param>
        /// <param name="size"></param>
        /// <param name="minuteToExpire"></param>
        /// <param name="timeInForce"></param>
        /// <returns></returns>
        public Task <BitFlyerResponse <BfChildOrderResponse> > SendChildOrderAsync(
            BfProductCode productCode,
            BfOrderType orderType,
            BfTradeSide side,
            decimal price,
            decimal size,
            int minuteToExpire,
            BfTimeInForce timeInForce,
            CancellationToken ct
            )
        {
            var request = new BfChildOrderRequest
            {
                ProductCode    = productCode,
                ChildOrderType = orderType,
                Side           = side,
                Price          = price,
                Size           = size,
                MinuteToExpire = minuteToExpire,
                TimeInForce    = timeInForce,
            };

            Validate(ref request);
            return(SendChildOrderAsync(request, ct));
        }
Esempio n. 2
0
        void Validate(ref BfChildOrderRequest request)
        {
            if (!request.ChildOrderType.IsChildOrderType())
            {
                throw new ArgumentException($"Invalid {nameof(BfChildOrderRequest.ChildOrderType)} is {request.ChildOrderType}");
            }

            if (request.MinuteToExpire == 0 && Config.MinuteToExpire != 0)
            {
                request.MinuteToExpire = Config.MinuteToExpire;
            }

            if (request.TimeInForce == BfTimeInForce.NotSpecified && Config.TimeInForce != BfTimeInForce.NotSpecified)
            {
                request.TimeInForce = Config.TimeInForce;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Send a New Order
        /// <see href="https://scrapbox.io/BitFlyerDotNet/SendChildOrder">Online help</see>
        /// </summary>
        /// <param name="productCode"></param>
        /// <param name="orderType"></param>
        /// <param name="side"></param>
        /// <param name="price"></param>
        /// <param name="size"></param>
        /// <param name="minuteToExpire"></param>
        /// <param name="timeInForce"></param>
        /// <returns></returns>
        public BitFlyerResponse <BfChildOrderResponse> SendChildOrder(
            BfProductCode productCode,
            BfOrderType orderType,
            BfTradeSide side,
            decimal price,
            decimal size,
            int minuteToExpire        = 0,
            BfTimeInForce timeInForce = BfTimeInForce.NotSpecified)
        {
            var request = new BfChildOrderRequest
            {
                ProductCode    = productCode,
                ChildOrderType = orderType,
                Side           = side,
                Price          = price,
                Size           = size,
                MinuteToExpire = minuteToExpire,
                TimeInForce    = timeInForce,
            };

            Validate(ref request);
            return(SendChildOrder(request));
        }
Esempio n. 4
0
 /// <summary>
 /// Send a New Order
 /// <see href="https://scrapbox.io/BitFlyerDotNet/SendChildOrder">Online help</see>
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public Task <BitFlyerResponse <BfChildOrderResponse> > SendChildOrderAsync(BfChildOrderRequest request, CancellationToken ct)
 {
     Validate(ref request);
     return(PostPrivateAsync <BfChildOrderResponse>(nameof(SendChildOrder), request, ct));
 }
Esempio n. 5
0
 /// <summary>
 /// Send a New Order
 /// <see href="https://scrapbox.io/BitFlyerDotNet/SendChildOrder">Online help</see>
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public BitFlyerResponse <BfChildOrderResponse> SendChildOrder(BfChildOrderRequest request)
 {
     Validate(ref request);
     return(PostPrivateAsync <BfChildOrderResponse>(nameof(SendChildOrder), request, CancellationToken.None).Result);
 }