Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - doug

#1
Technical Support / Re: [pyBitShares] Release 0.3.0
March 05, 2019, 07:05:37 PM
I upgraded my pybitshares package and that corrected the problem.
#2
Technical Support / Re: [pyBitShares] Release 0.3.0
March 05, 2019, 06:55:58 PM
I have had some working code (coded in pybitshares) that recently encountered errors. I did not change the code so I was wondering if some pybitshares code changes was the cause of the new errors?

Here is a small snippet of code that illustrates the problem:

from pprint import pprint
from bitshares.account import Account
from bitshares.market import Market

#This code works fine...
marketObj = Market("OPEN.EOS:BTS")
t = marketObj.ticker()
print(t)
#Below generates an error (same code, different market parameter):
marketObj = Market("OPEN.EOSDAC:BTS")
t = marketObj.ticker()
print(t)

when I execute this code the result is:
python3 bug_report.py

{'latest': 79.72939583253 BTS/OPEN.EOS, 'core_exchange_rate': 66.11000000000 BTS/OPEN.EOS, 'quoteVolume': 450.907329 OPEN.EOS, 'lowestAsk': 81.46565644572 BTS/OPEN.EOS, 'highestBid': 79.72939583253 BTS/OPEN.EOS, 'percentChange': 6.97, 'baseVolume': 35,861.43141 BTS}
Traceback (most recent call last):
  File "bug_report.py", line 11, in <module>
    t = marketObj.ticker()
  File "/home/plview/HUG/lib/python3.5/site-packages/bitshares/market.py", line 174, in ticker
    data["percentChange"] = float(ticker["percent_change"])
ValueError: could not convert string to float:


Any ideas on what is causing this? Or how to correct it?
#3
Nevermind.
I SOLVED my problem.
#4
I'm having difficulty obtaining the current supply of a UIA using pybitshares.
When I look at the data in the Asset() call I see the "dynamic_asset_data_id" which is what I believe I need to access to obtain the current_supply for the UIA (I believe this from reading the Graphene doc).

I have the following code that provides me with the asset info:

a = Asset(asset_id)
pprint(a)
for i in a:
    print(i, a)

I obtain the following output when "asset_id" = "1.3.4106":

<Asset 1.3.4106>
symbol RUDEX.EOS
dynamic_asset_data_id 2.3.4106
options {'issuer_permissions': 79, 'extensions': [], 'description': '{"main":"RUDEX.EOS asset is backed 1:1 by the real EOS on EOS blockchain (https://eos.io), and can be deposited and withdrawn using gateway operated by RuDEX (https://rudex.org).","short_name":"EOS","market":""}', 'max_market_fee': 0, 'whitelist_markets': [], 'core_exchange_rate': {'quote': {'amount': 10000, 'asset_id': '1.3.4106'}, 'base': {'amount': 3000000, 'asset_id': '1.3.0'}}, 'whitelist_authorities': [], 'max_supply': '100000000000000', 'blacklist_authorities': [], 'flags': 4, 'market_fee_percent': 0, 'blacklist_markets': []}
issuer 1.2.384252
permissions {'white_list': True, 'transfer_restricted': True, 'witness_fed_asset': False, 'override_authority': True, 'disable_confidential': True, 'charge_market_fee': True, 'disable_force_settle': False, 'global_settle': False, 'committee_fed_asset': False}
description {'market': '', 'short_name': 'EOS', 'main': 'RUDEX.EOS asset is backed 1:1 by the real EOS on EOS blockchain (https://eos.io), and can be deposited and withdrawn using gateway operated by RuDEX (https://rudex.org).'}
precision 4
id 1.3.4106
flags {'white_list': False, 'transfer_restricted': False, 'witness_fed_asset': False, 'override_authority': True, 'disable_confidential': False, 'charge_market_fee': False, 'disable_force_settle': False, 'global_settle': False, 'committee_fed_asset': False}


The output in orange above is what I believe I need to inspect to obtain the current supply of the UIA.

I have tried to use the AssetId call from the bitsharesbase.objects:

from bitsharesbase.objects import AssetId

o = AssetId('2.3.4901')
pprint(o)

which outputs:
<bitsharesbase.objects.ObjectId object at 0x7fcd39eef400>

I have tried a number of approaches but I keep getting error messages like: argument of type ObjectId is not iterable.

I'm struggling to inspect that object!

Can anyone give me a pybitshares example of how to obtain the current_supply for a UIA?