Domysee / BittrexSharp

C# Api Wrapper for Bittrex
MIT License
30 stars 16 forks source link

GetMarketSummaries returns null #9

Closed mrmacdmacd closed 6 years ago

mrmacdmacd commented 6 years ago

I think the title says it all... Says that it has timed out, but seems to do this really quickly. I imagine this would take a little while to return.

I have gotten GetMarkethistory to work, and am Implementing similarly.

Thanks

mrmacdmacd commented 6 years ago

to elaborate a bit: have used .result effectively for the get market history:

private static string GetRecentTrades() { var trades = bittrex.GetMarketHistory(strCurrencyPair);

            int i = 1;

            foreach (BittrexSharp.Domain.Trade tick in trades.Result)

this gives me the 200 recent trades to work with...

and that method has not worked for this one. have tried the below as well (having read the error below about not getting anything to work), but it is throwing a similar error with a null enumerable

private static async void MarketThreadRunAsync() { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        bool RunMarket = true;
        while (RunMarket == true)
        {
           // var marketsum = bittrex.GetMarketSummaries();

            var marketsum = await bittrex.GetMarketSummaries();

^^^^^error is thrown here with this code^^^^^

            int i = 1;

            foreach (BittrexSharp.Domain.MarketSummary MS in marketsum)
Domysee commented 6 years ago

Thank you for the hint. In my tests GetMarketSummaries threw an exception and did not return null. Not sure why it works differently for me than for you.

Regardless, the internal method (convertParameterListToString) caused the exception. I fixed that now. Can you test the latest code and give me feedback if it worked for you please?

mrmacdmacd commented 6 years ago

yeah the problem was around the no paramters being passed...

i did this last night and it worked (it's probably uglier than my sister (sorry... (at least i can use nested brackets)))

var completeUri = "";
            if (parameters.Count > 0)
            {
                var parameterString = convertParameterListToString(parameters);
                completeUri = uri + "?" + parameterString;
            }
            else
            { completeUri = uri; }

i'll have a look at your solution when i get a chance to breathe... thanks for what you have done so far, i would never have got there on my own!