BitShares Forum

Main => Technical Support => Topic started by: runestone on March 29, 2018, 01:42:29 am

Title: List all assets using python-bitshares
Post by: runestone on March 29, 2018, 01:42:29 am
Question 1) What's the best way to get a list of all asset symbols/ids using python-bitshares?

Question 2) The code below return an unexpected error: AttributeError: 'BlockchainObject' object has no attribute 'refresh'
Code: [Select]
from bitshares.blockchainobject import BlockchainObject
obj = BlockchainObject({}, use_cache=False)
print(obj.items())
Why?
Title: Re: List all assets using python-bitshares
Post by: sschiessl on March 29, 2018, 07:06:38 am
BlockchainObject is the base abstract class, use the Object class you actually want to have (Asset, Account, etc.)
Title: Re: List all assets using python-bitshares
Post by: runestone on March 29, 2018, 01:23:25 pm
I was looking at BlockchainObject but the documentation for this class if rather limited. It's expecting "data", but what kind of data exactly? A few examples would be great.
Title: Re: List all assets using python-bitshares
Post by: xeroc on March 29, 2018, 02:25:07 pm
from bitshares.asset import Asset
print(dict(Asset('USD')))


For listing assets, i believe there is no call in pybitshares yet. But you could call any rpc call thru the lib directly to by using

BitShares().rpc.CALLNAME()

The callname for listing asset however, i cannot remember ;)
Title: Re: List all assets using python-bitshares
Post by: xeroc on March 29, 2018, 02:25:15 pm
from bitshares.asset import Asset
print(dict(Asset('USD')))


For listing assets, i believe there is no call in pybitshares yet. But you could call any rpc call thru the lib directly to by using

BitShares().rpc.CALLNAME()

The callname for listing asset however, i cannot remember ;)
Title: Re: List all assets using python-bitshares
Post by: runestone on March 29, 2018, 02:40:38 pm
Alright, I'll play around with BitShares().rpc.CALLNAME().

One more question. What's the syntax for e.g. openledger's assets? I'd like to make market orders (buy/sell) with for example open.LTC ? (hence, the reason why I was looking for a full list of asset name/IDs)