메뉴 건너뛰기

목록
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 1345 1
879 기술.. 컴공... 5 그리드 2021.09.29 56 0
878 기술동 뒤졌노 7 하루히 2021.07.05 58 0
877 기초부터 공부중 1 그리드 2022.02.18 56 0
876 기출문제 풀면서 모르는걸 외우겠음 또치면과락 2024.05.08 45 0
875 긴급하게 패스트캠퍼스 CV활용과 2 file 그리드 2022.11.19 23 0
874 깃헙에 뭐 올려야함?? 6 아야나미레이 2022.04.09 56 0
873 깃헙에 뭐 채워야함? 1 아야나미레이 2022.03.19 28 0
872 꺼토미 소스코드 보고있는데 1 midori 2021.12.05 98 1
871 꿰에에엑 그리드 2022.07.11 16 0
870 나는 취업할 생각이 없다 6 그라드 2020.07.27 147 0
869 나는 코딩에 재능이 없다 1 그라드 2020.10.25 95 0
» 나도 핫산시켜봤음 저능아 2023.02.05 16 0
867 나스같은건 나중에 디스크 확장이 더 어려우니 처음부터 크게크게 질러야함 3 file 무메이 2022.06.26 43 0
866 나이 들면서 머리 멍청해진게 느껴짐 2 마루쉐 2022.03.04 72 0
865 나중에 봐야할것 : 자바의 미래 버츄얼 쓰레드 또치면과락 2024.04.24 89 0
864 나중에 할 것 메모 1 file 삼육두유 2021.12.29 52 0
863 난 진짜 개좃댔다 2 file 毛簿没区 2021.11.07 54 0
862 남들이 안쓰는 언어란 언어만 취급하는 똥믈리에 하야한아이 2021.02.13 62 0
861 내 좆대로 해석해본 문제풀이 4 전라도홍어 2021.05.07 90 0
860 내가 이 분야로 취업할 수 있을까? 1 그라드 2020.09.27 73 0
목록
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 ... 56 Next
/ 56