View From Mount Stupid
I was dealing with family issues most of yesterday and today, but I am still
plugging away at this.
I am now in my third day of the StockFighter challenge. two days ago you might recall, I managed to get the automated web
browser httpie installed but it seems to have some problems with SSL. I will spend a few cycles resolving those
issues, but for the time being I want to focus on the other method mentioned in the API guide using the ruby language. Ruby
is an interesting language. It was developed in Japan and the main developers speak Japanese. Some of the discussion
on the forums is exclusively in Japanese. This would not bother me if the language was in a stable condition, like
for instance C language, but it is not. Ruby is in active development 20 years after it was released. Some
people call this "remaining relevant". I call it gratuitous fluff. So, back to the challenge. The ruby program to
handle the first trade is
here:
https://starfighter.readme.io/docs/getting-started
I decided to try it. So here goes:
[starfighter@sl7-vm stockfighter]$ ruby first-trade.rb
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- httparty
(LoadError)
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in
`require'
from first-trade.rb:2:in `<main>'
Let's read the docs ...
[starfighter@sl7-vm stockfighter]$ sudo gem install httparty
[sudo] password for starfighter:
Fetching: json-1.8.3.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing httparty:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
Poo!
[
root@sl7-vm ~]# yum install ruby-devel rubygems-devel rubygem-net-http-persistent ruby-doc rubygem-json
[snip]
Installed:
ruby-devel.x86_64
0:2.0.0.598-25.el7_1
ruby-doc.noarch 0:2.0.0.598-25.el7_1
rubygem-net-http-persistent.noarch
0:2.8-5.el7 rubygems-devel.noarch
0:2.0.14-25.el7_1
Complete!
[root@sl7-vm ~]# gem install httparty
Fetching: json-1.8.3.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing httparty:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -DJSON_GENERATOR -fPIC -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-mtune=generic -fPIC -m64 -o generator.o -c generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127
Double poo! After 20 years don't you think this POS( Piece of Software ) should be self hosting?
[root@sl7-vm ~]# yum install gcc
Loaded plugins: langpacks
Resolving Dependencies
Installed:
gcc.x86_64 0:4.8.3-9.el7
Dependency Installed:
cpp.x86_64
0:4.8.3-9.el7
glibc-devel.x86_64 0:2.17-78.el7 glibc-headers.x86_64 0:2.17-78.el7
kernel-headers.x86_64 0:3.10.0-229.20.1.el7 libmpc.x86_64 0:1.0.1-3.el7 mpfr.x86_64
0:3.1.1-4.el7
Complete!
[root@sl7-vm ~]# gem install httparty
Building native extensions. This could take a while...
Successfully installed json-1.8.3
Fetching: multi_xml-0.5.5.gem (100%)
Successfully installed multi_xml-0.5.5
Fetching: httparty-0.13.7.gem (100%)
When you HTTParty, you must party hard!
Successfully installed httparty-0.13.7
Parsing documentation for json-1.8.3
Installing ri documentation for json-1.8.3
Parsing documentation for multi_xml-0.5.5
Installing ri documentation for multi_xml-0.5.5
Parsing documentation for httparty-0.13.7
Installing ri documentation for httparty-0.13.7
Whee!!!! Now we can party!
[starfighter@sl7-vm stockfighter]$ ruby first-trade.rb
{
"ok": true,
"symbol": "RKI",
"venue": "YLMEX",
"direction": "buy",
"originalQty": 25,
"qty": 25,
"price": 8700,
"orderType": "limit",
"id": 5157,
"account": "<redacted>",
"ts": "2015-12-20T18:52:29.266964823Z",
"fills": [],
"totalFilled": 0,
"open": true
}
So I'm making progress. I'm wondering how many people will choose to fight this octopus to get to the stage of being
able to launch an order. I feel like I am junking up my machine and introducing security holes so I can run some
idiosyncratic garbage that will be replaced in a few days. That is not a exaggeration. Ruby 2.2.4 was released Dec.
16, 2015. You can bet that most of those "gems" will need to be re-written to cope. The last version of C was
released in 2011. If you where a C programmer you might not have noticed. The C language is standardized ( via
ANSI in 1989 or ISO in 1990 ). Your programs would continue to work without rewrites.
I read an article yesterday about
Mount Stupid:
The premise is that people that know nothing about a subject will broadcast their ignorance to the world. So I am
just climbing the front side of Mount Stupid right now. I expect the decent to be a long trip so you can expect to
hear from me for a long time.