STEEM, SBD and implied market prices with PythonsteemCreated with Sketch.

in #steemtools8 years ago

steemtools has the market module for a while now, but I have refrained from posting about it to make sure its well tested.

I am using it for my market maker, as well as witness price feeds, and it seems to be working reasonably well.

This post serves as documentation.

Installation

pip install -U steemtools

Tickers

Tickers allows us to get latest prices of BTC/USD, STEEM/BTC and SBD/BTC from 3d party exchanges.

By default, all requests to the 3rd party exchanges are concurrent, with a total max timeout of 2 seconds. This means that we get the price in a very short amount of time.

from steemtools.markets import Tickers
t = Tickers()

print("=> %s" % t.btc_usd_ticker())
=> 638.741378838

print("=> %s" % t.steem_btc_ticker())
=> 0.000416185      

print("=> %s" % t.sbd_btc_ticker())
=> 0.0014382275     

BTC/USD

Bitcoin price is a VWAP (volume weighted average price) of the prices from the following exchanges:

  • Bitstamp
  • Coinbase
  • Bitfinex
  • OKCoin
  • BTC-E

The exchanges with more volume $have higher weight in determining the price.

STEEM, SBD

STEEM and SBD are based on median prices from STEEM/BTC and STEEM/SBD pairs on:

  • Poloniex
  • Bittrex

Markets

The markets module gives us some convenience methods to calculate implied prices, such as price of STEEM in USD.
The markets module will cache results by default, for faster execution. You can change or disable caching:

m = Markets(cache_timeout=0)

Usage:

from steemtools.markets import Markets
m = Markets()

m.steem_usd_implied()
#> 0.264540722252

m.steem_sbd_implied()
#> 0.28783938489

m.sbd_usd_implied()
#> 0.919056724476

# same as tickers, but with caching
m.btc_usd()
m.steem_btc()
m.sbd_btc()

Feedback is welcome

If you have any suggestions on how to improve this module, I'd love to hear your feedback.

PS> 100% of the post rewards go to power-up.



Don't miss out on the next post - follow me.
SteemQ | steemtools | steem.li | witness


Sort:  

15 minutes seems so long sometimes when you are waiting to upvote a good post

Nicely done furion thanks for this documentation.

Maybe you can give me a hand. I am trying to install these great tools in Anaconda. I receive an error message when I try to install steem or steemtools (pip install -U). The error message is similar for both. First in red, "failed building wheel for script".

Then, at the end of the long process,

Command "C:\Users\Julio\Anaconda3\python.exe -u -c "import setuptools, tokenize;
file='C:\Users\Julio\AppData\Local\Temp\pip-build-wj65gmkf\scrypt\se
tup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n'
, '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Use
rs\Julio\AppData\Local\Temp\pip-3u1yruxc-record\install-record.txt --single-vers
ion-externally-managed --compile" failed with error code 1 in C:\Users\Julio\App
Data\Local\Temp\pip-build-wj65gmkf\scrypt\

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.028
BTC 63006.79
ETH 2456.26
USDT 1.00
SBD 2.59