Add GDAX OpenAPI specification (only the public API for now)#60
Add GDAX OpenAPI specification (only the public API for now)#60tbourvon wants to merge 1 commit intohugues31:masterfrom
Conversation
|
Hi! Thanks for your contribution. |
|
mmmh.. for some reason when generating the lib with swagger-codegen (version 2.3) I get an error: And same thing with version 3.0 : I'm on Mac currently (with java 1.8). I will retry this later |
|
Happy new year to all of you! |
|
@tbourvon Oh, my bad! Didn't read that part... I'll try now |
|
I hope to see private API too @tbourvon 👍 I will submit pull request with Poloniex private API soon, I will also look around for existing OpenAPI schemas for other exchanges. |
|
@crackcomm Will be coming soon, but it's a much bigger piece, and I'm not on holidays anymore. |
|
I have most of Poloniex trading API ready but it needs some polishing. |
This is a first shot at writing an OpenAPI specification for an exchange.
It's only the public API for now, and it still has some rough edges (for example, most fields should be marked as required so that we don't have useless
Optionwrappers around the API data models).The API can be generated using swagger-codegen (https://github.com/swagger-api/swagger-codegen). Note that since the OpenAPI file uses OpenAPI v3.0.0, you need to use the 3.0.0 version of swagger-codegen as well.
There were some issues with the Rust code generation as swagger-codegen is still transitioning to 3.0.0. I submitted PRs upstream to fix the problems I've encountered, they should be merged soon. In the meantime you can build swagger-codegen from my fork (which contains the 4 commits being landed as PRs): https://github.com/tbourvon/swagger-codegen/tree/3.0.0
Since GDAX requires a User-Agent to be provided, here is the full swagger-codegen command you need to run:
java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i apis/gdax/openapi.yaml \ -l rust \ -o src/gdax/generated_api/ \ --http-user-agent "Coinnect/0.5.8"A very good bonus to this is that the generated API uses Hyper async, so this is already a great step towards the async version of Coinnect.
Feel free to comment if you have specific remarks on the patch. Otherwise, I think it's best to keep the general discussion around OpenAPI in the issue #47.