bitshares / uptick

Python-based CLI tool set for BitShares blockchain
MIT License
42 stars 27 forks source link

uptick HERO pricefeed raise ValueError("Multiplication of two unmatching prices!") #4

Closed ghost closed 7 years ago

ghost commented 7 years ago

I have been using this script to price feed HERO:

from getpass import getpass
from bitshares.price import Price
from bitshares.market import Market
from datetime import date

# unlock wallet
unlock      = "password"

# USD:BTS price
market = Market("USD:BTS")
price = market.ticker()["quoteSettlement_price"]
price.invert()  # invert to allow easier multiplication

# HERO:USD price
hero_usd = (1.05 ** ((date.today() - date(1913, 12, 23)).days / 365.2425))
hero = Price(hero_usd, "USD/HERO")

# HERO:BTS price
hero_bts = price * hero

#~ print("Price of HERO in USD: {}".format(hero))
#~ print("Price of USD in BTS: {}".format(price))
#~ print("Price of HERO in BTS: {}".format(hero_bts))

# unlock wallet
# market.bitshares.wallet.unlock(getpass("Password: "))
#market.bitshares.wallet.unlock(getpass())
market.bitshares.wallet.unlock(unlock)
print(market.bitshares.publish_price_feed(
    "HERO",
    hero_bts,
    account="delegate.ihashfury"
))
market.bitshares.wallet.lock()

and I updated uptick today:

:~$ pip3 install uptick --user --upgrade

Now my feed produces this error:

Traceback (most recent call last):
  File "hero-pricefeed.py", line 21, in <module>
    hero_bts = price * hero
  File ".local/lib/python3.5/site-packages/bitshares/price.py", line 225, in __mul__
    raise ValueError("Multiplication of two unmatching prices!")
ValueError: Multiplication of two unmatching prices!
xeroc commented 7 years ago

Yhea .. I need to work on the price module anyways ..

xeroc commented 7 years ago

Please note that changes in price.py in this commit: https://github.com/xeroc/python-bitshares/commit/0ff4bc076e7e1557f77cc430f38b2f3683b3c744

xeroc commented 7 years ago

fixed with release of 0.0.4