Author Topic: Dry Run 14 - The Next Generation ($200 BitUSD bounty)  (Read 21434 times)

0 Members and 1 Guest are viewing this topic.

Offline HackFisher

  • Hero Member
  • *****
  • Posts: 883
    • View Profile
MARKET issued "Immoral soul"...

Code: [Select]
>>> blockchain_list_assets
...
25    SOUL   Immortal soul           1 Immoral soul                                  MARKET                          N/A       0.000 SOUL                 

Can you sell your soul to me?
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
help wallet_market_cover

And this will use my available bitUSD, not buy new ones from the market @ current price???

Surprise!  You can't use your collateral to buy USD to cover. (This extra XTS you need to buy back USD is a "hidden" implicit extra collateral requirement).
It adds a surprising amount of complexity to be able to cover using your collateral. BM is about to implement a solution where you can increase your own call price so you can have your margin called without a 5% fee if the original cover price would not have resulted in a margin call.
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 vikram

I'm trying to figure out what happened here.
This is the market:
Code: [Select]
default (unlocked) >>> blockchain_market_order_book USD XTS
                  BIDS (* Short Order)                                       |                                   ASKS                                 
TOTAL                     QUANTITY                                     PRICE | PRICE                                        QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
103.6513 USD                                                    MARKET PRICE | 0.011111110000 USD                    1,000.00000 XTS               11.1111 USD
99.9999 USD               9,000.00900 XTS                 0.011111100000 USD*| 0.011111111111 USD                      100.00000 XTS                1.1111 USD
219.4796 USD              24,142.76556 XTS                0.009090909091 USD*| 0.011111111200 USD                    1,000.00000 XTS               11.1111 USD
100.0000 USD              12,000.00000 XTS                0.008333333333 USD | 0.011200000000 USD                    1,000.00000 XTS               11.1999 USD
19.9999 USD               2,469.13580 XTS                 0.008100000000 USD*| 0.014000000000 USD               10,000,000.00000 XTS          140,000.0000 USD
99,889.0002 USD           14,269,857.17144 XTS            0.007000000000 USD*| 0.014000000000 USD                   10,000.00000 XTS              140.0000 USD
19.9999 USD               3,921.56862 XTS                 0.005100000000 USD*| 1.111111111111 USD                        0.90000 XTS                1.0000 USD
1.0000 USD                1,000.00000 XTS                 0.001000000000 USD |
19.9999 USD               39,215.68627 XTS                0.000510000000 USD*|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                             |                                   MARGIN                                 
                                                                             | CALL PRICE                                   QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                             | 0.008333333333 USD                      135.00000 XTS                0.9999 USD   180.00000 XTS
                                                                             | 0.008250000000 USD                       13.63635 XTS                0.0999 USD   18.18180 XTS
                                                                             | 0.008250000000 USD                  136,363.63635 XTS              999.9998 USD   181,818.18180 XTS
                                                                             | 0.008250000000 USD                       13.63635 XTS                0.0999 USD   18.18180 XTS
                                                                             | 0.008241758242 USD                    2,729.99998 XTS               19.9999 USD   3,639.99998 XTS
                                                                             | 0.008241758242 USD                    1,364.99998 XTS                9.9999 USD   1,819.99998 XTS
                                                                             | 0.007500000000 USD                   30,000.00000 XTS              200.0000 USD   40,000.00000 XTS
                                                                             | 0.006862500000 USD                       32.78688 XTS                0.1999 USD   43.71584 XTS
                                                                             | 0.006825000000 USD                    7,582.41757 XTS               45.9999 USD   10,109.89010 XTS
                                                                             | 0.006818181818 USD                  128,785.85166 XTS              780.5201 USD   171,714.46888 XTS
                                                                             | 0.006750000000 USD                   16,666.66665 XTS               99.9999 USD   22,222.22221 XTS
                                                                             | 0.005250000000 USD                   23,785.67140 XTS              110.9998 USD   31,714.22854 XTS

Median Feed Price: 0.008109332 USD / XTS     Maximum Short Price: 0.01081244266666666 USD / XTS     Minimum Cover Price: 0.00540622133333333 USD / XTS
Bid Depth: 14,348,606.33669 XTS     Ask Depth: 10,464,665.75455 XTS     Min Depth: 2,000,000.00000 XTS

This is what is in the account:
Code: [Select]
default (unlocked) >>> wallet_account_balance
ACCOUNT                         BALANCE                     
============================================================
maqifrnswa                      480.0000 USD               
                                6,705.62173 XTS

I make this order:
Code: [Select]
default (unlocked) >>> wallet_market_submit_bid maqifrnswa 480 XTS 1 USD
{
  "expiration": "20140814T143920",
  "delegate_slate_id": null,
  "operations": [{
      "type": "withdraw_op_type",
      "data": {
        "balance_id": "XTSHzdmQMZfxAUqEBsSNKmaU8NwYFbTX5Qce",
        "amount": 4800000,
        "claim_input_data": ""
      }
    },{
      "type": "withdraw_op_type",
      "data": {
        "balance_id": "XTSAwtaSJ44fTUkm8kHjqFu3jbPzNzZKP9Ey",
        "amount": 10000,
        "claim_input_data": ""
      }
    },{
      "type": "bid_op_type",
      "data": {
        "amount": 4800000,
        "bid_index": {
          "order_price": {
            "ratio": "0.100000000000000005",
            "quote_asset_id": 22,
            "base_asset_id": 0
          },
          "owner": "XTSJUzKXsQrVqPeL21C3uMSaT6AGqSefNGnK"
        }
      }
    }
  ],
  "signatures": [
    "1f8226eda47c43167b07f5a521f5baa178b588212bcdb9021b6c8f3f159fe39ec5e4bbf6a5e090bf1ef82281c456a9da1d16de9063360149b5003deb7c7178a501",
    "20d4d88a7afe9ca1cffb191873a001884d39b30884545aebd07286d29e782f96da2815b77fc387f76b3ab0e638d53010d3e435d746750429df8ad2c2ed2224d409",
    "1f37854f51cf473781e090f907d4adf0b1db5e15a927050098bcd6cea89a05aa9314a2c21ac66a0f4c07e7311d80536a64b689e917de539b007e32a507ba2eb616"
  ]
}

I expect to buy:
11.1111 USD at 0.01111111 USD/XTS = 1000 XTS
1.1111 USD at 0.011111111111 USD/XTS = 100 XTS
11.1111 USD @ 0.011111111200 = 1000 XTS
11.1999 USD @0.011200000000 = 1000 XTS
445.4668 USD @0.014000000000 = 31819.05 XTS

total should have been bought: 34919.05 XTS

Here's the account and market after the purchase:
Code: [Select]
default (unlocked) >>> wallet_account_balance
ACCOUNT                         BALANCE                     
============================================================
maqifrnswa                      7,185.52172 XTS 

Code: [Select]
default (unlocked) >>> blockchain_market_order_book USD XTS
                  BIDS (* Short Order)                                       |                                   ASKS                                 
TOTAL                     QUANTITY                                     PRICE | PRICE                                        QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
99.9999 USD               9,000.00900 XTS                 0.011111100000 USD*| 0.014000000000 USD                9,960,777.27858 XTS          139,450.8819 USD
219.4796 USD              24,142.76556 XTS                0.009090909091 USD*| 0.014000000000 USD                   10,000.00000 XTS              140.0000 USD
100.0000 USD              12,000.00000 XTS                0.008333333333 USD | 1.111111111111 USD                        0.90000 XTS                1.0000 USD
19.9999 USD               2,469.13580 XTS                 0.008100000000 USD*|
99,889.0002 USD           14,269,857.17144 XTS            0.007000000000 USD*|
19.9999 USD               3,921.56862 XTS                 0.005100000000 USD*|
1.0000 USD                1,000.00000 XTS                 0.001000000000 USD |
19.9999 USD               39,215.68627 XTS                0.000510000000 USD*|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                             |                                   MARGIN                                 
                                                                             | CALL PRICE                                   QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                             | 0.008333333333 USD                      135.00000 XTS                0.9999 USD   180.00000 XTS
                                                                             | 0.008250000000 USD                       13.63635 XTS                0.0999 USD   18.18180 XTS
                                                                             | 0.008250000000 USD                  136,363.63635 XTS              999.9998 USD   181,818.18180 XTS
                                                                             | 0.008250000000 USD                       13.63635 XTS                0.0999 USD   18.18180 XTS
                                                                             | 0.008241758242 USD                    2,729.99998 XTS               19.9999 USD   3,639.99998 XTS
                                                                             | 0.008241758242 USD                    1,364.99998 XTS                9.9999 USD   1,819.99998 XTS
                                                                             | 0.007500000000 USD                   30,000.00000 XTS              200.0000 USD   40,000.00000 XTS
                                                                             | 0.006862500000 USD                       32.78688 XTS                0.1999 USD   43.71584 XTS
                                                                             | 0.006825000000 USD                    7,582.41757 XTS               45.9999 USD   10,109.89010 XTS
                                                                             | 0.006818181818 USD                  128,785.85166 XTS              780.5201 USD   171,714.46888 XTS
                                                                             | 0.006750000000 USD                   16,666.66665 XTS               99.9999 USD   22,222.22221 XTS
                                                                             | 0.005250000000 USD                   23,785.67140 XTS              110.9998 USD   31,714.22854 XTS

Median Feed Price: 0.008109332 USD / XTS     Maximum Short Price: 0.01081244266666666 USD / XTS     Minimum Cover Price: 0.00540622133333333 USD / XTS
Bid Depth: 14,348,606.33669 XTS     Ask Depth: 10,422,343.04211 XTS     Min Depth: 2,000,000.00000 XTS

So it looks like the market executed ok, but 27,733.52828 XTS seems to be missing from the account.

EDIT: here's the transaction history
Code: [Select]
[default (unlocked) >>> wallet_account_transaction_history
 RECEIVED            BLOCK     FROM                TO                  AMOUNT                  MEMO                                        FEE                 ID     
========================================================================================================================================================================
|2014-08-13T01:00:00 0         GENESIS             maqifrnswa          60,525.43383 XTS        claim Ppf3WEcqakR7CarJWYQ41D5H7UWZKTz5vd    0.00000 XTS         [5afce1]|
|                              GENESIS             maqifrnswa          247.73200 XTS           claim Pn5cHQPYxzJAso16hpvCCSjj7HEnuccJbs                                |
|                              GENESIS             maqifrnswa          5,958.39818 XTS         claim 1DXCqXn8M7VJ7c1K5H5qhMSkZKkpSesQ8o                                |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2014-08-14T03:41:44 2307      maqifrnswa          maqifrnswa          0.00000 XTS             register maqifrnswa as a delegate           25.84228 XTS        34901ef8
 2014-08-14T03:45:10 2328      maqifrnswa          ASK-DdPHJoDQ        60,000.00000 XTS        sell XTS @ 0.008 USD / XTS                  0.10000 XTS         df867f39
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|2014-08-14T03:45:30 2329      ASK-DdPHJoDQ        MARKET              60,000.00000 XTS        fill ask @ 0.008 USD / XTS                  0.00000 XTS         [185799]|
|                              ASK-DdPHJoDQ        maqifrnswa          480.0000 USD            ask proceeds @ 0.008 USD / XTS                                          |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 2014-08-14T12:39:20 5533      maqifrnswa          BID-JUzKXsQr        480.0000 USD            buy XTS @ 1.00000000000000005 USD / XTS     0.10000 XTS         d48358a5
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|2014-08-14T12:39:40 5534      BID-JUzKXsQr        MARKET              480.0000 USD            pay bid @ 1.00000000000000005 USD / XTS     0.00000 XTS         [f3100d]|
|                              BID-JUzKXsQr        maqifrnswa          479.99999 XTS           bid proceeds @ 1.00000000000000005 USD /...                             |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/code]

This behaviour is correct: http://wiki.bitshares.org/index.php/Bitshares_X#Order_Matching_Algorithm

The only potential concern might be that you received 479.99999 XTS instead of 480 XTS.
« Last Edit: August 14, 2014, 05:24:11 pm by vikram »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc

Offline btsfans

  • Full Member
  • ***
  • Posts: 114
    • View Profile


Code: [Select]
bitshare@ubuntu:~/bitshares_toolkit$ cmake .
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bitshare/bitshares_toolkit/CMakeFiles/CMakeOutput.log".
bitshare@ubuntu:~/bitshares_toolkit$


how to resolve? ths

Have you installed the required dependencies?: https://github.com/BitShares/bitshares_toolkit/blob/2830b630dd78e1e45be2babaecca3f93ddd40ea4/BUILD_UBUNTU.md
No。how to?


In the link above you can copy those commands to a shell session verbatim. What he's talking about specifically are these:


sudo apt-get update
sudo apt-get install cmake git libreadline-dev uuid-dev g++ libdb++-dev libdb-dev zip libssl-dev openssl build-essential python-dev autotools-dev libicu-dev libbz2-dev libboost-dev libboost-all-dev zlib1g-dev
thx
拷问3i !

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
Code: [Select]
out_of_range_exception: Out of Range
read datastream of length 24 over by -23
    {"method":"read","len":24,"over":-23}
    th_a  datastream.cpp:6 throw_datastream_range_error
fc::array<type,length>
    {"type":"char","length":33}

Can you give me more detail than that.... I need the full stack trace.

To tell you the truth I do not know what 'full stack trace' is. Below is the error I got in the cli, if this 'stack trace' is in in some other file, tell which one and I will try to provide the info in it.

Code: [Select]
w1 (unlocked) >>> wallet_add_contact_account sh1  XTSNYE8ghUaryYH1muKrPvmFTsSPZ6UyRBMQ
8 out_of_range_exception: Out of Range
read datastream of length 24 over by -23
    {"method":"read","len":24,"over":-23}
    th_a  datastream.cpp:6 throw_datastream_range_error
fc::array<type,length>
    {"type":"char","length":33}
    th_a  raw.hpp:122 unpack
Error unpacking field data
    {"field":"data"}
    th_a  raw.hpp:237 operator()
error unpacking bts::blockchain::public_key_type::binary_key
    {"type":"bts::blockchain::public_key_type::binary_key"}
    th_a  raw.hpp:455 unpack
error unpacking bts::blockchain::public_key_type::binary_key
    {"type":"bts::blockchain::public_key_type::binary_key"}
    th_a  raw.hpp:487 unpack

    {"command":"wallet_add_contact_account"}
    th_a  cli.cpp:471 execute_command
w1 (unlocked) >>>

Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline Riverhead


Code: [Select]
bitshare@ubuntu:~/bitshares_toolkit$ cmake .
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bitshare/bitshares_toolkit/CMakeFiles/CMakeOutput.log".
bitshare@ubuntu:~/bitshares_toolkit$


how to resolve? ths

Have you installed the required dependencies?: https://github.com/BitShares/bitshares_toolkit/blob/2830b630dd78e1e45be2babaecca3f93ddd40ea4/BUILD_UBUNTU.md
No。how to?


In the link above you can copy those commands to a shell session verbatim. What he's talking about specifically are these:


sudo apt-get update
sudo apt-get install cmake git libreadline-dev uuid-dev g++ libdb++-dev libdb-dev zip libssl-dev openssl build-essential python-dev autotools-dev libicu-dev libbz2-dev libboost-dev libboost-all-dev zlib1g-dev

Offline btsfans

  • Full Member
  • ***
  • Posts: 114
    • View Profile

Code: [Select]
bitshare@ubuntu:~/bitshares_toolkit$ cmake .
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bitshare/bitshares_toolkit/CMakeFiles/CMakeOutput.log".
bitshare@ubuntu:~/bitshares_toolkit$


how to resolve? ths

Have you installed the required dependencies?: https://github.com/BitShares/bitshares_toolkit/blob/2830b630dd78e1e45be2babaecca3f93ddd40ea4/BUILD_UBUNTU.md
No。how to?
拷问3i !

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
help wallet_market_cover

And this will use my available bitUSD, not buy new ones from the market @ current price???
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline vikram

Code: [Select]
bitshare@ubuntu:~/bitshares_toolkit$ cmake .
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bitshare/bitshares_toolkit/CMakeFiles/CMakeOutput.log".
bitshare@ubuntu:~/bitshares_toolkit$


how to resolve? ths

Have you installed the required dependencies?: https://github.com/BitShares/bitshares_toolkit/blob/2830b630dd78e1e45be2babaecca3f93ddd40ea4/BUILD_UBUNTU.md

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Ah .. theres another call method .. learn sth. new every dry run ;)

Offline bytemaster

Code: [Select]
out_of_range_exception: Out of Range
read datastream of length 24 over by -23
    {"method":"read","len":24,"over":-23}
    th_a  datastream.cpp:6 throw_datastream_range_error
fc::array<type,length>
    {"type":"char","length":33}

Can you give me more detail than that.... I need the full stack trace.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
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 tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
You can't cancel a cover order! (margin call auto cover)

The error should probably say something more helpful.

And the answer to the original question is? (Q below)


To cover a short position, you must first BUY USD on the market and then send it to your short position to free the collateral.


I already have the USD.(in the same account,btw). How do I send them to the short position?
Tried sending the them account A to account A - did not close the short.
Tried adding the short as contact account - got an error....

Code: [Select]
out_of_range_exception: Out of Range
read datastream of length 24 over by -23
    {"method":"read","len":24,"over":-23}
    th_a  datastream.cpp:6 throw_datastream_range_error
fc::array<type,length>
    {"type":"char","length":33}
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
You can't cancel a cover order! (margin call auto cover)

The error should probably say something more helpful.
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.