coinnect
coinnect copied to clipboard
Return type of return_order_book should not be a Map
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.
Using the Deserialize from Serde seems a great idea. However does it break the generic API ? I didn't run tests to check it.
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.
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.
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.