Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Exception cancelling market orders  (Read 352 times)

0 Members and 1 Guest are viewing this topic.

Offline abit

Exception cancelling market orders
« on: January 07, 2015, 02:58:52 AM »

Yesterday I submitted some market orders via command line wallet under Windows 7, but unable to cancel them.
Error messages attached below.
The parameter for 'wallet_market_cancel_order' is gotten by a 'wallet_market_order_list' command (I replaced them with 'xxxxx' before post here)
Same error via HTTP-RPC call.
Any thought?
Code: [Select]
mywallet (unlocked) >>> wallet_market_cancel_order xxxxx
10 assert_exception: Assert Exception
account_key_record.valid() && account_key_record->has_private_key():
    {}
    th_a  transaction_builder.cpp:372 bts::wallet::transaction_builder::cancel_market_order

    {"order_id":"xxxxx"}
    th_a  transaction_builder.cpp:419 bts::wallet::transaction_builder::cancel_market_order

    {"order_ids":["xxxxx"]}
    th_a  wallet.cpp:3323 bts::wallet::wallet::cancel_market_orders

    {}
    th_a  common_api_client.cpp:5362 bts::rpc_stubs::common_api_client::wallet_market_cancel_order

    {"command":"wallet_market_cancel_order"}
    th_a  cli.cpp:579 bts::cli::detail::cli_impl::execute_command

Code: [Select]
"client_version": "v0.4.27.2"

EDIT:
There is only one account in this wallet, which is a sub-account, imported via import_priv_key.
« Last Edit: January 07, 2015, 04:01:28 AM by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline alt

Re: Exception cancelling market orders
« Reply #1 on: January 07, 2015, 05:41:45 AM »
here is the output from rpc call  wallet_market_order_list
you can find ID 48b08ef975ca3c5002e6de8ae3d034b90c427c44 belong to key BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY

Code: [Select]
client.request("wallet_market_order_list", ["CNY", "BTS", -1, "fund.btsbots"])

{'id': 0,
 'result': [['48b08ef975ca3c5002e6de8ae3d034b90c427c44',
             {'collateral': None,
              'expiration': None,
              'interest_rate': None,
              'market_index': {'order_price': {'base_asset_id': 0,
                                               'quote_asset_id': 14,
                                               'ratio': '0.0088223953371'},
                               'owner': 'BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY'},
              'state': {'balance': 6778292,
                        'last_update': '2015-01-07T05:34:20',
                        'limit_price': None},
              'type': 'bid_order'}],
            ['866f8b52df1bc5a21d54c506b630534a4b9810f1',
             {'collateral': None,
              'expiration': None,
              'interest_rate': None,
              'market_index': {'order_price': {'base_asset_id': 0,
                                               'quote_asset_id': 14,
                                               'ratio': '0.0093587379341'},
                               'owner': 'BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY'},
              'state': {'balance': 5528216422,
                        'last_update': '2015-01-07T05:34:20',
                        'limit_price': None},
              'type': 'ask_order'}]]}
run  this command to see if the key is in your wallet
Code: [Select]
wallet_dump_private_key BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY
if it's not, maybe you need to run this command to regenerate your key,
if it's not work change 200 to more, untill wallet_dump_private_key run success.
Code: [Select]
wallet_regenerate_keys youraccount  200

Offline abit

Re: Exception cancelling market orders
« Reply #2 on: January 07, 2015, 06:26:41 AM »
here is the output from rpc call  wallet_market_order_list
you can find ID 48b08ef975ca3c5002e6de8ae3d034b90c427c44 belong to key BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY

run  this command to see if the key is in your wallet
Code: [Select]
wallet_dump_private_key BTSEzmSPTwQys6AgdJFjLoTioVdLXMWujPzY
if it's not, maybe you need to run this command to regenerate your key,
if it's not work change 200 to more, untill wallet_dump_private_key run success.
Code: [Select]
wallet_regenerate_keys youraccount  200
Yes I have the private key(s), just unable to cancel the order(s).
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline abit

Re: Exception cancelling market orders
« Reply #3 on: January 07, 2015, 01:08:33 PM »
Let's replay..
1. open a wallet console (v0.4.27.1),
1.1 type a command 'wallet_account_create [sub.account]'
1.2 type command 'register [sub.account] [account]'
1.3 type 'wallet_dump_private_key [sub.account]', will get a private key
2. transfer some BTS and CNY to the new sub-account
3. on another computer, open a wallet console (v0.4.27.2),
3.1 type 'create_wallet [wallet_name]'
3.2 type 'wallet_import_private_key [the_private_key]'
3.3 type 'wallet_market_submit_bid aaa xxx bbb yyy', created a bid order
3.4 type 'wallet_market_order_list xxx yyy', can see the order created, with an order id
3.5 type 'wallet_market_cancel_order [order_id]', Exception raised.

It's interesting that the owner key and active key of that sub-account are different. Perhaps it makes sense?
The result of command 'wallet_dump_private_key [account_name]' is the private key of the active key, but not the owner key.
So I guess active key is needed for submit an order, but owner key is needed for cancelling an order? Will import the other key and make some tests.

UPDATE:
After imported the private key of owner key of the sub-account in the new client, I was able to cancel the market orders successfully.

So here comes a question: is it a new feature or a bug?
« Last Edit: January 07, 2015, 01:19:21 PM by abit »
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline toast

Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline alt

Re: Exception cancelling market orders
« Reply #5 on: January 08, 2015, 12:14:38 AM »
good debug
 +5%

Offline vikram

Re: Exception cancelling market orders
« Reply #6 on: January 08, 2015, 04:39:41 PM »
Fixed: https://github.com/BitShares/bitshares/issues/1213

abit thanks for the excellent instructions on how to reproduce.

 

Google+