xeroc/bitshares-pricefeed

KeyError: 'witness' - HERO feed

Opened this issue · 1 comments

I have setup uptick and tested a transaction:

:~$uptick transfer ihashfury 1 BTS
{'expiration': '2017-09-10T15:54:31',
 'extensions': [],
 'operations': [[0,
                 {'amount': {'amount': 100000, 'asset_id': '1.3.0'},
                  'extensions': [],
                  'fee': {'amount': 21851, 'asset_id': '1.3.0'},
                  'from': '1.2.23043',
                  'to': '1.2.12687'}]],
 'ref_block_num': 5828,
 'ref_block_prefix': 3709539019}

:~$uptick info

+-----------------------------------+------------------------------------------+
| Key                               | Value                                    |
+-----------------------------------+------------------------------------------+
| accounts_registered_this_interval | 49                                       |
| current_aslot                     | 20055683                                 |
| current_witness                   | 1.6.76                                   |
| dynamic_flags                     | 0                                        |
| head_block_id                     | 013016ea44a4e9a8e6f5f52e6b2b0aa61759ef2a |
| head_block_number                 | 19928810                                 |
| id                                | 2.1.0                                    |
| last_budget_time                  | 2017-09-10T15:00:00                      |
| last_irreversible_block_num       | 19928788                                 |
| next_maintenance_time             | 2017-09-10T16:00:00                      |
| recent_slots_filled               | 340282366920938463463374607431768211455  |
| recently_missed_count             | 0                                        |
| time                              | 2017-09-10T15:55:54                      |
| witness_budget                    | 8500000                                  |
+-----------------------------------+------------------------------------------+

uptick working.

I have also installed bitshares-pricefeed and have a hero.yaml feed file:

# The RPC API node
node: wss://node.bitshares.eu

# If true, a new price feed needs manual confirmation
confirm: False

# The producer name(s)
producer: delegate.ihashfury


assets:
    HERO:
        # max age of a feed
        maxage: 43200

        # minimum percentage that forces a publish
        min_change: 0.5

        # warn if price change goes above this percentage
        warn_change: 1.5

        # skip publishing a feed if price goes above this percentage
        skip_change: 3

        # Basic Price setup
        ###################

        # We want to feed according to a formula
        type: formula

        # We want to refer to an internal asset
        reference: intern 

        # ... namely "USD" a.k.a. "bitUSD"
        ref_asset: USD

        # The formula:
        #####################################
        # * 5% gain since creation of Federal Reserve System on 23th of December 1913.
        # * (date.today() - date(1913, 12, 23)).days is the number of days since then
        # * 365.2425 is the average number of days per year (https://en.wikipedia.org/wiki/Year)
        # * rounded to 2 decimals
        # * relative to the USD price feed in BitShares
        #####################################
        formula: 1.05 ** ((date.today() - date(1913, 12, 23)).days / 365.2425) / {quoteSettlement_price}

        # Maximum short squeeze ratio
        maximum_short_squeeze_ratio: 110.0

        # maintenance collateral ratio (percentage)
        maintenance_collateral_ratio: 200.0

        # Core exchange factor for paying transaction fees in
        # non-BTS assets. Premium of 5%
        core_exchange_factor: 1.05

:~$ bitshares-pricefeed --configfile=/home/ihashfury/bts/pricefeeds/hero.yaml update HERO
after entering my passphrase I get tis error:

Traceback (most recent call last):
  File "/home/ihashfury/.local/bin/bitshares-pricefeed", line 11, in <module>
    sys.exit(main())
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/ui.py", line 80, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/ui.py", line 57, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/ui.py", line 72, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/cli.py", line 80, in update
    feed.derive(assets)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/pricefeed.py", line 387, in derive
    self.obtain_price_change(symbol)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/pricefeed.py", line 67, in obtain_price_change
    current_feed = self.get_my_current_feed(asset)
  File "/home/ihashfury/.local/lib/python3.5/site-packages/bitshares_pricefeed/pricefeed.py", line 55, in get_my_current_feed
    if feed["witness"].witness == self.producer["id"]:
KeyError: 'witness'
xeroc commented

fixed this in the latest release