Skip to content

All sell and buy orders fail after one fails if no new bitshares instance is created #86

@TuJuXorX

Description

@TuJuXorX

I'm trying to trade two CryptoBridge coins using the following code:

from bitshares import BitShares
from bitshares.market import Market

symbol1 = 'BRIDGE.ALQO'
symbol2 = 'BRIDGE.ROE'

account_name = 'xxxxxxxx'
password = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 

bitshares = BitShares()

try:
    market1 = Market(symbol1 + ':BRIDGE.BTC', bitshares_instance=bitshares)
    market1.bitshares.wallet.unlock(password)
    market1.sell(price=0.00003302, amount=10, account=account_name)
except:
    print('This fails.')

market2 = Market(symbol2 + ':BRIDGE.BTC', bitshares_instance=bitshares)
market2.bitshares.wallet.unlock(password)
market2.sell(price=0.00001685, amount=10, account=account_name)

Trading of BRIDGE.ALQO is currently disable, so Python returns an error (as it should) without try-except:

/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/graphenebase/ecdsa.py:187: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.
Traceback (most recent call last):
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitsharesapi/bitsharesnoderpc.py", line 54, in rpcexec
  File "/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/grapheneapi/graphenewsrpc.py", line 173, in rpcexec
grapheneapi.exceptions.RPCError: Assert Exception: _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end(): 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test3.py", line 18, in <module>
    market1.sell(price=0.00003302, amount=100, account=account_name)
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/market.py", line 513, in sell
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/bitshares.py", line 293, in finalizeOp
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/transactionbuilder.py", line 388, in broadcast
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/transactionbuilder.py", line 386, in broadcast
  File "/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/grapheneapi/graphenewsrpc.py", line 213, in method
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitsharesapi/bitsharesnoderpc.py", line 64, in rpcexec
bitsharesapi.exceptions.UnhandledRPCError: Assert Exception: _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end():

WITH the try-except I would have except the latter sell order to go through. However, it instead seems to produce the same errors:

/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/graphenebase/ecdsa.py:187: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.
This fails.
Traceback (most recent call last):
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitsharesapi/bitsharesnoderpc.py", line 54, in rpcexec
  File "/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/grapheneapi/graphenewsrpc.py", line 173, in rpcexec
grapheneapi.exceptions.RPCError: Assert Exception: _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end(): 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test3.py", line 24, in <module>
    market2.sell(price=0.00001685, amount=100, account=account_name)
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/market.py", line 513, in sell
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/bitshares.py", line 293, in finalizeOp
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/transactionbuilder.py", line 388, in broadcast
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitshares/transactionbuilder.py", line 386, in broadcast
  File "/root/.local/lib/python3.5/site-packages/graphenelib-0.6.1-py3.5.egg/grapheneapi/graphenewsrpc.py", line 213, in method
  File "/root/.local/lib/python3.5/site-packages/bitshares-0.1.13-py3.5.egg/bitsharesapi/bitsharesnoderpc.py", line 64, in rpcexec
bitsharesapi.exceptions.UnhandledRPCError: Assert Exception: _sell_asset->options.whitelist_markets.find(_receive_asset->id) != _sell_asset->options.whitelist_markets.end():

If I remove the first order or make add bitshares = BitShares() above the second order, the second order goes through. Maybe this is an issue with pybitshares or something else?

UPDATE:

If there is market1.bitshares.clear() before the second sell order, then the second sell order goes through. Using bitshares = BitShares(nobroadcast=True) also removes the crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions