Author Topic: How do I Trade from the Console?  (Read 1510 times)

0 Members and 1 Guest are viewing this topic.

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Speaking of "rounding issues" is there a technical reason why the Bitshares devs decided to go with 5 decimal places of precision and not 8 as is far more common with crypto-currency?

Yes. The "double" data type commonly used in many programming languages has 52 bits of precision. I. e. it can represent 2^52 different numbers with the same exponent. That's slightly more than 10^15, so it is precise on 15 decimals.

The numerical maximum number of bitshares supported by the client is 10 billion (there are other limits in place, so the actual maximum is lower than that), that's 10^10. With 5 decimal places that's also 10^15 different values. In other words, with more than 5 decimals a "double" would not have sufficient precision to represent every possible amount of BTS.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline kosh

  • Newbie
  • *
  • Posts: 8
    • View Profile
Thanks a lot PC.

Speaking of "rounding issues" is there a technical reason why the Bitshares devs decided to go with 5 decimal places of precision and not 8 as is far more common with crypto-currency?
"The avalanche has already started, it is too late for the pebbles to vote."

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
"blockchain_market_order_book <quote> <base>" shows the order book. The order of the currencies given is important - if you receive an "invalid market" message, try swapping the currency symbols. Example:

Code: [Select]
>>> blockchain_market_order_book USD BTS
     BIDS (* Short, + Relative, - Relative Limit)                            |                                   ASKS                                 
TOTAL                     QUANTITY                                     PRICE | PRICE                                        QUANTITY                     TOTAL   COLLATERAL
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
849.9251 USD              100,291.17310 BTS               0.008474576271 USD*| 0.008983918785 USD                        3.07216 BTS                0.0276 USD
463.3051 USD              54,670.00194 BTS                0.008474576271 USD*| 0.008984725966 USD                        2.30392 BTS                0.0207 USD
...
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                             SHORT WALL                                      |                                   MARGIN                                 
TOTAL                     QUANTITY                       INTEREST RATE (APR) | CALL PRICE                                   QUANTITY                     TOTAL   COLLATERAL    EXPIRES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                             | 0.004026912700 USD                   18,624.67120 BTS               99.9999 USD      5 days in the future   37,249.34241 BTS
...
Maximum Short Price: 0.00905770052507467 USD / BTS     

Note that the base and quote currencies are swapped as compared to the GUI. This also means the prices are inverted, and you have to think of buying/selling BTS for BitUSD.

In the above example, on the ASK side someone is trying to sell 3.07216 BTS at a price of 0.008983918785 USD/BTS for a total of 0.0276 USD (so actually he's trying to buy .0276 USD for 111.31 BTS/USD). On the BID side, someone is trying to buy 100,291 BTS at 0.008474576271 USD/BTS (so actually he's trying to sell 849.9251 USD at 118 BTS/USD). The asterisk on the BID side indicates that this is not a normal BID but a SHORT.

At the bottom, on the left side you can see the SHORT WALL (i. e. all shorts currently executing at the price feed), and on the right side an incomplete list of open cover orders with their margin price and expiration time. The last line contains the price feed.

So, if you want to buy some BitUSD from the short above you have to place an ASK order like this:

Code: [Select]
wallet_market_submit_ask <account_name> 291 BTS 0.008474576 USD
Similarly, to sell your BitUSD to the above ask you have to place a BID:

Code: [Select]
wallet_market_submit_bid <account_name> 3.07216 BTS 0.00898392 USD
Note that due to rounding issues it is a good idea to bid a slightly higher price and to ask a slightly lower price.

Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline Riverhead


Couple of tips:

1) The console has help docs: "help wallet_market_submit_ask" for example.
2) The console has tab completion. This is handy for finding commands. Type wallet_market_<tab><tab> to see all the commands starting with wallet_market_

The market is split into two main command sections:

blockchain_market_
wallet_market_

With tab completion and the help command you should be able to dig out everything you need.

Offline kosh

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hello,

I've been having a difficult time with the Bitshares GUI being unstable and buggy. I did manage to execute a single trade with the GUI, it crashed as the trade was being executed but it still went though--I was able to confirm this by viewing my balance via the console. The web wallet is stable, but trading appears to be disabled. As a result I've spent some time learning how to perform various actions on the console.

I don't mind using the console instead of the GUI. After consulting the documentation and I can't seem to figure out how to execute a trade. Would someone kindly help by providing common examples? I'd like to know how to trade BTS for various market assets and back again.

Thanks!
"The avalanche has already started, it is too late for the pebbles to vote."