Closed ryanfalzon closed 5 years ago
The error that occurred is when response is empty. I have uploaded and modified this.
How come the GetTrades method for Poloniex does not return a Date of when the transaction occured?
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;
}
}
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);
Close this article, no more question.
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.Task
1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task
1.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 48Inner 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.