dblock / iex-ruby-client

IEX Finance API Ruby Client
MIT License
119 stars 60 forks source link

Implement support for missing methods #1

Open dblock opened 6 years ago

dblock commented 6 years ago

Lots of methods from https://iextrading.com/developer/docs missing. Please help us implement them!

dblock commented 6 years ago

@rodolfobandeira has been adding a lot

I wonder if this strategy is too tedious and we should auto-generate this code. Worth looking at how https://github.com/slack-ruby/slack-ruby-client does it.

rodolfobandeira commented 6 years ago

I was looking into others non-official IEX SDKs/APIs (python, java, etc) and looks like most of them just wraps the JSON responses through an interface. The bad point is that on these APIs there is no additional flavor adding new features like we did, for example implementing the _dollar or _s.

I'm wondering if we should use this dynamic approach as well. Looks like the API V2 is also coming on Q4, and some significant changes will be there (like having API Authentication).

I'm gonna take a look on this slack-ruby-client and get you a feedback on my point of view as well. Thanks again @dblock. It's been really nice working with you. I've been learning a lot! Cheers!

dblock commented 6 years ago

I am generally against dynamic wrapping, which can be done without this client for the most part. One of the main goals of writing this gem was to validate parameters and strongly type objects and make the interface predictable and enforceable, to convert types and remove a lot of the client-side developer overhead. That said, some dynamic wrapping may be beneficial, for example if we could help developers call any API currently not implemented in this gem.

I think dynamic code generation is a great middle. The slack client really took off in adoption when we automated the generation of the methods with all the argument validation. It's a good challenge for you @rodolfobandeira to implement! Definitely next level :) Glad you're learning and really appreciate your work here, nicely done jumping into an open-source project and becoming its major contributor and co-maintainer.

rodolfobandeira commented 6 years ago

Sorry for the late response on this. I still need some time to understand better the code. If you have any tip please let me know but if I understood well the code is based on a schema reference repository: slack-api-ref and from that, it builds dynamically this "wrapper". Am I on the right path?

dblock commented 6 years ago

First try getting a machine readable version of the IEX API. Maybe they have a swagger doc or something like that. Then try to list all methods and fields. Then generate a file per method with all the fields using a template, your goal is to produce something identical to the ones we've hand-coded so far.