-
Notifications
You must be signed in to change notification settings - Fork 131
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
GDAX usage examples #2
Comments
added one but also added a bunch of tests that show how to make various calls. These should suffice. |
I'm new to Spring, I've been trying to learn about it through a number of resources however I still can't work out how to get started with this project, can you please provide a simple example such as starting up, pulling down something from the exchange and printing it to the screen without it being a "test". |
Cd to the directory where you checked out the project |
There's no application.yml file present in the repository so I am not sure what is the structure of that file. Can you elaborate please? |
It is a bit confusing for me due to the lack of examples, but I wanted to ask you that to make a simple order all you need is 1) Update the application.yml to use your keys 2) initialize an OrderService: (new OrderService();) 3) use the createOrder() method 4) execute with Gradle I have been trying to build a jar file to use as a library in my project, but it is not successful: Do you think you could guide me to any examples on implementation? |
That sounds about right. I've matched almost exactly the API structure from the documentation here: https://docs.gdax.com/#api Here are some examples which I'll be adding to the README shortly.
|
As I forked from this repo originally I've made efforts to keep the original repo up to date but inevitably my own version of this repo is more up to date at present.. watch this space: https://github.com/robevansuk/gdax-java |
I read your instructions to compile a jar file to use as a library in my own project. However, when I run the ./gradlew jar I don't get a jar file in the build folder. Am I missing anything besides updating the application.yml? |
trying to keep this as simple as possible, after having entered the key, secret and passphrase into the application.yml file I've entered these lines into the main method of GdaxApiApplication:
however I get a java.lang.NullPointerException and I don't understand why, can you please explain, |
What is the full stack trace that came with the exception? |
(GdaxApiApplication.java:27) is when I call Edit: To keep things very simple, from the main method, using Spring, how do I get to run |
If the GdaxExchange is null then something is likely to be wrong with the configuration. Have you tried debugging what happens when the AccountService makes a get request and attempts to sign the request? debug on this line - it seems likely the securityHeaders are not correct. ResponseEntity responseEntity = restTemplate.exchange(getBaseUrl() + resourcePath, |
Can someone provide a simple class with a main function that, for instance, shows the BTC balance? I'm getting a
|
Looks like you're trying to develop outside the application, but this is not how the codebase is currently set up to work. The code base relies on Spring Boot. Spring boot is a framework to develop your application within. The gdax-java application is a (self contained) application. All you have to do is fork the code base, supply your api credentials (do not commit them), then write your application code on top of/within of it. So for what you're trying to do you need to declare your class Test as a @component so that spring knows it should create an instance available for use from the Spring Context. Then when other classes want a reference to it, they simply annotate their field/constructor with @Autowired.
If you need anything more try looking at the classes named *Service as they all follow much the same pattern. |
Just a side note. I am working on a side project that utilizes gdax as a library. Once I figure out how to streamline the process of rigging it I will add this information to usage examples. |
Awesome -- Thanks @robevansuk and @irufus ! |
@irufus I see that the code is supposed to be built on top of this current project. But two quick questions. Can I use the jar built from the project and use it in my existing spring boot project? I tried it, the autowire to Accountservice is not getting reflected at Spring start time. Also, How would you set the API key/secret if you are using this as a jar? Appreciate any thoughts. |
@irufus I figured out the first part. Just had to add the package name for the component scan in my spring boot project. Still checking on How do I pass the API key and secret. Please let me know if there's a way. |
Nevermind. I got it working, just had to give the properties in my application.properties file and autowire GdaxImplementationa and Signature classes in my controller. |
@irufus I am using this jar in my Android application but getting nullpointexception even using the Autowired with accountService and component with Activity class. Could you please let me know what additional I need to do here for running this jar in Android project? |
Can you provide a stack trace/some more details? |
@robevansuk, can you please show, how to execute the https://github.com/irufus/gdax-java/issues/2#issuecomment-345699316 code using SpringBoot? I am not familiar with Spring. I tried to run it as main and as Spring application, but I still got the nullpointer on accountService. |
For examples please see - https://github.com/robevansuk/gdax-java/blob/master/CONTRIBUTE.md Where I've done what I can to provide examples. The GUI package provides working examples. My repo is not quite ready to merge into this as I'm building a desktop app on this API. You can see a screen shot in the gitter channel. But there's still a lot of hooking up to do and a number more features to build out. |
Let me know if this was any good for you as its still open to improvements and your feedback will no doubt help others. |
Yes, your link (and you forked repo version) helped me lot and it is best help for those who never encountered with Spring Boot. The problem was that I didn't know how to run SpringBoot main method. |
Great. There is a ticket for the Contribute.MD @irufus already raised I just haven't merged anything back yet - it'll get merged eventually into this repo - a few weeks/couple of months away with any luck.
The intention is to merge my entire repo back to this one in the coming weeks/month or two as I'm working on a desktop application that should largely mirror the web-interface version. This will then be extended over time to provide some extra stats with any luck to help decision making. Hopefully others will also contribute over time too. |
I think an examples directory/modules should be added as: |
Provide sample gdax-java examples in Readme.md
The text was updated successfully, but these errors were encountered: