Advertisement
Guest User

gtinstall.sh

a guest
Dec 9th, 2010
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.10 KB | None | 0 0
  1. # Install script for GeniusTrader (http://www.geniustrader.org) onto Turnkey Linux LAMP 11.0 RC (http://www.turnkeylinux.org/lamp)
  2. #
  3. # v 0.0.5 build-essential added, much expanded options file, password variables
  4. # v 0.0.4 TKLBAM configured to backup options file, gt_path
  5. # v 0.0.3 Better integration, M$ Fonts, options file setup
  6. # v 0.0.2 replaced installtion of libgd-gd2-perl with libgd2-xpm-dev to fix cpan problem
  7. # == TODO ==============================================================================
  8. # When uncommenting sources, only uncomment whats needed
  9. # Integrate password source into that used by Turnkey
  10. # Move GT to a proper application install
  11. # Setup aliases and defaults so that more examples from GT documenation just work
  12. # Cut back gt privelidges on MySQL to just what it needs
  13. # Find free alternatives to the M$ fonts
  14. # ============================================================================== TODO ==
  15. # NOTES:
  16. # 1) You need to ensure that the password variables contain the correct passwords
  17. #
  18.  
  19.  
  20. MySQLPassword=password
  21. GTPassword=$MySQLPassword
  22.  
  23. # Add the user that is going to run GeniusTrader
  24. useradd --create-home --shell=/bin/bash gt
  25. echo "gt:$GTPassword" | chpasswd
  26.  
  27. # Create the directory where GeniusTrader is going to live, download GeniusTrader, extract from archive and tidy up, not forgetting to set gt as the owner
  28. mkdir /home/gt/geniustrader                                            
  29. cd /home/gt/geniustrader/
  30. wget http://www.geniustrader.org/download/geniustrader_r690.tgz
  31. cd /home/gt/
  32. tar xfz geniustrader/geniustrader_r690.tgz
  33. rm -rf /home/gt/geniustrader/Windows_Installer
  34. mkdir /home/gt/.gt
  35. echo "PATH=\"\$PATH\":/home/gt/geniustrader/Scripts" > /home/gt/.bashrc.d/gt_path
  36. echo "export PATH" >> /home/gt/.bashrc.d/gt_path
  37. chmod +x /home/gt/.bashrc.d/gt_path
  38.  
  39. chown -R gt:gt /home/gt
  40.  
  41. # Enable the multiverse source so we can get the M$ fonts (actually it uncomments all source! TODO)
  42. sed -i -e "s/# deb/deb/g" /etc/apt/sources.list.d/sources.list
  43. apt-get update
  44.  
  45. # Download and install the pre-requisites
  46. apt-get -y install libdate-calc-perl libgetargs-long-perl libxml-libxml-perl libcompress-zlib-perl libdate-manip-perl libgd2-xpm-dev beancounter msttcorefonts build-essential
  47. echo yes | cpan GD
  48.  
  49. # Setup MySQL (TODO too much power?)
  50. mysql -u root -p$MySQLPassword -e "grant all privileges on *.* to gt@localhost"
  51.  
  52. # Setup beancounter
  53. su - gt -c "setup_beancounter -m -s; update_beancounter -m"
  54.  
  55. # Download some data to get started with
  56. su - gt -c "beancounter --dbsystem MySQL --dbname beancounter addstock IBM"
  57. su - gt -c "beancounter --dbsystem MySQL --dbname beancounter backpopulate --prevdate '20 year ago' --date 'today' IBM"
  58.  
  59. # Download FTSE100 constituents and FTSE100, FTSE Mid 250, FTSE Mid 250 excl IT,FTSE All Share indexes
  60. su - gt -c "beancounter --dbsystem MySQL --dbname beancounter addstock AAL.L ABF.L ABG.L ADM.L AGK.L AMEC.L ANTO.L ARM.L ATST.L AU.L AV.L AZN.L BA.L BARC.L BATS.L BAY.L BG.L BLND.L BLT.L BNZL.L BP.L BRBY.L BSY.L BT-A.L CCL.L CNA.L CNE.L COB.L CPG.L CPI.L CSCG.L DGE.L EMG.L ENRC.L ESSR.L EXPN.L FRES.L GFS.L GKN.L GSK.L HMSO.L HSBA.L IAP.L IHG.L III.L IMT.L INVP.L IPR.L ISAT.L ISYS.L ITRK.L JMAT.L KAZ.L KGF.L LAND.L LGEN.L LLOY.L LMI.L MKS.L MRW.L NG.L NXT.L OML.L PFC.L PRU.L PSON.L RB.L RBS.L RDSA.L RDSB.L REL.L REX.L RIO.L RR.L RRS.L RSA.L RSL.L SAB.L SBRY.L SDR.L SDRC.L SGE.L SHP.L SL.L SMIN.L SN.L SRP.L SSE.L STAN.L SVT.L TLW.L TSCO.L TT.L ULVR.L UU.L VED.L VOD.L WEIR.L WOS.L WPP.L WTB.L XTA.L ^FTAS ^FTMC ^FTMX ^FTSE"
  61.  
  62. su - gt -c "beancounter --dbsystem MySQL --dbname beancounter backpopulate --prevdate '10 year ago' --date 'yesterday' AAL.L ABF.L ABG.L ADM.L AGK.L AMEC.L ANTO.L ARM.L ATST.L AU.L AV.L AZN.L BA.L BARC.L BATS.L BAY.L BG.L BLND.L BLT.L BNZL.L BP.L BRBY.L BSY.L BT-A.L CCL.L CNA.L CNE.L COB.L CPG.L CPI.L CSCG.L DGE.L EMG.L ENRC.L ESSR.L EXPN.L FRES.L GFS.L GKN.L GSK.L HMSO.L HSBA.L IAP.L IHG.L III.L IMT.L INVP.L IPR.L ISAT.L ISYS.L ITRK.L JMAT.L KAZ.L KGF.L LAND.L LGEN.L LLOY.L LMI.L MKS.L MRW.L NG.L NXT.L OML.L PFC.L PRU.L PSON.L RB.L RBS.L RDSA.L RDSB.L REL.L REX.L RIO.L RR.L RRS.L RSA.L RSL.L SAB.L SBRY.L SDR.L SDRC.L SGE.L SHP.L SL.L SMIN.L SN.L SRP.L SSE.L STAN.L SVT.L TLW.L TSCO.L TT.L ULVR.L UU.L VED.L VOD.L WEIR.L WOS.L WPP.L WTB.L XTA.L ^FTAS ^FTMC ^FTMX ^FTSE"
  63.  
  64. su - gt -c "beancounter --dbsystem MySQL --dbname beancounter update --forceupdate today"
  65.  
  66. # Setup cron to download latest data every 4 hours into beancounter
  67. var="(crontab -l; echo \"0 */4 * * * beancounter --dbsystem MySQL --dbname beancounter update --forceupdate today\") | crontab -"
  68. su - gt -c "$var"
  69.  
  70. # Create GeniusTrader Options file
  71. {
  72.     echo \# === Set data \source as beancounter
  73.     echo DB::module bean
  74.     echo DB::bean::dbname beancounter
  75.     echo DB::bean::db mysql
  76.     echo \# === Default fonts
  77.     echo \# \$FONT_ARIAL
  78.     echo Path::Font::Arial                   /usr/share/fonts/truetype/msttcorefonts/arial.ttf
  79.     echo \# \$FONT_FIXED
  80.     echo Path::Font::Courier                 /usr/share/fonts/truetype/msttcorefonts/couri.ttf
  81.     echo \# \$FONT_TIMES
  82.     echo Path::Font::Times                   /usr/share/fonts/truetype/msttcorefonts/times.ttf
  83.     echo \# === Brokerage
  84.     echo Brokers::module                     SelfTrade
  85.     echo \# ===
  86.     echo Analysis::ReferenceTimeFrame        year
  87.     echo \# === Graphics setup
  88.     echo Graphic::BackgroundColor            LINEN
  89.     echo Graphic::ZLevelOrder                reverse
  90.     echo Graphic::Axis::Font                 \$FONT_FIXED
  91.     echo \# \for the volume histogram clip
  92.     echo Graphic::Volume::Color              I:G:If \{S:G:Below \{I:Prices OPEN\} \{I:Prices CLOSE\}\} green3 red3
  93.     echo \# \for histograms \in general
  94.     echo Graphic::Histogram::Color           [100,100,100,100]
  95.     echo Graphic::Histogram::ClipColor       [80,80,80,0]
  96.     echo \#
  97.     echo Graphic::Candle::UpBorderColor      green3  \# very dark green
  98.     echo Graphic::Candle::DownBorderColor    red3    \# dark red
  99.     echo \#
  100.     echo Graphic::Candle::UpColor            green2  \# very dark green
  101.     echo Graphic::Candle::DownColor          red2    \# dark red
  102.     echo \#
  103.     echo Graphic::Positions::BuyColor        \"[0,135,0]\"  \# very dark green
  104.     echo Graphic::Positions::SellColor       \"[150,0,0]\"  \# dark red
  105.     echo \#
  106.     echo Graphic::BuySellArrows::BuyColor    \"[0,135,0,64]\"  \# very dark green
  107.     echo Graphic::BuySellArrows::SellColor   \"[150,0,0,64]\"  \# dark red
  108.     echo Graphic::BuySellArrows::Distance    24
  109.     echo Graphic::BuySellArrows::SizeFactor  6
  110.     echo \#
  111.     echo Graphic::Marks::Width               12
  112.     echo \# === Aliases
  113.     echo Aliases::Global::TFS                SY:TFS 50 10 \| CS:SY:TFS
  114.     echo Aliases::Global::TFS2[]             SY:TFS \#1 \#2 \| CS:SY:TFS \#1
  115.     echo Aliases::Global::TFS3[]             SY:TFS \#1 \#2 \| CS:SY:TFS \#1 \| CS:Stop:Fixed \#3
  116.     echo Aliases::Global::TFS[]              SY:TFS \#1 \#2 \| CS:SY:TFS \#1 \| CS:Stop:Fixed \#3
  117. } > /home/gt/.gt/options
  118. chown gt:gt /home/gt/.gt/options
  119.  
  120. #TKLBAM backup configuration
  121. echo /home/gt/.gt >> /var/lib/tklbam/profile/dirindex.conf
  122.  
  123. # su - gt -c "./geniustrader/Scripts/graphic.pl --out 'ibm_daily.png' IBM"
  124. # su - gt -c "./geniustrader/Scripts/display_indicator.pl I:Prices IBM"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement