메뉴 건너뛰기

목록
2023.02.05 17:14

나도 핫산시켜봤음

profile
조회 수 16 댓글 0 예스잼 0 노잼 0

No Attached Image

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
import requests
import json
 
# Replace YOUR_API_KEY and YOUR_SECRET_KEY with your own API keys from Gate.io
api_key = "YOUR_API_KEY"
secret_key = "YOUR_SECRET_KEY"
 
# The endpoint for the trade API
url = "https://api.gateio.io/api2/1/private/marginTrade"
 
# The parameters for the trade API
params = {
    "currencyPair""btc_usdt"# the currency pair you want to trade
    "rate"9000# the rate at which you want to buy/sell
    "amount"0.01# the amount of the currency you want to buy/sell
    "tradeType""buy"# the type of trade, buy or sell
    "leverage"10 # the leverage you want to use
}
 
# Add the API key to the parameters
params["nonce"= 123456 # the nonce, a unique number for each API request
params["apikey"= api_key
 
# Sign the API request with the secret key
signature = hmac.new(secret_key.encode(), json.dumps(params).encode(), hashlib.sha512).hexdigest()
 
# Add the signature to the API request
headers = {
    "Sign": signature,
    "Key": api_key
}
 
# Make the API request
response = requests.post(url, data=params, headers=headers)
 
# Check the API response
if response.status_code == 200:
    # Parse the response JSON
    result = response.json()
    print(result)
else:
    # Print the error message
    print("Error:", response.text)
 
cs

 

 

API 문서보고 짜야될거 말한마디면 바로쓸수있게끔 짜주니까 신기하긴하네

gateio 마진거래 파이썬으로 짜달라한거임


List of Articles
번호 제목 글쓴이 날짜 조회 수 추천
공지 수용소닷컴 이용약관 file asuka 2020.05.16 1313 1
992 삭제된 게시글입니다. midori 2023.03.06 30 0
991 삭제된 게시글입니다. midori 2023.03.04 15 0
990 오라클 컴퓨트 인스턴스생성할때 3 file 저능아 2023.03.03 36 0
989 개발자구인 도랏노 1 말에미쳤다 2023.03.01 39 0
988 삭제된 게시글입니다. midori 2023.02.20 57 0
987 삭제된 게시글입니다. midori 2023.02.13 39 0
986 오라클 문의메일 회신왔네 3 file 저능아 2023.02.09 49 1
985 오라클 가입오류 유명하네 4 file 저능아 2023.02.07 121 0
984 오라클 클라우드 입밴당함 file 저능아 2023.02.06 35 0
983 정보처리기사 공부 on 2 그리드 2023.02.06 34 0
» 나도 핫산시켜봤음 저능아 2023.02.05 16 0
981 트위터 API 유료화한다! 3 그리드 2023.02.03 33 0
980 아마존이 800원 뺏어갔음 file 저능아 2023.02.03 30 0
979 ChatGPT 진짜 지리네... 말만 하면 코드를 다 짜줌 7 file midori 2023.01.30 86 0
978 윈도우에서 그냥 pip만 쓰다가 8 file 저능아 2023.01.30 36 0
977 네이버 AI TECH 1차문제 그리드 2023.01.26 40 0
976 이거 해석좀 해주셈 5 그리드 2023.01.20 56 0
975 재미없는 취업공고 그리드 2023.01.16 44 0
974 Microsoft Visual Studio 2022를 사용하여 첫 번째 C++ Windows Form 만들기 9 file 저능아 2023.01.15 380 1
973 C++로 GUI를 만들어야 된다는데 16 삼육두유 2023.01.15 54 0
목록
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 56 Next
/ 56