Post
Topic
Board Mining (Altcoins)
Re: [Awesome Miner]- Powerful Windows GUI to manage and monitor up to 5000 miners
by
spinter
on 13/02/2018, 15:14:39 UTC





Hello Spinter... a couple of questions...

On this line you have it hardcoded to the URL for the coinmarketcaps ALQO API.

Uri uri = new Uri(@"https://api.coinmarketcap.com/v1/ticker/alqo/");

Shouldn't this be using the Str2 like this:

Uri uri = new Uri(@Str2);


Also, I tried to duplicate your code for Bulwark, but I never get any returns.  Is there something wrong with this below?




that's right




Sorry error

Uri uri = new Uri(@"https://api.coinmarketcap.com/v1/ticker/alqo/");   to   Uri uri = new Uri(@Str2);

and

string Str2 = "https://api.coinmarketcap.com/v1/ticker/alqo/";











Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Request library
using System.Net;
using System.IO;


public class ActionScript
{
private ContextProvider Context = ScriptManager.Context;
public bool Execute(List list)
{

try
{
 



//--------------------------------------------------
string Str_name = "ALQO";//Name Coin
double Str_Reward = 150; //Reward Coin
string Str1 = this.getdati("https://explorer.alqo.org/api/difficulty");//link difficulty
string Str2 = "https://api.coinmarketcap.com/v1/ticker/alqo/";//link coinmarketcap.com
//--------------------------------------------------


//MessageBox.Show(Str1);

Str1 = Str1.Replace(".", ",");
double dif = Convert.ToDouble(Str1);

Uri uri = new Uri(@Str2);
WebRequest webRequest = WebRequest.Create(uri);
WebResponse response = webRequest.GetResponse();
StreamReader streamReader = new StreamReader(response.GetResponseStream());
String responseData = streamReader.ReadToEnd();





string myString = responseData;
string[] subStrings = myString.Split(',');
string v = "";
foreach (string str in subStrings)
{
 if (str.Contains("price_btc") == true)
            {    
             v = str.Replace(@"""", "");
             v = v.Replace("price_btc", "");
             v = v.Replace(" ", "");
             v = v.Replace(":", "");
             v = v.Replace(".", ",");
            }
 }



double Price = Convert.ToDouble(v);
Context.CoinStat.SetProperties(Str_name, dif, Str_Reward, Price);
 
 
//----------------Exception------------------
 }
catch(Exception exception)
{
  
}
//--------------End--Exception----------------
return true;
}

//--------------------------------------------
protected string getdati(string url)
        {
            try
            {
                string rt;

                WebRequest request = WebRequest.Create(url);

                WebResponse response = request.GetResponse();

                Stream dataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(dataStream);

                rt = reader.ReadToEnd();

                Console.WriteLine(rt);

                reader.Close();
                response.Close();

                return rt;
            }

            catch(Exception ex)
            {
                return "Error: " + ex.Message;
            }
        }      
}//end













For Bulwark and all Coins to  http://whattomine.com/calculators
 Add to Coin & profit /statistics  

  
Additionals Json URL's

Add this line

http://whattomine.com/coins/224.json