public IMarketResponse SendBuyRequest(int price, int commodity, int amount) { BuyRequest buyReq = new BuyRequest(commodity, amount, price); //create and define buy request MBuySell marketResponse = new MBuySell(); try { marketResponse.id = client.SendPostRequest <BuyRequest>(url, user, privateKey, buyReq); myLogger.Info("Sent Buy Request{commodity:" + commodity + ", price:" + price + ", amount:" + amount + ", url:" + url + "}"); } catch (Exception e) { return(catchMethod(e)); } myHistory.Info("Sent Buy Request-\r\ncommodity:" + commodity + ", price:" + price + ", amount:" + amount + "\nResponse: " + marketResponse.ToString()); return(marketResponse); }
public int SendBuyRequest(int price, int commodity, int amount) { BuyRequest buyReq = new BuyRequest(commodity, amount, price); //create and define buy request String output = client.SendPostRequest <BuyRequest>(loginInfo.GetURL(), loginInfo.GetUser(), loginInfo.GetToken(), buyReq); if (Utils.Shell.isNumeric(output)) //if the request output is numeric then it succeeded { return(Int32.Parse(output)); } else // the request failed , printing the output { Console.WriteLine(output); return(-1); } }