Author Topic: List all assets using python-bitshares  (Read 525 times)

0 Members and 1 Guest are viewing this topic.

Offline runestone

List all assets using python-bitshares
« 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?
Br, Rune
~ Please vote on blockbasis-witness
~ https://www.blockbasis.com

Offline sschiessl

Re: List all assets using python-bitshares
« Reply #1 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.)

Offline runestone

Re: List all assets using python-bitshares
« Reply #2 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.
Br, Rune
~ Please vote on blockbasis-witness
~ https://www.blockbasis.com

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12728
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: List all assets using python-bitshares
« Reply #3 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 ;)
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12728
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: List all assets using python-bitshares
« Reply #4 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 ;)
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline runestone

Re: List all assets using python-bitshares
« Reply #5 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)
Br, Rune
~ Please vote on blockbasis-witness
~ https://www.blockbasis.com