Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.AggregateException #2

Closed
ryanfalzon opened this issue Oct 5, 2018 · 5 comments
Closed

System.AggregateException #2

ryanfalzon opened this issue Oct 5, 2018 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@ryanfalzon
Copy link

The below exception is being returned when I execute the following code:
var client = new TradeApi(publicKey, privateKey);
var _trades = client.GetTrades(CurrencyPair.Parse("XRP_BTC"), startDate, endDate).Result;

System.AggregateException
HResult=0x80131500
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at KpmgKY.PrivateApiTool.Service.Services.PoloniexService.GetTradeHistory(String publicKey, String privateKey, DateTime startDate, DateTime endDate) in C:\KpmgKY.Development\KpmgKY.PrivateAPITool\src\KpmgKY.PrivateApiTool.Service\Services\PoloniexService.cs:line 48

Inner Exception 1:
JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[CCXT.NET.Poloniex.Trade.TradeOrder]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'error', line 1, position 9.

lisa3907 added a commit that referenced this issue Oct 5, 2018
@lisa3907
Copy link
Member

lisa3907 commented Oct 5, 2018

The error that occurred is when response is empty. I have uploaded and modified this.

@ryanfalzon
Copy link
Author

How come the GetTrades method for Poloniex does not return a Date of when the transaction occured?

@lisa3907
Copy link
Member

lisa3907 commented Oct 6, 2018

How come the GetTrades method for Poloniex does not return a Date of when the transaction occured?

Below class has date property. You can use this. (ex) var _tranction_date = trades.result[0].date;

    public class PTradeOrderItem : IPTradeOrderItem
    {
        /// <summary>
        /// 
        /// </summary>
        public string gloablTradeId
        {
            get;
            set;
        }

......
        /// <summary>
        /// 
        /// </summary>
        public string category
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public DateTime date
        {
            get;
            set;
        }
    }

lisa3907 added a commit that referenced this issue Oct 6, 2018
@lisa3907
Copy link
Member

lisa3907 commented Oct 6, 2018

Leave here json result string. (_json_value)

            var _json_value = await TradeClient.CallApiPost1Async(__end_point, _params);

            var _json_result = TradeClient.GetResponseMessage(_json_value.Response);
            if (_json_result.success == true)
                _result = await TradeClient.CallApiPostAsync<List<PTradeOrderItem>>(__end_point, _params);

I updated bug line like below.

 var _json_value = await TradeClient.CallApiPost1Async(__end_point, _params);

            var _json_result = TradeClient.GetResponseMessage(_json_value.Response);
            if (_json_result.success == true)
                _result = TradeClient.DeserializeObject<List<PTradeOrderItem>>(_json_value.Content);

@lisa3907 lisa3907 self-assigned this Oct 9, 2018
@lisa3907 lisa3907 added the bug Something isn't working label Oct 9, 2018
@lisa3907
Copy link
Member

lisa3907 commented Oct 9, 2018

Close this article, no more question.

@lisa3907 lisa3907 closed this as completed Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants