Exemple #1
0
        public static async Task <SendChildOrderResponse> PostSendChildOrder
        (
            AuthBitflyer auth,
            SendChildOrderBody bodyObj
        )
        {
            SendChildOrderResponse retObj = null;

            try
            {
                if (bodyObj == null)
                {
                    Console.WriteLine("SendChildOrderBody is null.");
                    return(null);
                }

                string method = "POST";
                string path   = "/v1/me/sendchildorder";

                string body = JsonConvert.SerializeObject(bodyObj, Formatting.None);
                if (body == null || body.Length <= 0)
                {
                    Console.WriteLine("failed to Serialize bodyObj.");
                    return(null);
                }

                string resJson = await RequestBitflyer.Request(auth, method, path, body);

                if (resJson == null)
                {
                    //Console.WriteLine("failed to RequestBitflyer.");
                    return(null);
                }

                retObj = JsonConvert.DeserializeObject <SendChildOrderResponse>(resJson);
                if (retObj == null)
                {
                    Console.WriteLine("SendChildOrder's DeserializeObject is null.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retObj = null;
            }
            finally
            {
            }
            return(retObj);
        }
Exemple #2
0
        public static async Task <SendChildOrderResponse> PostSendChildOrder
        (
            AuthBitflyer auth,
            string product_code,
            string child_order_type,
            string side,
            double price,
            double size,
            int minute_to_expire,
            string time_in_force
        )
        {
            SendChildOrderResponse retObj = null;

            try
            {
                SendChildOrderBody bodyObj = new SendChildOrderBody();
                if (bodyObj == null)
                {
                    Console.WriteLine("failed to create SendChildOrderBody.");
                    return(null);
                }
                bodyObj.product_code     = product_code;
                bodyObj.child_order_type = child_order_type;
                bodyObj.side             = side;
                bodyObj.price            = price;
                bodyObj.size             = size;
                bodyObj.minute_to_expire = minute_to_expire;
                bodyObj.time_in_force    = time_in_force;

                retObj = await PostSendChildOrder(auth, bodyObj);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retObj = null;
            }
            finally
            {
            }
            return(retObj);
        }