Giter Club home page Giter Club logo

gdax-java's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdax-java's Issues

Deprecated API in OrderTests

src\test\java\com\coinbase\exchange\api\orders\OrderTests.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

Spring example

Hi, I´m not new to Spring but i am new to Spring Boot.

I think your library is quite good (or will be when i get to use it) but the curve to start it off is really hard, even for those who know Spring, there is no guide to how to setup the most basic scenario. I recommend you to make a very basic controller/main/example inside the

After various intents on implementing a basic bot with this wrapper I wanted to ask. Could you post a simple process for creating and executing one? Every time i try to get any service its null, even if i autowire it in a way i think is correct and i´m not sure where/how i should put my source code.

For example, to obtain "the ticker" for a certain market:

  • Add your credentials to app.yaml.
  • Create your source file inside com.coinbase.exchange.api.
  • Subscribe to websocket feed.
  • Autowire the class as component.
  • Call your controller.
  • Etc.

Thanks

Miguel.

GDAX credensials generates: forbidden error

every time when I tried to payment via Gdax account it gives me forbidden error:
however I was purchased the licensed too.

after licensed purchase, I try to use java as well python script, but for both GDAX API generate forbidden error 403 error at my side.

please find the below screen short :
https://content.screencast.com/users/Rajesh771986/folders/Jing/media/96165bca-8b6f-4a1c-bd47-4243b5fa04a0/2018-03-06_2016.png

Gdax support team number is also not connecting:
+1 (855) 577-1727

kindly request suggest what should I do?

Getting {"message":"request timestamp expired"} on POST message

Im using the implementation from this code and i on GET requests i get good responses from the API however, when trying to se POST i get that answer
I used the timestamp generation on your code but got and invalid signature response from the API, that's because you are using the getSeconds and they want milis
im unable to figure where exactly the problem here is the relevant code

        System.out.println(jsonOrder);
	CloseableHttpClient client = HttpClientBuilder.create().build();
	HttpPost request = new HttpPost(BASE_URL + "/orders");

	org.joda.time.DateTime now = new org.joda.time.DateTime(); // Default time zone.
	DateTime nowUtc = DateTime.now ( DateTimeZone.UTC );

	String timestamp = now.getMillis() + "";

	request.addHeader("accept", "application/json");
	request.addHeader("content-type", "application/json");
	request.addHeader("User-Agent", "gdax-java-client");
	request.addHeader(CB_ACCESS_KEY, API_KEY);
	request.addHeader(CB_ACCESS_SIGN, generateSignedHeader("/orders", "POST", jsonOrder, timestamp));
	request.addHeader(CB_ACCESS_TIMESTAMP, timestamp);
	request.addHeader(CB_ACCESS_PASSPHRASE, PASSPHRASE);

	HttpResponse response = client.execute(request);
	String jsonResponse = EntityUtils.toString(response.getEntity(), "UTF-8");
	client.close();
	return jsonResponse;`

The generateSignedHeader is your implementation and it is working for GET requests

Recommend using Lombok for Data Transfer Objects, and toString methods in each DTO

Hi,

I'd recommend using Lombok for DTO's such as Account, Order etc, which will take away the boilerplate code for getters/setters,

And more importantly, introduce toString() methods for all, so that it's easy to log out a list of Orders / Accounts etc. (If using Lombok, @DaTa annotation will automatically add toString). If not using Lombok, this should be added to DTOs manually for ease of client use.

build.gradle
compileOnly('org.springframework.boot:spring-boot-configuration-processor')
compileOnly('org.projectlombok:lombok')

Account.java
@DaTa annotation.

Thanks.

Syntax error on WebsocketFeed

this.objectMapper = objectMapper(new JavaTimeModule());

should probably be:

this.objectMapper = objectMapper.registerModule(new JavaTimeModule());

Otherwise, I get the following error when executing build tasks:

.../gdax-java/src/main/java/com/coinbase/exchange/api/websocketfeed/WebsocketFeed.java:58: error: cannot find symbol
this.objectMapper = objectMapper(new JavaTimeModule());
^
symbol: method objectMapper(JavaTimeModule)
location: class WebsocketFeed
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

Websocket: cannot subscribe with authentication

Hi!

Without authentication, I can subscribe to GDAX Websocket feed (any channel combination).

Instead, if I set my key, passphrase and secret code, then I get the answer:
{"type":"error","message":"Sorry, you could not be authenticated: Bad Request","reason":"invalid signature"}

According to the GDAX api, when specifying channels you must authenticate using the path: "/users/self/verify" (just "/users/self" if you don't specify channels).

However in signObject() on WebsocketFeed.java, the path is "" as you might find on line 198:

jsonObj.setSignature(signature.generate("", "GET", jsonString, timestamp));

I tried to correct the issue (i.e. setting the correct path), with no success.

Change default endpoints

"As part of the rebranding of Coinbase Exchange to GDAX, API endpoints have changed. The old *.exchange.coinbase.com endpoints will continue working until Aug 24th, 2016. For the new endpoints see the documentation

PaymentService.getPaymentTypes and PaymentService.getCoinbaseAccounts fail due to various data type issues

Call to GET /payment-methods fails due to:

  • limits expecting an array, but the response is actually a single value
  • the return type expected a single PaymentTypes object, but the response is actually an array

See https://docs.gdax.com/#payment-methods

This was fixed by #20 commit 500657d

Call to GET /coinbase-accounts fails due to:

  • the return type expected a single CoinbaseAccounts object, but the response is actually an array

See https://docs.gdax.com/#coinbase-accounts

This was fixed by #20 commit f422a9e

Split gdax-java into library and client

There are three separate projects within this repo.

  • The library which facilitates connecting to the Coinbase Pro
  • The spring boot application the injects the configuration for each rest api call
  • The order book application that loads market data into a viewable interface

Problem with Jar

Hello everyone.

I don't know if i am doing something wrong here but for some reason i cant correctly generate the jar to use in my project. Already spent some time trying. If anyone could please provide the jar or explain how they generated if i would appreciate it.

Thank you all.

Null Pointer Exception

Hey,

While using your library I noticed a null pointer exception when trying to execute a "AccountService.getAccounts()" method. I've put my secret, API key and passphrase into the application.yml. It seems like the "exchange" variable is null.

By the way: I compiled your library into a .jar file and included it into my personal project. (I checked and can confirm that API key etc. are inside the .jar file)

Any idea on whats going wrong?

Thanks for the library!

what is "api keys" ?

I just have username and password on gdax ... where should I enter that in application.yml ?

or there is another "key" that I am not aware ?

by the way is there any simple example, in one .java file just to do login and get the orderbook ? (using the jar file )

Cloudflare Blocking access: "User-Agent" needs to be added to the header

Unable to reach the sandbox API I noted that the exception was stating Cloudflare was blocking me due to unknown user-agent. The solution to this is to add a User-Agent string to the header.

headers.add("User-Agent", "MyAgent");

Most of the unit tests are working again with this change.

Please make additional data on Limits available

The GET /payment-methods call is returning additional data that is not captured in the Limit object

For Example:
"limits": {
"type": "fiat_account",
"name": "Coinbase Account",
"sell": [

"limits": {
"type": "bank",
"name": "Bank Account",
"buy": [

I created a fix for this in PR #20 commit 1da2556

Error while extracting response for type [class [Lcom.coinbase.exchange.model.Product;] ... max_market_funds

Error with this mapping. Am planning to change the field type hopefully that solves the issue.

org.springframework.web.client.RestClientException: Error while extracting response for type [class [Lcom.coinbase.exchange.model.Product;] and content type [application/json;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.lang.Integer from String "2.0": not a valid Integer value; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.lang.Integer from String "2.0": not a valid Integer value
at [Source: (PushbackInputStream); line: 1, column: 2523] (through reference chain: java.lang.Object[][6]->com.coinbase.exchange.model.Product["max_market_funds"])

at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:117)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:994)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:977)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:737)

Create documentation on how to write tests

I believe adding information how to write tests for the gdax-java library would be useful. This information should be added to the Readme and should help improve any newcomer's understanding of what the repo does and how they can contribute.

Any plans to get this project on Maven Central?

After looking around I can tell this is one of the better Coinbase Pro Java projects out there: well tested, regularly maintained, follows good Git practices. But the jar not being available on Maven Central makes it much more difficult to use this work in other projects. Are there any plans to do that? It would be very nice if I could just put the dependency in my build file, and it would be much appreciated!

Paged requests could be implemented better

I believe paged requests could be better implemented by overloading the GdaxExchange.get(...) method and providing an interceptor that updates the request headers. This would clean up a lot of the boilerplate and make transitioning between either method more seamless.

Can I just get a jar?

I just want the jar. ./gradlew jar does not work. i dont want to run this in spring boot. just standalone java application.

Gradlew jar. Could not resolve central.maven.org

Hi,
I downloaded the project and tried building the jar. The build fails because it cannot resolve modules because it cannot resolve any maven. I tried it on different computers and had the same error.

Websocket is not working with the sandbox environment

WebSocket is not working with the sandbox environment.
Error:


javax.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection failed
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:485)
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:194)
    at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:150)
    at org.springframework.web.socket.client.standard.StandardWebSocketClient$1.call(StandardWebSocketClient.java:147)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: javax.net.ssl.SSLException: Received fatal alert: handshake_failure
    at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:512)
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:343)
    ... 5 common frames omitted
Caused by: javax.net.ssl.SSLException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1666)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1634)
    at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1800)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1083)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
    at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WebSocketSslHandshakeThread.run(AsyncChannelWrapperSecure.java:392)

Ref: https://stackoverflow.com/questions/49648694/java-websocket-client-not-working-with-gdax-sandbox-environment

Package separation

This is a great project and helps me a lot, thank you very much for all your work. Still I would like to make a small proposal: after checking out it is a bit difficult to separate the actuall API packages from your own application. Maybe you can create an com.irufus.gdax.app package and move all the code that is not the actuall api over there? That would be awesome.

Kind regards
Johannes

Handle Rate Limits

When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.

Examples of the WebsocketFeed?

Hi,
Is there a example of how to use the "WebsocketFeed" for caching a snapshot of the orderbook provided?

I look forward for your help!
Regards
Marko

WebsocketFeed stops receiving messages

When I run the GUI, the websocket invariably stops receiving messages with no indication of a failure. I'm not directly using the GUI, I'm just logging matched orders from the swing worker. I added a println and at least some of the time the socket returns this close reason "code [1006], reason [Unexpected end of stream]".

If anyone can point me in the right direction to figure out why this happens that would be great; I'm trying to achieve an always-on, super stable feed. This repo is awesome, thanks to all contributors!

Example / Quick Start

I'm not used to spring, so it would be very helpful to have an example, or a small sort of quick-start explanation how to get started using the your API. I managed to build it using the Eclipse IDE, and also to run the unit tests, but struggling now how to start. It would be helpful to have a description of - for example - just read my account-data.
thx in advance!

Time issue

Hi ,

I was looking at your api and i came up with a question.
Let say we want to get /products/{productId}/candles.
It requires the startTime and endTime and that is ok, my question is should i provide this values in which timezone?

Pagination

For accounts orders, fills, deposits, withdrawals and more.

SEVERE: CancelAllOrders worked even with a VIEW ONLY API key

Hi,

I downloaded the code, and was running the junit tests locally and encountered an issue with the cancelAllOrders test method. Even though the method failed with the below exception, it still canceled all my existing orders.

At this moment, I only have a View Only API Key. I don't have any API Keys with Trade permissions.

I didnt try running the createOrder test methods for fear of it creating market orders, even with the VIEW only API key. Do please look into this urgently.

Thanks.

Error below:

org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not construct instance of com.coinbase.exchange.api.orders.Order: no String-argument constructor/factory method to deserialize from String value ('e7046f48-9c93-4250-9981-be9fd1701c58'); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.coinbase.exchange.api.orders.Order: no String-argument constructor/factory method to deserialize from String value ('e7046f48-9c93-4250-9981-be9fd1701c58')
at [Source: java.io.PushbackInputStream@6fd5717c; line: 1, column: 2] (through reference chain: java.lang.Object[][0])

at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:244)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:229)
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:96)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:917)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:901)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:655)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:559)
at com.coinbase.exchange.api.exchange.GdaxExchangeImpl.delete(GdaxExchangeImpl.java:98)
at com.coinbase.exchange.api.orders.OrderService.cancelAllOpenOrders(OrderService.java:53)
at com.coinbase.exchange.api.orders.OrderTests.cancelAllOrders(OrderTests.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.coinbase.exchange.api.orders.Order: no String-argument constructor/factory method to deserialize from String value ('e7046f48-9c93-4250-9981-be9fd1701c58')
at [Source: java.io.PushbackInputStream@6fd5717c; line: 1, column: 2] (through reference chain: java.lang.Object[][0])
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012)
at com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:370)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:315)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1282)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:150)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:196)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:20)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2922)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:241)
... 38 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.