/// <summary> /// 0/cancelOrder.php /// </summary> public List <MtGoxOrder> cancelOrder(string oid, MtGoxOrderType type) { try { string url = (this.baseURL) + "0/cancelOrder.php"; string postData; int t = 0; switch (type) { case MtGoxOrderType.Buy: t = 2; break; case MtGoxOrderType.Sell: t = 1; break; } postData = "oid=" + oid + "&type=" + t; string responseStr = (new MtGoxNetTools()).DoAuthenticatedAPIPost(url, apiKey, apiSecret, postData); return(MtGoxOrder.getObjects(responseStr)); } catch (Exception ex) { return(null); } }
/// <summary> /// 0/getOrders.php /// </summary> public List <MtGoxOrder> getOrders(MtGoxOrderType type, MtGoxOrderStatus status, int oid = 0) { try { string url = (this.baseURL) + "0/getOrders.php"; string postData = ""; postData = "oid=" + oid; switch (type) { case MtGoxOrderType.Buy: postData += "&type=1"; break; case MtGoxOrderType.Sell: postData += "&type=2"; break; } switch (status) { case MtGoxOrderStatus.Active: postData += "&status=1"; break; case MtGoxOrderStatus.NotSufficientFunds: postData += "&status=2"; break; } string responseStr = (new MtGoxNetTools()).DoAuthenticatedAPIPost(url, apiKey, apiSecret, postData); return(MtGoxOrder.getObjects(responseStr)); } catch (Exception ex) { return(null); } }
/// <summary> /// 0/buyBTC.php /// </summary> public List <MtGoxOrder> buyBTC(double amount, MtGoxCurrencySymbol currency, double price = 0.0) { try { string url = (this.baseURL) + "0/buyBTC.php"; string postData; if (price == 0.0) { postData = "amount=" + amount + "¤cy=" + currency.ToString(); } else { postData = "amount=" + amount + "&price=" + price + "¤cy=" + currency.ToString(); } string responseStr = (new MtGoxNetTools()).DoAuthenticatedAPIPost(url, apiKey, apiSecret, postData); return(MtGoxOrder.getObjects(responseStr)); } catch (Exception ex) { return(null); } }