프로젝트

일반

사용자정보

Actions

호가 전체 정보

소스코드

import pybithumb

orderbook = pybithumb.get_orderbook("BTC") # 호가 정보
print(orderbook)

# 호가 키워드
for k in orderbook:
    print(k)

결과

{'timestamp': '1738644390448', 'payment_currency': 'KRW', 'order_currency': 'BTC', 'bids': [{'price': 155693000.0, 'quantity': 0.002}, {'price': 155685000.0, 'quantity': 0.0102}, {'price': 155682000.0, 'quantity': 0.0113}, {'price': 155681000.0, 'quantity': 0.0501}, {'price': 155680000.0, 'quantity': 0.0247}], 'asks': [{'price': 155694000.0, 'quantity': 0.0012}, {'price': 155695000.0, 'quantity': 0.0025}, {'price': 155737000.0, 'quantity': 0.0114}, {'price': 155740000.0, 'quantity': 0.0163}, {'price': 155754000.0, 'quantity': 0.0001}]}
timestamp
payment_currency
order_currency
bids
asks

부가 설명

key Description
timestamp 호가 조회 시간
payment_currency 결제 통화
order_currency 가상화폐 티커
bids 매수 호가
asks 매도 호가

timestamp 시간 변환 소스코드

import pybithumb
import datetime

orderbook = pybithumb.get_orderbook("BTC") # 호가 정보
ms = int(orderbook['timestamp'])

dt = datetime.datetime.fromtimestamp(ms/1000) # 시간 계산
print(dt)

결과

2025-02-04 13:53:03.395000

※timestamp 계산법

timestamp값 / 1000(초로 변환) / 86400(1일에 해당하는 초) / 365(1년)

이태훈이(가) 10달 전에 변경 · 3 revisions