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

ExchangeInfo - Cannot map enum value - TRD_GRP_024 #1326

Open
Balint1 opened this issue Dec 1, 2023 · 5 comments
Open

ExchangeInfo - Cannot map enum value - TRD_GRP_024 #1326

Balint1 opened this issue Dec 1, 2023 · 5 comments

Comments

@Balint1
Copy link

Balint1 commented Dec 1, 2023

Describe the bug
Cannot map AccountType TRD_GRP_024

To Reproduce
var resultInfo = await client.SpotApi.ExchangeData.GetExchangeInfoAsync();

Expected behavior
Succesfully mapping the missing enum value

@HoLyDreaM
Copy link

I've been getting this error for 12 hours and I'm about to go crazy and sometimes it gives an error like this: "No response on query received"

@AlgoExecutor
Copy link

This line: result = Enum.Parse(objectType, value, true); in EnumConverter.cs is kind of desaster. No check that this value exists.
This is my quick & dirty fix:

var eList = Enum.GetNames(objectType).Select(s => s.ToLower()).ToList();
if (eList.Contains(value.ToLower()))
{
  result = Enum.Parse(objectType, value, true);
  return true;
}
else
{
  result = default;
  return false;
} 

I'm afraid there are other unsafe places in the code with Enum.Parse

@JKorf
Copy link
Owner

JKorf commented Dec 6, 2023

I'm not sure where you got that snippet from, it's not actually in the EnumConverter. The source of which can be found here:
https://github.com/JKorf/CryptoExchange.Net/blob/master/CryptoExchange.Net/Converters/EnumConverter.cs

@HoLyDreaM
Copy link

The code gives the error above.At least I didn't get it from somewhere

@AlgoExecutor
Copy link

I'm not sure where you got that snippet from, it's not actually in the EnumConverter. The source of which can be found here: https://github.com/JKorf/CryptoExchange.Net/blob/master/CryptoExchange.Net/Converters/EnumConverter.cs

This was only my fix for the EnumConverter.cs Problem in Line 124.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants