본문 바로가기

VBA/Code

[VBA] 업비트 Open API>출금>개별 출금 조회

반응형

API Reference

HTTP Method API URL
GET https://api.upbit.com/v1/withdraw

 

QUERY PARAMS

필드명 필수 여부 설명 타입
uuid N 출금 UUID String
txid N 출금 TXID String
currency N Currency 코드 String

 

HEADERS

헤더명 필수 여부 설명 타입
Authorization Y Authorization token (JWT) String

 

Request Parameters

필드명 설명 타입
uuid 출금 UUID String
txid 출금 TXID String
currency Currency 코드 String

 

Response

필드명 설명 타입
type 입출금 종류 String
uuid 출금의 고유 아이디 String
currency 화폐를 의미하는 영문 대문자 코드 String
txid 출금의 트랜잭션 아이디 String
state 출금 상태 String
created_at 출금 생성 시간 String
done_at 출금 완료 시간 String
amount 출금 금액/수량 NumberString
fee 출금 수수료 NumberString
transaction_type

출금 유형

■ default : 일반출금

■ internal : 바로출금

String

 

VBA Code

Sub Upbit_Withdraw()
     
    Const ACCESS_KEY As String = "UPBIT_OPEN_API_ACCESS_KEY"
    Const SECRET_KEY As String = "UPBIT_OPEN_API_SECRET_KEY"
     
    Dim WinHttp As New WinHttp.WinHttpRequest 
    Dim url As String, nonce As String, queryStr As String 
    Dim header As String, payload As String, signature As String, jwt As String 
    'Dim uuid As String, txid As String, xCurrency As String 
     
    url = "https://api.upbit.com/v1/withdraw" 
     
    'uuid = "" 
    'txid = "" 
    'xCurrency = "" 
    'queryStr = "uuid=" & uuid & "&txid=" & txid & "&currency=" & xCurrency 
     
    nonce = DateDiff("s", "1/1/1970", Now) & Right(Timer() * 100, 3) 
    header = Base64Encode(StrConv("{""alg"":""HS256"",""typ"":""JWT""}", vbFromUnicode)) 
    payload = "{""access_key"":""" & ACCESS_KEY & """,""nonce"":""" & nonce & """,""query"":""" & queryStr & """}" 
    payload = Base64Encode(StrConv(payload, vbFromUnicode)) 
    signature = Base64Encode(SHA256Encrypt(header & "." & payload, SECRET_KEY)) 
    jwt = header & "." & payload & "." & signature 
     
    With WinHttp 
        .Open "GET", url & "?" & queryStr 
        .SetRequestHeader "Authorization", "Bearer " & jwt 
        .Send 
        .WaitForResponse 
        Debug.Print .ResponseText 
    End With 

    Set WinHttp = Nothing 

End Sub

 

SHA-256 Encrypt

더보기
 

[VBA] SHA-256 Encrypt

SHA-256 SHA-256은 SHA(Secure Hash Algorithm) 알고리즘의 한 종류로서 256비트로 구성되며 64자리 문자열을 반환한다. SHA-256은 미국의 국립표준기술연구소(NIST; National Institute of Standards and Technol..

xlmaster.tistory.com

Function SHA256Encrypt(text As String, Optional secretKey As String = vbNullString) As Byte()  
       
    Dim asc As Object, enc As Object   
    Dim bText() As Byte, bKey() As Byte, bytes() As Byte   
       
    Set asc = CreateObject("System.Text.UTF8Encoding")   
       
    If secretKey <> vbNullString Then   
        Set enc = CreateObject("System.Security.Cryptography.HMACSHA256")   
        bText = asc.Getbytes_4(text)   
        bKey = asc.Getbytes_4(secretKey)   
        enc.Key = bKey   
        bytes = enc.ComputeHash_2(bText)   
    Else   
        Set enc = CreateObject("System.Security.Cryptography.SHA256Managed")   
        bText = asc.Getbytes_4(text)   
        bytes = enc.ComputeHash_2((bText))   
    End If   
       
    SHA256Encrypt = bytes   
       
    Set asc = Nothing   
    Set enc = Nothing   
       
End Function

 

Base64 Encode

더보기
 

[VBA] Base64 Encoding/Decoding

Base64 바이너리 데이터를 문자 코드에 영향을 받지 않는 공통 ASCII 문자로 표현하기 위해 만들어진 인코딩이다. ASCII 문자 하나가 64진법의 숫자 하나를 의미하기 때문에 BASE64라는 이름을 가졌다. 데이터를 6..

xlmaster.tistory.com

Function Base64Encode(ByRef arrData() As Byte) As String   

    Dim objXML As MSXML2.DOMDocument   
    Dim objNode As MSXML2.IXMLDOMElement   
       
    Set objXML = New MSXML2.DOMDocument   
    Set objNode = objXML.createElement("b64")   

    objNode.DataType = "bin.base64"   
    objNode.nodeTypedValue = arrData   
    Base64Encode = Replace(objNode.text, Chr(10), vbNullString)   

    Set objNode = Nothing   
    Set objXML = Nothing   

End Function

 

업비트 OPEN API

EXCHANGE API 자산 전체 계좌 조회 https://xlmaster.tistory.com/25
주문 주문 가능 정보 https://xlmaster.tistory.com/26
개별 주문 조회 https://xlmaster.tistory.com/32
주문 리스트 조회 https://xlmaster.tistory.com/27
주문 취소 접수 https://xlmaster.tistory.com/28
주문하기 https://xlmaster.tistory.com/29
출금 출금 리스트 조회 https://xlmaster.tistory.com/30
개별 출금 조회 https://xlmaster.tistory.com/31
출금 가능 정보 https://xlmaster.tistory.com/33
코인 출금하기 https://xlmaster.tistory.com/34
원화 출금하기 https://xlmaster.tistory.com/35
입금 입금 리스트 조회 https://xlmaster.tistory.com/36
개별 입금 조회 https://xlmaster.tistory.com/37
입금 주소 생성 요청 https://xlmaster.tistory.com/38
전체 입금 주소 조회 https://xlmaster.tistory.com/39
개별 입금 주소 조회 https://xlmaster.tistory.com/40
QUOTATION API 시세 종목 조회 마켓 코드 조회 https://xlmaster.tistory.com/15
시세 캔들 조회 분(Minute) 캔들 https://xlmaster.tistory.com/16
일(Day) 캔들 https://xlmaster.tistory.com/17
주(Week) 캔들 https://xlmaster.tistory.com/18
월(Month) 캔들 https://xlmaster.tistory.com/19
시세 체결 조회 당일 체결 내역 https://xlmaster.tistory.com/20
시세 Ticker 조회 현재가 정보 https://xlmaster.tistory.com/21
시세 호가 정보(Orderbook) 조회 호가 정보 조회 https://xlmaster.tistory.com/22

 

Upbit Open API v1.0.6

 

반응형