alpacahq/alpaca-trade-api-csharp

[BUG]: ListAssetsAsync stopped returning sometime yesterday 2/26 in the evening.

homer14 opened this issue · 5 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

the call hangs and never returns.

Steps To Reproduce

alpacaClient = global::Alpaca.Markets.Environments.Live.GetAlpacaTradingClient(new SecretKey(Common.LIVEKEY, Common.LIVESECRET))

alpacaClient.ListAssetsAsync(new AssetsRequest { AssetStatus = AssetStatus.Active })

Environment

  • SDK Version: 7.0.1
  • .NET SDK (version): 7

Anything else?

there was a prior bug just like this. something about how i was using it was updated to be faster in 7.0.1 as a fix. im still in that version and it has returned.

the prior bug was #716 and this was the comment to me...

@homer14 , please test version 7.0.1 available on NuGet - it should work better for this use case.

@homer14 In the future you can re-open your old issue in case of any error regression.

The previous version just added one new item to the AssetAttributes enumeration, but it looks like we need a more long-term solution for this forever-grow-enum problem. There are 3 options:

  • Mark enumeration as obsolete and treat attributes as strings. It will solve the problem completely but this is a breaking change and it means we just move this problem from SDK into a client's code.
  • Change the current JSON deserializer into something more performant. In fact, we have fallback logic for the unknown enum items but this logic is exceptions-based and works very slowly. Good idea but requires a lot of changes in library code. This work is planned for the next release of SDK.
  • Make string-to-enum deserializer more intelligent and convert strings into enums using hashtable lookup without exceptions. I'll try to implement this approach today and publish 7.0.2 release with this fix.

@homer14 Please, test the fix in version 7.0.2 available on NuGet and close this issue if the problem was fixed.

issue appears to be fixed. the method is returning again.