in #3 years ago

Congratulations @buynano! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 10 upvotes.
Your next target is to reach 50 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from February day 5
Hive Power Up Month challenge - Feedback from February day 3
Our Hive Power delegations to the last Power Up Month challenge Winners
Support the HiveBuzz project. Vote for our proposal!
Sort:  

What is this?
key = try_load_key("active.key", "owner.key")
Do you need both keys?

Hi, you only need one key. Use active.key.

Ok, I tried
key = try_load_key("active.key")

and this
bids = [
{ "card_detail_id": 439, "amount": 2, "bid_usd": "6.00", "edition": 7 }
]
and this change
def get_sale_by_card(id, edition, gold=True):

Is generating this output which is not what I was expecting.
Buying 439 at $1500, 455746.9692826542645971893066 DEC

Sorry about that - I've updated the script to support gold cards and fix this bug you encountered. Just include "gold": True in the bid after updating.

e.g.
{ "card_detail_id": 439, "amount": 2, "bid_usd": "6.00", "edition": 7, "gold": True }

Edit: code

Sorry I am python noob and not very good at debugging it. I updated to the latest version but I get the following error while trying a dry run (nice option). I suspect card_detail_id and edition are both integers while gold is a string this is a problem. Also I had to tweak the bid json to "gold":"True" (quotes around True)

Traceback (most recent call last):
File "/home/ubuntu/splinterlands/beem/NFTCardShop.py", line 93, in
if(not buy_first(bids, args.owner, args.dry)):
File "/home/ubuntu/splinterlands/beem/NFTCardShop.py", line 77, in buy_first
for sale in get_sorted_sales(bid["card_detail_id"], bid["edition"], bid["gold"]):
TypeError: string indices must be integers

ps - doominion-spy ran out of RC and couldnt post so I had to switch accounts

Hmm. Well "gold" should be just the symbol true, not the string "True".

Could it be that your bids.json is not an array? Happy to help debug it if it's something else too.

bids.json

[
{ "card_detail_id": 439, "amount": 2, "bid_usd": "6.00", "edition": 7, "gold": True }
]

Edit: code

with "gold":True I get errors in json.loads
with "gold":true or "gold":"True" I get the set_sorted_sales error I mentioned previously.

Where did you get that message?