jsup 2.1 - investor's relief (experiment on separation of investment and SNS)

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/jsup-2-1-investor-s-relief-experiment-on-separation-of-investment-and-sns Hello, this is @joviansummer(witness: @jswit). I'm starting a new experiment regarding my @jsup vote service. The purpose of this experiment is to separate STEEM investment and social interaction(posting/commenting). For many people, writing a post daily(literally 365 posts per year) is not easy. It's not fun, and mandatory daily post only written for self-voting delegation service tends to result in useless low-quality content. I hope this new function of @jsup will reduce those posts, and also make it a bit more easy to invest in STEEM without worrying about daily posting. I think pressure of daily posting significantly undermines Steem as SNS. It's not fun. This is how it works: From 11:45 PM to 11:50 PM every night(reference time zone is GMT+9), @jsup checks if eligible delegators wrote something and received daily v...

파이썬으로 업비트 거래소의 스팀 가격 조회

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/6bstk5


업비트(Upbit) 거래소에서 코인 시세 조회를 위한 API를 제공하는데요. 이를 이용해서 스팀 가격을 조회하는 작업을 파이썬으로 수행할 수 있습니다.

@jswit 증인 노드에서 스팀 가격을 공시해야 하는데, 업비트의 스팀 시세를 이용하기 위해 필요한 부분입니다.

달러 기준으로 시세를 공시해야 하므로 업비트의 BTC-STEEM 시세와 USDT-BTC 시세를 가져온 후 USDT-STEEM 시세를 계산하여 공시하려고 합니다.

파이썬의 requests 모듈을 이용해서 업비트에 API 요청을 보내면 json 형식으로 응답이 오는데요, 이것을 딕셔너리로 변환하여 작업합니다.

import requests

# 업비트 API 접속 주소 (BTC-STEED, USDT-BTC)
ticker_url = "https://api.upbit.com/v1/ticker?markets=BTC-STEEM,USDT-BTC"

# HTTP GET 요청으로 접속하여 응답 수신
response_raw = requests.get(ticker_url)
# json 형식의 응답을 딕셔너리(dict) 형식으로 변환
response = response_raw.json()

# BTC-STEEM 시세
btc_steem_price = response[0]['trade_price']
# USDT-BTC 시세
usdt_btc_price = response[1]['trade_price']
# USDT-STEEM 시세 계산
steem_price = btc_steem_price * usdt_btc_price

print('STEEM 가격:', steem_price)

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기

jsup/avle code update - you don't have to write post everyday