I'm novice to programming and learning python3.
Recently I'm trying to make cryptocurrency trading system using binance's api.
Here's the api document.
The logic and explanation about timestamp in the document is as follows :
Timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent.
if (timestamp < serverTime && (serverTime - timestamp) <= recvWindow)
{ // process request } else { // reject request }
According to this logic, the time I sent the request should be less than the time on the server. The problem is that I have not passed this logic.
When I call time.time() and server time using this code,
import requests
import simplejson as json
import time
base_url = "https://api.binance.com"
servertime_endpoint="/api/v1/time"
url = base_url + servertime_endpoint
t = time.time()*1000
r = requests.get(url)
result = json.loads(r.content)
print(int(t)-result["serverTime"])
time.time() is bigger than server time so that I get return from last sentence with positive value. What should I do?