Hi community! I hope you are fine!
I am playing with a code to operate in spot/margin. I wrote (with some helps) the spot and all are working well. Now I am coding the margin and I am confusing about the starTime and the time stamp.
I share the function to take a loan … in which I need to provide the startTime:
def GetLoanM(self, amount, asset:str):
url = self.base + self.endpointsmargin["loan"]
timestamp_a =int(round(time.time()*1000))
params = {
'asset' : asset,
'amount' : amount,
'startTime' : int(round(ts*1000)),
'timestamp' : timestamp_a
}
self.signRequest(params)
return self._get(url, params, self.headers)
I know this ( ‘startTime’ : int(round(ts*1000))," ) is wrong but i don’t find similar problem or answer.
If I run the code I check that I have money in the Marginwallet:
{'asset': 'USDT', 'free': '10', 'locked': '0', 'borrowed': '0', 'interest': '0', 'netAsset': '10'}
but the loan it in not occur, the answer is:
{‘total’: 0, ‘rows’: , ‘url’: ‘https://api.binance.com/sapi/v1/margin/loan’}
and checking again the wallet:
{'asset': 'USDT', 'free': '10', 'locked': '0', 'borrowed': '0', 'interest': '0', 'netAsset': '10'}
I “know” that the timestamp is the current (UNIX time) time in millisecond, and the starTime is the time in which the operation was sent (let me know if I am wrong) … So, should by the same time???
I will appreciate any comment.
Thanks for your answer.
Alf