binance / binance-connector-dotnet

Lightweight connector for integration with Binance API
MIT License
207 stars 69 forks source link

Wrong `Value` property accessed here. #3

Closed Maskime closed 2 years ago

Maskime commented 2 years ago

https://github.com/binance/binance-connector-dotnet/blob/88b4b45ec016ad026cf5e3731132cc198846add2/Src/Common/BinanceService.cs#L84

Here you're looping on the dictionary to build the query string that will be published to the REST API endpoint. But it doesn't always work, especially if what's inside the Value member is an object or a struct that does not overload the ToString() which leads to that instead of having the value behind the "Enum struct" (LendingType.DAILY => DAILY for instance) you send the type of the object Binance.Spot.Models.LendingType.

So instead of having the queryString like: lendingType=DAILY you get lendingType=Binance.Spot.Models.LendingType

Best Regards,

tantialex commented 2 years ago

Enum models ToString method is overridden to mimic Enum behaviour.

https://github.com/binance/binance-connector-dotnet/blob/27fb05bd9aec487356a643ddbccadac58fe3b1cf/Src/Spot/Models/FixedAndActivityProjectType.cs#L17