ahihi (OP)
Newbie
Offline
Activity: 7
Merit: 0
|
|
June 17, 2011, 11:01:55 AM Last edit: June 19, 2011, 08:14:06 AM by ahihi |
|
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. https://i.imgur.com/jJPjL.pngFeatures- 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
RequirementsPython 2.6 or a newer 2.* release. UsageRun the script in a terminal window and type "help" to see the list of available commands. LicensePublic domain. ---- Bug reports and ideas are welcome, but I can't promise anything!
|
|
|
|
nakedman
Newbie
Offline
Activity: 27
Merit: 0
|
|
June 17, 2011, 11:20:59 AM |
|
Looks pretty sweet. Thanks for sharing!
|
|
|
|
weex
Legendary
Offline
Activity: 1102
Merit: 1014
|
|
June 18, 2011, 10:48:44 PM |
|
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.
|
|
|
|
ahihi (OP)
Newbie
Offline
Activity: 7
Merit: 0
|
|
June 19, 2011, 05:59:22 AM |
|
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.
|
|
|
|
N12
Donator
Legendary
Offline
Activity: 1610
Merit: 1010
|
|
June 19, 2011, 06:54:05 AM |
|
After entering a username: 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?
|
|
|
|
ahihi (OP)
Newbie
Offline
Activity: 7
Merit: 0
|
|
June 19, 2011, 07:02:47 AM |
|
After entering a username: 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! 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).
|
|
|
|
ahihi (OP)
Newbie
Offline
Activity: 7
Merit: 0
|
|
June 19, 2011, 08:19:13 AM |
|
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. Thank you!
|
|
|
|
weex
Legendary
Offline
Activity: 1102
Merit: 1014
|
|
June 19, 2011, 10:13:27 AM |
|
Great development pace...if you keep it up everyone's going to want to trade via CLI.
|
|
|
|
dserrano5
Legendary
Offline
Activity: 1974
Merit: 1029
|
|
June 20, 2011, 06:21:50 PM |
|
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): 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!
|
|
|
|
|
Optonic
Newbie
Offline
Activity: 31
Merit: 0
|
|
July 30, 2011, 09:28:38 PM |
|
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.
|
|
|
|
Optonic
Newbie
Offline
Activity: 31
Merit: 0
|
|
July 31, 2011, 06:28:45 PM |
|
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.
|
|
|
|
|
infested999
|
|
August 16, 2011, 10:01:51 AM |
|
Can someone explain what the "profit" command does? I looked it up on the help page but it's not very descriptive.
|
|
|
|
holorga
|
|
August 16, 2011, 10:11:28 AM |
|
awesome
|
|
|
|
infested999
|
|
August 16, 2011, 10:35:12 AM |
|
When I withdraw I get this: 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!
|
|
|
|
neofutur
|
|
August 16, 2011, 07:28:08 PM |
|
When I withdraw I get this: 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/goxshhttps://github.com/Optonic/goxsh/networkhttp://www.goxsh.info/and channel #goxsh on freenode IRC server
|
|
|
|
Optonic
Newbie
Offline
Activity: 31
Merit: 0
|
|
August 16, 2011, 09:18:16 PM Last edit: August 18, 2011, 12:53:29 PM by Optonic |
|
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: 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.
|
|
|
|
|