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

Return type of return_order_book should not be a Map #65

Open
dovahcrow opened this issue Jan 21, 2018 · 4 comments
Open

Return type of return_order_book should not be a Map #65

dovahcrow opened this issue Jan 21, 2018 · 4 comments

Comments

@dovahcrow
Copy link
Contributor

dovahcrow commented Jan 21, 2018

Actually, not all return value from Poloniex is a JSON object, for now, return_order_book is an exception. I make a change to these methods to return Result<T>, which delegates the choice to the user that he can decide what type the result value is. Commit.

@hugues31
Copy link
Owner

Using the Deserialize from Serde seems a great idea. However does it break the generic API ? I didn't run tests to check it.

@dovahcrow
Copy link
Contributor Author

I don't think so. Since the generic API assumes the return type as a Map, so the compiler will infer T as a Map. Then everything falls back to the original Map API.

@dovahcrow
Copy link
Contributor Author

dovahcrow commented Mar 25, 2018

Actually using generic is just a workaround. Finally, I think we need to type-ify all the return types. Something like this is pretty useful.

@hugues31
Copy link
Owner

Yes but I think that a strong typed return should be the purpose of the generic API, the raw API, which is lower level, should stay close to the exchange response. Eventually, the Map container may be changed.

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

2 participants