// GET /** * Get USD from Octagon Wallet * @return a string containing BTC Data */ public string GetData() { OctagonWallet wallet = new OctagonWallet(); return(wallet.GetResponse()); /* * // API URL * string url = @"https://www.bitstamp.net/api/v2/balance/"; * * // Json Data * var json = new WebClient().DownloadString(url); * * // Initializing a JavaScriptSerializer * JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); * * // Mapping date to ticker object * OctagonWallet Wallet = (OctagonWallet)javaScriptSerializer.Deserialize(json, typeof(OctagonWallet)); * * // Getting BTC prices * string data = Wallet.GetUsd().ToString(); * * // Return Quote * return data; */ }
public string MakePurchase(double Dollars, double EthPurchaseAmount /*,ClientBtcWalletAddress*/) { // Create a OctagonWallet Object OctagonWallet wallet = new OctagonWallet(); // Get Ether Balance in the wallet var EthWalletBalance = wallet.GetEthAvailable(); // Withdraw money from the bank equal to the purchase BankWithdrawal Withdrawal = new BankWithdrawal(Dollars.ToString()); // Make purchase BuyETH purchase = new BuyETH(EthPurchaseAmount); // While Ether's are not available in wallet, keep cheking until it's available in order to make a transfer while (Double.Parse(EthWalletBalance) < EthPurchaseAmount) { EthWalletBalance = wallet.GetEthAvailable(); } // Make transfer to user's wallet from octagon's wallet // Create a EtherTransfer Object EtherTransfer signature = new EtherTransfer(EthPurchaseAmount /*, ClientEthWalletAddress */); // View Result. ID if Successful, Error if not return(purchase.getResponseString()); }
public string MakePurchase(double Dollars, double BtcPurchaseAmount /*,ClientBtcWalletAddress*/) { // Create a OctagonWallet Object OctagonWallet wallet = new OctagonWallet(); // Get Bitcoin Balance in the wallet var BtcWalletBalance = wallet.GetBtcAvailable(); // Withdraw money from the bank equal to the purchase (restoking) BankWithdrawal Withdrawal = new BankWithdrawal(Dollars.ToString()); // Make purchase BuyBTC purchase = new BuyBTC(BtcPurchaseAmount); // While BTC's are not available in wallet, keep cheking until it's available in order to make a transfer while (Double.Parse(BtcWalletBalance) < BtcPurchaseAmount) { BtcWalletBalance = wallet.GetBtcAvailable(); } // Make transfer to user's wallet from octagon's wallet // Create a Signature Object Signature signature = new Signature(BtcPurchaseAmount /*, ClientBtcWalletAddress */); // View Result. ID if Successful, Error if not return(purchase.getResponseString()); }