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: [email protected]
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 '>', '>=', '<', '<='
# shares - any integer between 1 and 500000
#
# Note: "prefix_key" must be a unique string, i.e. if you want to have two trade triggers
# in place for the same ticker symbol (WMT), you could do:
# wmt_long: WMT <= 18.5 buy 500
# wmt_short: WMT >= 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 <= 15 buy 20000
#
# Short 1700 shares of AAPL if its price hits 220:
short_appl: AAPL >= 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 <= 1.75 cover 10000

== LICENSE:

(The MIT License)

Copyright (c) 2007 Shanti A. Braford

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.