메뉴 건너뛰기

목록
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 1304 1
» 나도 핫산시켜봤음 저능아 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 347 1
973 C++로 GUI를 만들어야 된다는데 16 삼육두유 2023.01.15 54 0
972 인스턴스 삭제하고 새로만들엇음.. 6 file 저능아 2023.01.14 32 0
971 dma... 2 file 그리드 2023.01.14 25 0
970 어... ? 그리드 2023.01.13 16 0
969 삭제된 게시글입니다. 애옹쓰 2023.01.12 5 0
968 내일까지 컴퓨터공부 쉬겠음... 그리드 2023.01.12 16 0
967 2월까지 공부해야 할 것 1 그리드 2023.01.11 22 0
966 하입 씨팔 2 file 저능아 2023.01.11 19 0
965 100% 넘기는건뭐여 9 file 저능아 2023.01.10 29 0
964 이번주는 토익시험을 준비하면서 그리드 2023.01.09 15 0
963 그리드 2023.01.07 16 0
목록
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 56 Next
/ 56