Example #1
0
        private static async Task <SendParentOrderResponse> PostSendParentOrder
        (
            AuthBitflyer auth,
            SendParentOrderBody bodyObj
        )
        {
            SendParentOrderResponse retObj = null;

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

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

                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 <SendParentOrderResponse>(resJson);
                if (retObj == null)
                {
                    Console.WriteLine("SendParentOrder's DeserializeObject is null.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retObj = null;
            }
            finally
            {
            }
            return(retObj);
        }
Example #2
0
        private static async Task <JArray> getParentOrders
        (
            AuthBitflyer auth,
            string product_code,
            int after_page_id,
            int before_page_id
        )
        {
            JArray retArray = null;

            try
            {
                string method = "GET";
                string path   = "/v1/me/getparentorders";
                string query  = string.Format(
                    "?product_code={0}&after={1}&before={2}"
                    , product_code
                    , after_page_id
                    , before_page_id
                    );
                string body = "";

                path = path + query;

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

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

                retArray = (JArray)JsonConvert.DeserializeObject(resJson);
                if (retArray == null)
                {
                    Console.WriteLine("Ticker's DeserializeObject is null.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retArray = null;
            }
            finally
            {
            }
            return(retArray);
        }
Example #3
0
        private static async Task <JObject> getParentOrderAcceptance
        (
            AuthBitflyer auth,
            string product_code,
            string acceptance_id
        )
        {
            JObject retObj = null;

            try
            {
                string method = "GET";
                string path   = "/v1/me/getparentorder";
                string query  = string.Format(
                    "?product_code={0}&parent_order_acceptance_id={1}"
                    , product_code
                    , acceptance_id
                    );
                string body = "";

                path = path + query;

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

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

                retObj = (JObject)JsonConvert.DeserializeObject(resJson);
                if (retObj == null)
                {
                    Console.WriteLine("Ticker's DeserializeObject is null.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retObj = null;
            }
            finally
            {
            }
            return(retObj);
        }
Example #4
0
        public static async Task <JArray> getChildOrders
        (
            AuthBitflyer auth,
            string product_code,
            string child_order_state
        )
        {
            JArray retArray = null;

            try
            {
                string method = "GET";
                string path   = "/v1/me/getchildorders";
                string query  = string.Format(
                    "?product_code={0}&child_order_state={1}"
                    , product_code
                    , child_order_state
                    );
                string body = "";

                path = path + query;

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

                if (resJson == null)
                {
                    Console.WriteLine("failed to getChildOrders-Request.");
                    return(null);
                }

                retArray = (JArray)JsonConvert.DeserializeObject(resJson);
                if (retArray == null)
                {
                    Console.WriteLine("Ticker's DeserializeObject is null.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retArray = null;
            }
            finally
            {
            }
            return(retArray);
        }
Example #5
0
        public static async Task <Ticker> GetTickerAsync
        (
            string product_code
        )
        {
            Ticker retObj = null;

            try
            {
                string method = "GET";
                string path   = "/v1/getticker";
                string query  = "?product_code=" + product_code;
                string body   = "";
                path = path + query;

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

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

                retObj = JsonConvert.DeserializeObject <Ticker>(resJson);
                if (retObj == null)
                {
                    Console.WriteLine("Ticker's DeserializeObject is null.");
                    return(null);
                }
                //Console.WriteLine("GetTickerAsync. {0}", retObj.timestamp);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                retObj = null;
            }
            finally
            {
            }
            return(retObj);
        }