modsix/bitotter_perl
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# # Copyright (c) 2012, 2013, 2014 # BITOTTER (http://www.bitotter.com) All rights reserved. # # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by BITOTTER, # http://www.bitotter.com # 4. Neither the name "BITOTTER" nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY BITOTTER ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL BITOTTER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # Copyright (c) 2012, 2013, 2014 bitotter.com <modsix@gmail.com> 0x721705A8B71EADAF BitOTTer Perl Tools: BitOTTer IRC Bot for MPEx (bitotter_bot.pl) -- v0.0.2 alpha, works ok so far during testing. Use with caution. -- Will connect to IRC and allow botcontroller to issue DEPTH|VWAP commands to mpexbot -- Parsed output prints to terminal window where script is launched (STDOUT). BitOTTer Depth Tool for MPEx (bitotter_depth.pl) -- v0.0.3 beta BitOTTer VWAP Tool for MPEx [Volume Weighted Average Price] (bitotter_vwap.pl) -- v0.0.3 beta BitOTTer MPEx Trade Tool (bitotter.pl) -- v0.0.5 beta #################################################### REQUIRED LIBS per each of BitOTTer Perl Tools: bitotter_depth.pl LWP::Protocol::socks --> http://search.cpan.org/~scr/LWP-Protocol-socks-1.6/lib/LWP/Protocol/socks4.pm LWP::UserAgent --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/UserAgent.pm LWP::Simple --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/Simple.pm JSON --> http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm bitotter_vwap.pl LWP::Protocol::socks --> http://search.cpan.org/~scr/LWP-Protocol-socks-1.6/lib/LWP/Protocol/socks4.pm LWP::UserAgent --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/UserAgent.pm LWP::Simple --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/Simple.pm JSON --> http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm bitotter_bot.pl LWP::UserAgent --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/UserAgent.pm LWP::Simple --> http://cpansearch.perl.org/src/GAAS/libwww-perl-6.04/lib/LWP/Simple.pm POE::Component::IRC --> http://cpansearch.perl.org/src/BINGOS/POE-Component-IRC-6.82/lib/POE/Component/IRC.pm JSON --> http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm bitotter.pl LWP::UserAgent --> http://search.cpan.org/~gaas/libwww-perl-6.04/lib/LWP/UserAgent.pm Term::ReadKey --> http://search.cpan.org/dist/TermReadKey/ReadKey.pm CGI --> http://search.cpan.org/~markstos/CGI.pm-3.60/lib/CGI.pm GPG --> http://search.cpan.org/~miles/GPG-0.06/GPG.pm #################################################### ATTENTION -- The GPG perl module will require a change before it will work properly with bitotter.pl. As you can see below from the unified diff, one simply has to add the --quiet line to the module. Run a `find / -name "GPG.pm"` to find the file if needed. [ It's possible that there will be several turned up after a search, you can apply the fix to all, but you're probably looking for one in this or a similar path: /usr/local/share/perl/ ] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< root@localhost:/usr/local/share/perl/5.14.2# diff -u GPG.orig GPG.pm --- GPG.orig 2013-10-30 01:51:43.532291282 -0500 +++ GPG.pm 2013-10-30 01:47:06.552295771 -0500 @@ -25,6 +25,7 @@ $self->{'COMMAND'} .= " --batch"; $self->{'COMMAND'} .= " --no-comment"; $self->{'COMMAND'} .= " --no-version"; + $self->{'COMMAND'} .= " --quiet"; $self->{'COMMAND'} .= ' '; # so i dont forget the spaces later :-) if ($self->{'debug'}) { <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #################################################### WARNING: For some reason I havnen't figured out yet, tor now opens a socket on 9150 by default and if you try to change it to 9050 as it was before, it gets tempermental. So to avoid some stuff, just set up tor to listen on 9150 now. This is the default, so if you keep up with all the latest versions (AS YOU SHOULD) this shouldn't be an issue. NOTE: BitOTTer perl tools will look for localhost:9150 to use for a Tor Socket. If you wish to try to run these tools with a Tor socket, make sure tor is setup to listen on localhost:9150 How do I set it up to use 9150? This is how to do just that (taken from the TorFAQ): "In Vidalia, go to Settings->Advanced and uncheck the box that says 'Configure ControlPort automatically'. Your SOCKS port will then be on 9150." This is taken from this page: https://trac.torproject.org/projects/tor/wiki/doc/TorFAQ#SOCKSAndDNS And more good info for how to use Tor can be found here: https://www.torproject.org/docs/documentation.html.en Not sure if Tor is actually listening on localhost:9050 ?? Try the following at your UNIX prompt: `netstat -an | grep 9150` If it is indeed listening you should see something like the following: tcp 0 0 127.0.0.1:9150 0.0.0.0:* LISTEN If you wish to run these tools without using tor, simply just leave off the 'usetor' flag and these BitOTTer perl tools will use a simple naked connection to the data feed. See the without tor example below. Need help!? Find me on irc.freenode.net or send email to modsix at gmail dot com -- mod6 #################################################### BitOTTer Trade Tool for MPEx: This perl tool will allow the user to send clearsigned/encrypted commands over Tor (or not) to MPEx to be executed. This tool makes some assumptions about the location of your local .gnupg directory, and a tmp directory that is needed. Please reivew these variable settings in the bitotter.pl script: $PATH_TO_GPG_HOME = "~/.gnupg"; # This is the default MPEx Receipts will be stored by default in this directory - Be advised that every transaction will have a different output file. This will give the user a historical log of all transactions with MPEx: $TMP_DIR = "/tmp"; # This is the default MPEx Receipt files (stored in $TMP_DIR) will have the following nomenclature: mpex_reply_YYYYMMDD_UNIXTIME.txt Please ensure that he MPEx public PGP key is imported to your GPG keyring before running bitotter.pl. If you do not have the MPEx key imported to your keyring, bitotter.pl will take notice and exit accordingly. [mod6@localhost:~]% ./bitotter.pl "STAT" usetor ..::[ BitOTTer (for UNIX) ]::.. MPEx Key Found: XXXXXXXXXXXX GPG Public Key username [email|name|keyid|org]: foo Public Key Found: XXXXXXXXXXXX for user: foo (foo's Public Key) <foo@bar.com> Was this the correct public key id? [Y/N]: Y Enter GPG Passphrase [will not echo back to terminal]: TOR ENABLED - Connecting to MPEx via Tor Socket... DECRYPTED ORDER FROM MPEx: -----BEGIN PGP SIGNED MESSAGE----- ... All the good stuff here ... -----END PGP SIGNED MESSAGE----- #################################################### BitOTTer Depth Tool for MPEx (bitotter_depth.pl) v0.0.3 beta This tool will display bid/ask depth for all MPSICs or per MPSIC input by the user. Usage: ./bitotter_depth.pl <MPSIC|ALL> [pastebin-raw-url] [usetor|no-tor] Output Sample: ~$ ./bitotter_depth.pl S.MPOE http://pastebin.com/raw.php?i=SoMeKeYId usetor TOR ENABLED - Connecting to pastebin via Tor Socket... ..::[ BitOTTer Market Depth for MPEx: S.MPOE ]::.. S => Price: 100000000 Volume: 10000 S => Price: 10000000 Volume: 2000 S => Price: 1000000 Volume: 2000 S => Price: 1000000 Volume: 100000 S => Price: 100000 Volume: 10000 S => Price: 79000 Volume: 450000 S => Price: 78984 Volume: 23163 S => Price: 78000 Volume: 500000 S => Price: 77999 Volume: 54540 S => Price: 77998 Volume: 10417 S => Price: 77998 Volume: 8646 S => Price: 77988 Volume: 1399 S => Price: 76718 Volume: 12095 S => Price: 76717 Volume: 21 B => Price: 72491 Volume: 1056 B => Price: 72490 Volume: 13550 B => Price: 71712 Volume: 5600 B => Price: 71102 Volume: 1354 B => Price: 70102 Volume: 10000 B => Price: 69648 Volume: 19700 B => Price: 69415 Volume: 7200 B => Price: 69002 Volume: 10000 B => Price: 68138 Volume: 10000 B => Price: 67637 Volume: 7956 B => Price: 67334 Volume: 7576 B => Price: 66336 Volume: 10000 B => Price: 63336 Volume: 10000 B => Price: 60001 Volume: 2435 B => Price: 60001 Volume: 1000 B => Price: 56000 Volume: 50000 B => Price: 55501 Volume: 500 B => Price: 55000 Volume: 340602 B => Price: 53500 Volume: 168150 B => Price: 40000 Volume: 150000 B => Price: 38151 Volume: 5000 B => Price: 38150 Volume: 14391957 B => Price: 102 Volume: 5000000 B => Price: 101 Volume: 10000000 B => Price: 100 Volume: 10000000 OR ~$ ./bitotter_depth.pl S.MPOE usetor TOR ENABLED - Connecting to pastebin via Tor Socket... ..::[ BitOTTer Market Depth for MPEx: S.MPOE ]::.. S => Price: 100000000 Volume: 10000 S => Price: 10000000 Volume: 2000 S => Price: 1000000 Volume: 2000 S => Price: 1000000 Volume: 100000 ... --------------------------------------------------------- NOTE: If you request to view ALL MPSICs instead of one in particular, you may want to pipe output to a different file or perhaps `more` or `less` as the data can be longer than one page. Output Sample: ~$ ./bitotter_depth.pl ALL http://pastebin.com/raw.php?i=SoMeKeYId usetor | less TOR ENABLED - Connecting to pastebin via Tor Socket... ..::[ BitOTTer Market Depth for MPEx: ALL ]::.. MPSIC => O.BTCUSD.C630N: S => Price: 21209323 Volume: 1000 B => Price: 2103500 Volume: 1000 MPSIC => O.BTCUSD.C630T: S => Price: 5213501 Volume: 1000 B => Price: 487924 Volume: 1000 MPSIC => O.BTCUSD.C730N: S => Price: 16901438 Volume: 1000 B => Price: 2 Volume: 1000 MPSIC => O.BTCUSD.P050N: S => Price: 5213501 Volume: 1000 B => Price: 544 Volume: 1000 ... #################################################### BitOTTer VWAP Tool for MPEx [Volume Weighted Average Price] (bitotter_vwap.pl) v0.0.3 beta This tool will display the rolling VWAP per MPSIC in 1/7/30 day format from pastebin URL via mpexbot. Usage: ./bitotter_vwap.pl <MPSIC> [pastebin-raw-url] [usetor|no-tor] Output Sample: ~$ ./bitotter_vwap.pl S.MPOE http://pastebin.com/raw.php?i=SoMeKeYId usetor TOR ENABLED - Connecting to pastebin via Tor Socket... ..::[ BitOTTer VWAP Tool for MPEx: S.MPOE ]::.. S.MPOE: 1d avg: => 67091.1679749 1d min: => 63570 1d max: => 68314 1d vsh: => 710511 1d vsa: => 47669012849 1d cnt: => 69 7d avg: => 66404.9547218 7d min: => 60000 7d max: => 71369 7d vsh: => 2322597 7d vsa: => 154231948622 7d cnt: => 326 30d avg: => 73244.1915426 30d min: => 60000 30d max: => 78628 30d vsh: => 17452785 30d vsa: => 1278315127492 30d cnt: => 1056 #################################################### BitOTTer IRC Bot for MPEx (bitotter_bot.pl) v0.0.2 alpha This tool will connect to IRC and issue DEPTH or VWAP to mpexbot via private message. The market data will be parsed and output to std-out. Example: Private message commands directly to BitOTTer<###> - where <###> is the random bot number. ----8<--------8<--------8<--------8<--------8<--------8<---- (17:51) (!) Irssi: Starting query in freenode with BitOTTer<###> (18:01) <mod6> VWAP|^OIX (18:02) <mod6> DEPTH|O.BTCUSD.C450T ----8<--------8<--------8<--------8<--------8<--------8<---- Output to StdOut: ~$ ./bitotter_bot.pl ..::[ BitOTTer Bot VWAP Data for MPEx: ^OIX ]::.. ^OIX: 1d avg: => 1d min: => 1d max: => 1d vsh: => 1d vsa: => 1d cnt: => 7d avg: => 3931406066 7d min: => 3762123733 7d max: => 5758756229 7d vsh: => 28662 7d vsa: => 485115460096 7d cnt: => 30d avg: => 30d min: => 30d max: => 30d vsh: => 30d vsa: => 30d cnt: => ..::[ BitOTTer Bot Market Depth for MPEx: O.BTCUSD.C450T ]::.. S => Price: 22000000 Volume: 231 S => Price: 18101976 Volume: 54 B => Price: 11870148 Volume: 1000 ...
About
BitOTTer Perl Tools for MPEx (UNIX)
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published