unterstein / binance-trader

Experimental trading bot for crypto currency on Binance.com
Apache License 2.0
274 stars 144 forks source link

Timestamp for this request was 1000ms ahead of the server's time. #8

Open hellsayenci opened 6 years ago

hellsayenci commented 6 years ago

I am running your code via docker on my mac. When bot decides to buy there is an error that says Unable to perform ticker and an exception like the issue title. How can I fix this?

Thanks

rickdeaconx commented 6 years ago

Same error here.

det-peralta commented 6 years ago

+1

VasTShadowZz commented 6 years ago

+2

rickdeaconx commented 6 years ago

docker run --rm --privileged alpine hwclock -s

fixes this

VasTShadowZz commented 6 years ago

To anyone having this issue...

Control Panel Time & Date Internet Time Change Settings Check Synchronize with an Internet time server Type pool.ntp.org into the server Update Now Your Welcome c:

stevengehner commented 6 years ago

Thanks but there is still an 1 hour difference between the docker time and machine time

mgrapiniak commented 6 years ago

Here is an example stacktrace:

2018-01-20 19:05:08.132 INFO 17 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : nothing bought, let`s check 2018-01-20 19:05:08.132 INFO 17 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : Buy detected 2018-01-20 19:05:08.133 INFO 17 --- [pool-1-thread-1] io.github.unterstein.TradingClient : Buying 1 for 0.00820201

2018-01-20 19:05:08.487 ERROR 17 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : Unable to perform ticker

com.binance.api.client.exception.BinanceApiException: Timestamp for this request was 1000ms ahead of the server's time. at com.binance.api.client.impl.BinanceApiServiceGenerator.executeSync(BinanceApiServiceGenerator.java:57) ~[binance-api-client-1.0.0.jar!/:na] at com.binance.api.client.impl.BinanceApiRestClientImpl.newOrder(BinanceApiRestClientImpl.java:103) ~[binance-api-client-1.0.0.jar!/:na] at io.github.unterstein.TradingClient.buy(TradingClient.java:66) ~[classes!/:0.0.1-SNAPSHOT] at io.github.unterstein.BinanceTrader.tick(BinanceTrader.java:55) ~[classes!/:0.0.1-SNAPSHOT] at io.github.unterstein.BinanceBotApplication.schedule(BinanceBotApplication.java:53) [classes!/:0.0.1-SNAPSHOT] at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151] at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) [spring-context-4.3.5.RELEASE.jar!/:4.3.5.RELEASE] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.5.RELEASE.jar!/:4.3.5.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_151] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_151] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_151] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_151] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]

wenyi189 commented 6 years ago

Hi is this fixed? I'm still running into this issue. And @VasTShadowZz suggested solution did not work.

elysium-12 commented 6 years ago

The problem described here is not an issue with the script, but rather an issue with the end host not being synchronized with ntp.

TroyHGP commented 4 years ago

Windows has a program called Dimension 4, it synchronizes your clock at regular intervals. it was the only thing I tried that fixed the timestamp error permanently when working with Binance for another project.