Author Topic: market.buy and sell exception  (Read 1509 times)

0 Members and 1 Guest are viewing this topic.

Offline zapata42

  • Full Member
  • ***
  • Posts: 62
    • View Profile
  • BitShares: zapata42
Did you unlock the wallet first with something like:

Code: [Select]
bitshares.wallet.unlock("<supersecret>")
or using the UNLOCK environment variable?

Offline komodo_island

  • Newbie
  • *
  • Posts: 2
    • View Profile
Do anyone know why this exception occurs:

In [102]: print(market.sell(1,1.5))
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-102-c82c5bda37e6> in <module>()
----> 1 print(market.sell(1,1.5))

/usr/local/lib/python3.6/site-packages/bitshares/market.py in sell(self, price, amount, expiration, killfill, account, returnOrderId)
    530             self.bitshares.blocking = returnOrderId
    531
--> 532         tx = self.bitshares.finalizeOp(order, account["name"], "active")
    533
    534         if returnOrderId:

/usr/local/lib/python3.6/site-packages/bitshares/bitshares.py in finalizeOp(self, ops, account, permission)
    200         else:
    201             # default behavior: sign + broadcast
--> 202             self.txbuffer.appendSigner(account, permission)
    203             self.txbuffer.sign()
    204             return self.txbuffer.broadcast()

/usr/local/lib/python3.6/site-packages/bitshares/transactionbuilder.py in appendSigner(self, account, permission)
     71                 account = Account(account, bitshares_instance=self.bitshares)
     72                 required_treshold = account[permission]["weight_threshold"]
---> 73                 keys = fetchkeys(account, permission)
     74                 if permission != "owner":
     75                     keys.extend(fetchkeys(account, "owner"))

/usr/local/lib/python3.6/site-packages/bitshares/transactionbuilder.py in fetchkeys(account, perm, level)
     46             r = []
     47             for authority in account[perm]["key_auths"]:
---> 48                 wif = self.bitshares.wallet.getPrivateKeyForPublicKey(authority[0])
     49                 if wif:
     50                     r.append([wif, authority[1]])

/usr/local/lib/python3.6/site-packages/bitshares/wallet.py in getPrivateKeyForPublicKey(self, pub)
    220                 raise NoWalletException
    221
--> 222             return self.decrypt_wif(self.keyStorage.getPrivateKeyForPublicKey(pub))
    223
    224     def removePrivateKeyFromPublicKey(self, pub):

/usr/local/lib/python3.6/site-packages/bitshares/wallet.py in decrypt_wif(self, encwif)
    182         except:
    183             pass
--> 184         assert not self.locked()
    185         return format(bip38.decrypt(encwif, self.masterpassword), "wif")

I use uptick to buy/sell with no problem but when using the pybitshares module this occurs ..