toyotasupra (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
May 19, 2011, 06:18:59 PM |
|
Hello, i'd like to introduce a a very early version of command line trading tool for mtgox. It's very usable for me, so i guess that it will be usable for more bitcoin users... https://github.com/toyotasupra/ToyTraderPlease put feedback here, also please donate: 1N8b1uzWA7RsfVPmA2kdGSEmsv91zTRMAX Config: edit config.inc.php Usage: php -q mtgox.php Commands: ^M or <enter> - refresh stats, H<enter> - displays short help S amount price<enter> - sell amount of btc at price i.e. "s 10 7.01" makes mtgox order for selling 10 btc at 7.01$, you can also use "s all 7.09" for selling all available btc at 7.09 B amount price<enter> - buy amount of btc at price i.e. "b 5 6.5" makes mtgox order for buying 5 btc at 6.5$, you can also use "b all 6.66" for buying btc for all available $ at price 6.66 L<enter> - list all your active trade orders C oid type<enter> - cancels order with oid and type i.e. "c 272654 1" cancels sell order number 272654 T [num]<enter> - list last num trades on mtgox (default 10) Q<enter> - quit program
|
|
|
|
yomi
Newbie
Offline
Activity: 39
Merit: 0
|
|
May 19, 2011, 06:24:41 PM |
|
Great work! I am run it but got this: $ php -q mtgox.php ToyTrader v. 0.0.2 - command line mtgox trading tool DONATE for FASTER development: 1N8b1uzWA7RsfVPmA2kdGSEmsv91zTRMAX For help type: H and press enter
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /Users/edu/hacking/bitcoin/ToyTrader/mtgox.php on line 31 == 2011-05-19 20:22:49 ================================ USD: BTC: Last: 6.85 BUY OFFERS SELL OFFERS 6.81 23.45 6.85599 2 6.8 39.085 6.85699 2 6.76 10.919 6.85899 2 6.7502 29.5 6.872 2 6.75011 314.22 6.873 2 6.75 8 6.874 2 6.745 22.7 6.9415 37.57 6.72 1.2 6.945 100 6.7011 1 6.95 5 6.701 5 6.99 5.14
Fatal error: Call to undefined function readline() in /Users/edu/hacking/bitcoin/ToyTrader/mtgox.php on line 59 This is Mac OS X 10.6 Thanks!
|
|
|
|
toyotasupra (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
May 19, 2011, 08:49:53 PM |
|
i guess that I fixed it. Used fgets() instead of readline(). Please download new version Enjoy.
|
|
|
|
toffoo
|
|
May 21, 2011, 04:53:13 AM |
|
Congratulations on this very interesting little project, and thanks for sharing. I had one major problem/comment for you on this: The order depth table does not appear to be synched or correct for me. It's either lagged, delayed, (cached?), or missing the top few best buy/sell orders. I can't tell without taking a closer read of your code if this is ToyTrader's problem or with Mt.Gox's API (I would assume the former) but when I run and update this, the order depth chart is not the same as what is shown on https://mtgox.com/trade/historyThanks again for sharing this and I look forward to seeing further refinements. ps: I couldn't for the life of me get rid of that timezone warning that comes up with every refresh. I finally fixed it by just putting it in the command line: php -d date.timezone="America/mytimezone" -q mtgox.php
|
|
|
|
toyotasupra (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
May 21, 2011, 08:37:26 PM |
|
Thanks for your interest New version (0.0.4) sorts a feed from mtgox, so if appears any differences - they are on mtgox side. Each refresh downloads a new data from mtgox, and never cache it.
|
|
|
|
toffoo
|
|
May 21, 2011, 08:54:48 PM |
|
Hello again,
Thanks for checking this out.
But I just tried v.0.0.4 and it looks like the depth chart is still missing the top best bid and ask prices. I looked at the raw Mt.Gox API JSON data and they are there, so maybe check if your code is doing something screwy with the first entry in the list or something.
Thanks again.
|
|
|
|
toyotasupra (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
May 22, 2011, 01:31:04 AM |
|
OMG. what a shame... it was classic mistake, i forgot that arrays in php is from 0 Please update mtgox.php from github 0.0.5 version. Thanks
|
|
|
|
toffoo
|
|
May 23, 2011, 06:39:30 PM |
|
OMG. what a shame... it was classic mistake, i forgot that arrays in php is from 0 Great, looks much better now. (I'm no PHP programming expert, but I figured it was something like that.) I would say that this little tool borders on being quite useful already. Here are a few other thoughts for improvement: 1.) there should be a quick command to immediately cancel all open orders, perhaps just "c" or "c all". When things are moving fast it can be real tough to "l" to list all the open orders and then type in "c" with the each oid to cancel everything. 2.) there are a few places, like "t" to list the recent trades, where the timestamps are in Unix time. They should probably be converted to human readable format. 3.) I cannot backspace once typing in a command or an order. If I mess up, I need to Ctrl-C the entire script because my backspace just gives ^H at your command line (but works fine as a backspace in my shell). 4.) maybe a header row for the "l" list that explains what all the numbers are. I'll let you know if I can think of anything else useful as I start to use this more. Thanks again for this fun little tool and I look forward to any further refinements.
|
|
|
|
toyotasupra (OP)
Newbie
Offline
Activity: 6
Merit: 0
|
|
May 25, 2011, 05:05:12 PM |
|
Huh, thanx for feedback, please give me some time to make changes
|
|
|
|
romsek
Newbie
Offline
Activity: 11
Merit: 0
|
|
June 20, 2011, 01:33:52 AM |
|
For some reason, your application is not working anymore for me. All i get is this (i got this error days before MTGox was down): == 2011-06-19 06:54:16 ================================ *** curllib: Operation timed out after 30001 milliseconds with 0 bytes received PHP Notice: Trying to get property of non-object in /home/peter/toyotasupra-ToyTrader-7825748/mtgox.php on line 35 PHP Notice: Trying to get property of non-object in /home/peter/toyotasupra-ToyTrader-7825748/mtgox.php on line 36 USD: BTC:
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1026
|
|
June 20, 2011, 01:42:10 AM |
|
For some reason, your application is not working anymore for me. All i get is this (i got this error days before MTGox was down): == 2011-06-19 06:54:16 ================================ *** curllib: Operation timed out after 30001 milliseconds with 0 bytes received PHP Notice: Trying to get property of non-object in /home/peter/toyotasupra-ToyTrader-7825748/mtgox.php on line 35 PHP Notice: Trying to get property of non-object in /home/peter/toyotasupra-ToyTrader-7825748/mtgox.php on line 36 USD: BTC: Mtgox is currently down. For more information, head on over to the discussion forum and read any of the last 300 threads or so.
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
romsek
Newbie
Offline
Activity: 11
Merit: 0
|
|
June 20, 2011, 04:02:46 AM |
|
Like i said i already got this error days before MtGox was down.
|
|
|
|
TheRandomGuy
|
|
June 20, 2011, 05:08:35 PM |
|
Wow! Nice! Will try later.
|
|
|
|
twinpeaks
Newbie
Offline
Activity: 9
Merit: 0
|
|
June 29, 2011, 06:16:52 PM |
|
Hi, *** curllib: Operation timed out after 30001 milliseconds with 0 bytes received
This can be avoided by inserting curl_setopt ($ch, CURLOPT_USERAGENT, 'Wget/1.9.1'); in the function doRequest() in file curlib3.inc.php. (found this tip on the mtgox support forum). But starting with the MtGox restart, there is another problem: the script hangs after displaying the funds. What I get is only: ToyTrader v. 0.0.5 - command line mtgox trading tool DONATE for FASTER development: 1N8b1uzWA7RsfVPmA2kdGSEmsv91zTRMAX For help type: H and press enter == 2011-06-29 20:15:10 ================================ USD: xxx.xx BTC: yyy.yy
Did the API change somehow?
|
|
|
|
romsek
Newbie
Offline
Activity: 11
Merit: 0
|
|
June 29, 2011, 06:32:42 PM |
|
Thank you very much, twinpeaks, that solved the problem.
Now i get the same output like you.
|
|
|
|
twinpeaks
Newbie
Offline
Activity: 9
Merit: 0
|
|
June 29, 2011, 07:59:51 PM |
|
Hey, just got it working again! I added to my php.ini Instead of inserting curl_setopt ($ch, CURLOPT_USERAGENT, 'Wget/1.9.1'); uncommenting the line curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
works too. The entry in php.ini alone is not enough, it seems you also have to set one of the useragents in curllib3.inc.php. The formatting is a little off, but it works. :-)
|
|
|
|
romsek
Newbie
Offline
Activity: 11
Merit: 0
|
|
June 29, 2011, 09:07:34 PM |
|
That did the trick. Thanks again!
|
|
|
|
|