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); }
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); }
public static async Task <int> cancelParentOrderAcceptance ( AuthBitflyer auth, string product_code, string acceptance_id ) { int result = 0; try { CancelParentOrderAcceptanceBody bodyObj = new CancelParentOrderAcceptanceBody(); if (bodyObj == null) { result = -1; return(result); } bodyObj.parent_order_acceptance_id = acceptance_id; bodyObj.product_code = product_code; string body = JsonConvert.SerializeObject(bodyObj, Formatting.None); if (body == null || body.Length <= 0) { result = -1; return(result); } string method = "POST"; string path = "/v1/me/cancelparentorder"; int resCode = await RequestBitflyer.RequestChkSuccessCode(auth, method, path, body); if (resCode != 0) { Console.WriteLine("failed to RequestChkSuccessCode for cancel."); result = -1; return(result); } } catch (Exception ex) { Console.WriteLine(ex); result = -1; } finally { } return(result); }
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); }
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); }
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); }