-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBUY_10_TRX.py
47 lines (41 loc) · 944 Bytes
/
BUY_10_TRX.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
---ASTRA RESEARCH---
API client for PAYEER trading
Example "BYU 10 TRX Market order"
"""
import requests
import hashlib
import hmac
import time
import json
APISECRRET='MY_SECRET' # ---CHANGE IT
APIID='MY_ID-8c2e-57b86eee88ab' # Change Too :-)
pair = "TRX_USD"
amount = "10"
ts = int(round(time.time()*1000))
ts=str(ts)
print(ts)
values =json.dumps ({
"pair": pair,
"type": "market",
"action": "buy",
"amount": amount,
"ts": ts
})
print(values)
msg = bytes(values, "utf-8")
method = 'order_create'
method = bytes(method, "utf-8")
api_secret = bytes(APISECRRET, "utf-8")
H = hmac.new(api_secret, digestmod=hashlib.sha256)
H.update(method)
H.update(msg)
sign = H.hexdigest()
headers = {
'Content-Type': 'application/json',
'API-ID': APIID,
'API-SIGN': sign
}
print(headers)
res = requests.request(method= 'POST', url='https://payeer.com/api/trade/order_create', data=values, headers=headers)
print(res.text)