Author

Topic: goxsh — command-line frontend to Mt. Gox (Read 5075 times)

newbie
Activity: 31
Merit: 0
August 16, 2011, 04:18:16 PM
#18
Can someone explain what the "profit" command does? I looked it up on the help page but it's not very descriptive.
The profit command calculates from which rate a buy/sell is profitable when bought/sold at a specified rate considering the current commission fee of Mt. Gox. E.g. if you sold 1 BTC at $10.00 you will start making profit (ending up with more BTC) when rebuying at < $9.94008. If you bought 1 BTC at $10.00 you will start making profit (ending up with more $ in your account) when selling at > $10.06028. If you rebuy > $9.94008 or sell < $10.06028 fees will be greater than what you actually gain in the actual trade and you end up with a loss.

When I withdraw I get this:

Code:
infested999$ withdraw xxxxxxxxxxxxxxxx x.xxxxxxxx
Funds are on their way (bitcoin transaction: edcf5d09cebc54cb87f9b30776dc48201ca19005db56dae6fca2f94f23b8510d)
Updated balance:
Traceback (most recent call last):
  File "goxsh.py", line 211, in prompt
    proc(*args)
  File "goxsh.py", line 429, in __cmd_withdraw__
    self.__print_balance(withdraw_info)
  File "goxsh.py", line 312, in __print_balance
    print u"BTC:", balance[u"btcs"]
KeyError: u'btcs'
BTC: infested999$

It still withdraws the money just fine, but it scared me a bit and I thought my BTC were all gone for a second. You should suppress that error!
This is a known bug with the last release of ahihi. Doesn't affect the withdraw–it just fails to print the new balance after the withdrawal. Fixed since 0.20.
full member
Activity: 146
Merit: 100
When I withdraw I get this:

Code:
infested999$ withdraw xxxxxxxxxxxxxxxx x.xxxxxxxx
Funds are on their way (bitcoin transaction: edcf5d09cebc54cb87f9b30776dc48201ca19005db56dae6fca2f94f23b8510d)
Updated balance:
Traceback (most recent call last):
  File "goxsh.py", line 211, in prompt
    proc(*args)
  File "goxsh.py", line 429, in __cmd_withdraw__
    self.__print_balance(withdraw_info)
  File "goxsh.py", line 312, in __print_balance
    print u"BTC:", balance[u"btcs"]
KeyError: u'btcs'
BTC: infested999$

It still withdraws the money just fine, but it scared me a bit and I thought my BTC were all gone for a second. You should suppress that error!

 for your information, the most advanced and supported goxsh is now the Optonic fork :

https://github.com/Optonic/goxsh
https://github.com/Optonic/goxsh/network
http://www.goxsh.info/
and channel #goxsh on freenode IRC server
hero member
Activity: 854
Merit: 500
When I withdraw I get this:

Code:
infested999$ withdraw xxxxxxxxxxxxxxxx x.xxxxxxxx
Funds are on their way (bitcoin transaction: edcf5d09cebc54cb87f9b30776dc48201ca19005db56dae6fca2f94f23b8510d)
Updated balance:
Traceback (most recent call last):
  File "goxsh.py", line 211, in prompt
    proc(*args)
  File "goxsh.py", line 429, in __cmd_withdraw__
    self.__print_balance(withdraw_info)
  File "goxsh.py", line 312, in __print_balance
    print u"BTC:", balance[u"btcs"]
KeyError: u'btcs'
BTC: infested999$

It still withdraws the money just fine, but it scared me a bit and I thought my BTC were all gone for a second. You should suppress that error!
sr. member
Activity: 354
Merit: 250
awesome
hero member
Activity: 854
Merit: 500
Can someone explain what the "profit" command does? I looked it up on the help page but it's not very descriptive.
newbie
Activity: 31
Merit: 0
goxsh 0.21 released. See New goxsh fork#msg446216.
newbie
Activity: 31
Merit: 0
Talking of feature requests: Just added FeatureRequests to the goxsh wiki. To edit the wiki a github account is required. If you are not a registered user at github and don't want to register you may of course continue to request features within this thread (or at the thread over at the "Newbies" section: New goxsh fork) and I will update FeatureRequests for you.
newbie
Activity: 31
Merit: 0
A fellow pool member has made a nice fork of goxsh, you can see his thread here http://forum.bitcoin.org/index.php?topic=33017.0

Thank you for promoting my fork/thread, Ssoele!

All of you are welcome to discuss this fork or ask for features over at the the thread in the "Newbies" section or within this thread.
full member
Activity: 134
Merit: 100
There's no place like 127.0.0.1
A fellow pool member has made a nice fork of goxsh, you can see his thread here http://forum.bitcoin.org/index.php?topic=33017.0
legendary
Activity: 1974
Merit: 1029
I use a quickie shell that I wrote in a couple of minutes in Perl. Yours is more advanced than mine but it doesn't seem to have a feature I have coded in mine:

> buy 500$ 17.50
> buy 15% 17.50

ie. "Buy as many bitcoins as needed with 500 USD", "buy as many bitcoins as needed with 15% of my USDs". My python-fu doesn't reach a level high enough to make a patch, so I can only contribute my Perl (error checking removed to make the code clearer):

Code:
    given ($cmd) {
        when ('buy') {
            if ($args[0] =~ /^([0-9.]+)%$/) {
                my $pct = $1;
                my $b = $m->get_balance;   ## $m is an MtGox object
                $args[0] = sprintf '$%.3f', $b->{'usds'} * $pct / 100;
                ## don't continue, fall to the next if
            }
            if ($args[0] =~ /^\$([0-9.]+)$/ or $args[0] =~ /^([0-9.]+)\$$/) {
                my $usds = $1;
                my $t = $m->get_ticker;
                my $sell = $t->{'ticker'}{'sell'};

                $args[0] = $usds / $sell;
                ## don't continue, now the code proceeds to buy
            }
            $m->buy (amount => $args[0], price => $args[1]);

Hope it's useful!
legendary
Activity: 1102
Merit: 1014
Great development pace...if you keep it up everyone's going to want to trade via CLI.  Grin
newbie
Activity: 7
Merit: 0
Just pushed a new version that fixes the remove_history_item bug, adds support for sequencing multiple commands (blah1; blah2) and allows comments (# blah)!

----

Thanks, works for me now. This is a neat tool for trading, I particularly like the profit price command.

Sent a small donation along your way. Smiley

Thank you! Smiley
newbie
Activity: 7
Merit: 0
After entering a username:
Code:
Traceback (most recent call last):
  File "C:\Users\Monolith\gox.py", line 145, in prompt
    proc(*args)
  File "C:\Users\Monolith\gox.py", line 302, in __cmd_login__
    readline.remove_history_item(readline.get_current_history_length() - 1)
AttributeError: 'module' object has no attribute 'remove_history_item'
Am I doing something wrong?

Hmm, it looks like the readline module on your system doesn't support history item removal, which I use to delete the lone username line from the command history. I'm currently working on some changes to command parsing, but as soon as that's done I'll put in a check for this and push it to github. Thanks for the report! Smiley

For the time being, you should be able to work around this by giving the username directly to the login command ($ login your_username_here).
N12
donator
Activity: 1610
Merit: 1010
After entering a username:
Code:
Traceback (most recent call last):
  File "C:\Users\Monolith\gox.py", line 145, in prompt
    proc(*args)
  File "C:\Users\Monolith\gox.py", line 302, in __cmd_login__
    readline.remove_history_item(readline.get_current_history_length() - 1)
AttributeError: 'module' object has no attribute 'remove_history_item'
Am I doing something wrong?
newbie
Activity: 7
Merit: 0
Nice job on the use of Decimal. I just extended mtgox-trader to work with exchb.com so this might be cool to extend that way as well.

I've been thinking of supporting other exchanges than Mt. Gox, but I haven't decided on a nice way to switch between them. And it's a low-priority task since I don't really use any others on a regular basis myself. Tongue
legendary
Activity: 1102
Merit: 1014
Nice job on the use of Decimal. I just extended mtgox-trader to work with exchb.com so this might be cool to extend that way as well.
newbie
Activity: 27
Merit: 0
Looks pretty sweet. Thanks for sharing!
newbie
Activity: 7
Merit: 0
goxsh is a "Mt. Gox shell" that I've been writing mainly for personal use, but I'm posting it here in the hopes that it could be useful to others too. Smiley

https://i.imgur.com/jJPjL.png

Features

  • Buy and sell bitcoins
  • Specify buy/sell amounts in BTC or USD
  • List and cancel orders
  • Withdraw bitcoins
  • Interactive authentication with no-echo password prompt — no need to store your credentials on disk
  • Display account balance
  • Display ticker
  • Calculate profitable short/long prices from an initial price
  • Tab completion of commands
  • Sequence multiple commands using semicolons
  • Abort commands with SIGINT (ctrl-c on *nix) without exiting, if Mt. Gox is being slow
  • Insert comments (# blah) e.g. for quick notes

Requirements

Python 2.6 or a newer 2.* release.

Usage

Run the script in a terminal window and type "help" to see the list of available commands.

License

Public domain. Smiley

----

Bug reports and ideas are welcome, but I can't promise anything!
Jump to: