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

0 Members and 1 Guest are viewing this topic.

Offline jackingyang

  • Full Member
  • ***
  • Posts: 81
    • View Profile
  • BitShares: bts0207
List all assets using python-bitshares
« on: January 23, 2019, 09:21:13 am »
how?

Offline jackingyang

  • Full Member
  • ***
  • Posts: 81
    • View Profile
  • BitShares: bts0207
Re: List all assets using python-bitshares
« Reply #1 on: January 23, 2019, 09:22:55 am »
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()

It don't work.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12895
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: List all assets using python-bitshares
« Reply #2 on: January 23, 2019, 10:07:21 am »
Assets have an "id" of the form "1.3.xxx". The easiest way to iterate through them would be to just count
from 1.3.0 (BTS) until you get an AssetDoesNotExist exception.
Keep in mind that there are a few empty ids right after 1.3.0 too ..
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline jackingyang

  • Full Member
  • ***
  • Posts: 81
    • View Profile
  • BitShares: bts0207
Re: List all assets using python-bitshares
« Reply #3 on: January 23, 2019, 10:18:33 am »
Assets have an "id" of the form "1.3.xxx". The easiest way to iterate through them would be to just count
from 1.3.0 (BTS) until you get an AssetDoesNotExist exception.
Keep in mind that there are a few empty ids right after 1.3.0 too ..
Thanks