fsxtrader
by Shanti A. Braford
http://shanti.railsblog.com/
DESCRIPTION:
* FSX Trader allows you to automate trading on the Fantasy Stock Exchange app on Facebook
* Uses the WWW::Mechanize library (a ruby gem) to simulate a browser logging into Facebook, making trades, etc
FEATURES/PROBLEMS:
* Order types supported: buy, short, sell and cover
* Pulls real-time stock quotes from Yahoo! Finance
SYNOPSIS:
Fantasy Stock Exchange app on Facebook (by HedgeStop.com):
http://apps.facebook.com/hedgestop/
As of this writing, the Fantasy Stock Exchange application on Facebook
does not allow one to place stop-limit orders or otherwise automatically
trigger a buy/sell or cover/short order based upon specified prices.
FSX Trader, when combined with a periodic cron job, can make these trades
for you.
Simply configure your trades in the ‘~/.fsx_trader.yml’ file and they
will happen automatically whenever FSX Trader is run AND conditions for
making a trade (as specified via the config file) have been met.
Note: fsxtrader of course depends upon the external HTML form variables
of the FSX App and Facebook login page. If these variables have changed,
fsxtrader be temporarily broken until the gem can be updated.
A programmatic API into FSX would be ideal, but is currently not yet offered
by HedgeStop.
REQUIREMENTS:
* Currently only works on OS X or Linux
* Other gems required: mechanize and cooloptions
INSTALL:
* sudo gem install fsxtrader
* fsxtrader setup
* Now edit your ’~/.fsx_config.yml’ file, either by hand or using: fsxtrader edit
* Add a cron job to run fsx periodically on your system
* For more options, run: fsxtrader —help
SAMPLE CRON:
Note: market hours are 9:30 AM to 4:00 PM EST
The following cron job would run fsxtrader every ten minutes
during the hours from 7 AM to 3PM (Sample West Coast config):
0-59/10 7-15 * * * fsxtrader
Every five minutes from 9 AM to 4 PM (Sample East Coast config):
0-59/5 9-16 * * * fsxtrader
If the above are giving you problems try doing a ‘which fsxtrader’ and using its
full path in the cron job or try:
0-59/5 9-16 * * * `which fsxtrader` » /path/to/a/fsxlog.txt
SAMPLE CONFIG:
auth:
email: your_fb_email@gmail.com
pass: your_fb_password
trades:
# Format:
# prefix_key: symbol condition price action shares
#
# Options
# symbol - any valid NYSE or Nasdaq ticker tradeable on the FSX
# action - any of ‘sell’, ‘cover’, ‘buy’, ‘short’
# condition - any of ‘>’, ‘>=’, ‘= 57 short 1500
#
# The above config tells FSX Trader to do the following:
# * buy 500 shares of WMT (Wal-Mart Stores Inc) when its share price reaches 18.5 or lower
# * short 1500 shares of WMT (Wal-Mart Stores Inc) when its share prices reaches 57 or greater
#
#
# Configurations to automatically make NEW positions:
#
# Buy 20000 shares of CSCO if its price hits 15 dollars or lower:
buy_low_csco: CSCO = 220 short 1700
#
# Configurations to automatically get out of EXISTING positions:
#
# Sell 2000 shares of GOOG if its price hits 500:
goog: GOOG >= 500 sell 2000
#
# Cover 10000 shares of LEND if its price hits 1.75:
cover_lend: LEND