├── README.md ├── UserLists ├── .DS_Store ├── SP500.txt ├── SP500_2007.txt ├── SP500_2010.txt └── SP500_2013.txt ├── databases ├── StockLists │ ├── AMEX.txt │ ├── NASDAQ.txt │ └── NYSE.txt └── user_lists.db ├── resources ├── .DS_Store ├── commons-io-2.4 │ ├── .DS_Store │ ├── LICENSE.txt │ ├── NOTICE.txt │ ├── RELEASE-NOTES.txt │ ├── commons-io-2.4-javadoc.jar │ ├── commons-io-2.4-sources.jar │ ├── commons-io-2.4-test-sources.jar │ ├── commons-io-2.4-tests.jar │ ├── commons-io-2.4.jar │ └── docs │ │ ├── allclasses-frame.html │ │ ├── allclasses-noframe.html │ │ ├── constant-values.html │ │ ├── deprecated-list.html │ │ ├── help-doc.html │ │ ├── index-all.html │ │ ├── index.html │ │ ├── org │ │ └── apache │ │ │ └── commons │ │ │ └── io │ │ │ ├── ByteOrderMark.html │ │ │ ├── Charsets.html │ │ │ ├── CopyUtils.html │ │ │ ├── DirectoryWalker.CancelException.html │ │ │ ├── DirectoryWalker.html │ │ │ ├── EndianUtils.html │ │ │ ├── FileCleaner.html │ │ │ ├── FileCleaningTracker.html │ │ │ ├── FileDeleteStrategy.html │ │ │ ├── FileExistsException.html │ │ │ ├── FileSystemUtils.html │ │ │ ├── FileUtils.html │ │ │ ├── FilenameUtils.html │ │ │ ├── HexDump.html │ │ │ ├── IOCase.html │ │ │ ├── IOExceptionWithCause.html │ │ │ ├── IOUtils.html │ │ │ ├── LineIterator.html │ │ │ ├── TaggedIOException.html │ │ │ ├── class-use │ │ │ ├── ByteOrderMark.html │ │ │ ├── Charsets.html │ │ │ ├── CopyUtils.html │ │ │ ├── DirectoryWalker.CancelException.html │ │ │ ├── DirectoryWalker.html │ │ │ ├── EndianUtils.html │ │ │ ├── FileCleaner.html │ │ │ ├── FileCleaningTracker.html │ │ │ ├── FileDeleteStrategy.html │ │ │ ├── FileExistsException.html │ │ │ ├── FileSystemUtils.html │ │ │ ├── FileUtils.html │ │ │ ├── FilenameUtils.html │ │ │ ├── HexDump.html │ │ │ ├── IOCase.html │ │ │ ├── IOExceptionWithCause.html │ │ │ ├── IOUtils.html │ │ │ ├── LineIterator.html │ │ │ └── TaggedIOException.html │ │ │ ├── comparator │ │ │ ├── CompositeFileComparator.html │ │ │ ├── DefaultFileComparator.html │ │ │ ├── DirectoryFileComparator.html │ │ │ ├── ExtensionFileComparator.html │ │ │ ├── LastModifiedFileComparator.html │ │ │ ├── NameFileComparator.html │ │ │ ├── PathFileComparator.html │ │ │ ├── SizeFileComparator.html │ │ │ ├── class-use │ │ │ │ ├── CompositeFileComparator.html │ │ │ │ ├── DefaultFileComparator.html │ │ │ │ ├── DirectoryFileComparator.html │ │ │ │ ├── ExtensionFileComparator.html │ │ │ │ ├── LastModifiedFileComparator.html │ │ │ │ ├── NameFileComparator.html │ │ │ │ ├── PathFileComparator.html │ │ │ │ └── SizeFileComparator.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── filefilter │ │ │ ├── AbstractFileFilter.html │ │ │ ├── AgeFileFilter.html │ │ │ ├── AndFileFilter.html │ │ │ ├── CanReadFileFilter.html │ │ │ ├── CanWriteFileFilter.html │ │ │ ├── ConditionalFileFilter.html │ │ │ ├── DelegateFileFilter.html │ │ │ ├── DirectoryFileFilter.html │ │ │ ├── EmptyFileFilter.html │ │ │ ├── FalseFileFilter.html │ │ │ ├── FileFileFilter.html │ │ │ ├── FileFilterUtils.html │ │ │ ├── HiddenFileFilter.html │ │ │ ├── IOFileFilter.html │ │ │ ├── MagicNumberFileFilter.html │ │ │ ├── NameFileFilter.html │ │ │ ├── NotFileFilter.html │ │ │ ├── OrFileFilter.html │ │ │ ├── PrefixFileFilter.html │ │ │ ├── RegexFileFilter.html │ │ │ ├── SizeFileFilter.html │ │ │ ├── SuffixFileFilter.html │ │ │ ├── TrueFileFilter.html │ │ │ ├── WildcardFileFilter.html │ │ │ ├── WildcardFilter.html │ │ │ ├── class-use │ │ │ │ ├── AbstractFileFilter.html │ │ │ │ ├── AgeFileFilter.html │ │ │ │ ├── AndFileFilter.html │ │ │ │ ├── CanReadFileFilter.html │ │ │ │ ├── CanWriteFileFilter.html │ │ │ │ ├── ConditionalFileFilter.html │ │ │ │ ├── DelegateFileFilter.html │ │ │ │ ├── DirectoryFileFilter.html │ │ │ │ ├── EmptyFileFilter.html │ │ │ │ ├── FalseFileFilter.html │ │ │ │ ├── FileFileFilter.html │ │ │ │ ├── FileFilterUtils.html │ │ │ │ ├── HiddenFileFilter.html │ │ │ │ ├── IOFileFilter.html │ │ │ │ ├── MagicNumberFileFilter.html │ │ │ │ ├── NameFileFilter.html │ │ │ │ ├── NotFileFilter.html │ │ │ │ ├── OrFileFilter.html │ │ │ │ ├── PrefixFileFilter.html │ │ │ │ ├── RegexFileFilter.html │ │ │ │ ├── SizeFileFilter.html │ │ │ │ ├── SuffixFileFilter.html │ │ │ │ ├── TrueFileFilter.html │ │ │ │ ├── WildcardFileFilter.html │ │ │ │ └── WildcardFilter.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── input │ │ │ ├── AutoCloseInputStream.html │ │ │ ├── BOMInputStream.html │ │ │ ├── BoundedInputStream.html │ │ │ ├── BrokenInputStream.html │ │ │ ├── CharSequenceInputStream.html │ │ │ ├── CharSequenceReader.html │ │ │ ├── ClassLoaderObjectInputStream.html │ │ │ ├── CloseShieldInputStream.html │ │ │ ├── ClosedInputStream.html │ │ │ ├── CountingInputStream.html │ │ │ ├── DemuxInputStream.html │ │ │ ├── NullInputStream.html │ │ │ ├── NullReader.html │ │ │ ├── ProxyInputStream.html │ │ │ ├── ProxyReader.html │ │ │ ├── ReaderInputStream.html │ │ │ ├── ReversedLinesFileReader.html │ │ │ ├── SwappedDataInputStream.html │ │ │ ├── TaggedInputStream.html │ │ │ ├── Tailer.html │ │ │ ├── TailerListener.html │ │ │ ├── TailerListenerAdapter.html │ │ │ ├── TeeInputStream.html │ │ │ ├── XmlStreamReader.html │ │ │ ├── XmlStreamReaderException.html │ │ │ ├── class-use │ │ │ │ ├── AutoCloseInputStream.html │ │ │ │ ├── BOMInputStream.html │ │ │ │ ├── BoundedInputStream.html │ │ │ │ ├── BrokenInputStream.html │ │ │ │ ├── CharSequenceInputStream.html │ │ │ │ ├── CharSequenceReader.html │ │ │ │ ├── ClassLoaderObjectInputStream.html │ │ │ │ ├── CloseShieldInputStream.html │ │ │ │ ├── ClosedInputStream.html │ │ │ │ ├── CountingInputStream.html │ │ │ │ ├── DemuxInputStream.html │ │ │ │ ├── NullInputStream.html │ │ │ │ ├── NullReader.html │ │ │ │ ├── ProxyInputStream.html │ │ │ │ ├── ProxyReader.html │ │ │ │ ├── ReaderInputStream.html │ │ │ │ ├── ReversedLinesFileReader.html │ │ │ │ ├── SwappedDataInputStream.html │ │ │ │ ├── TaggedInputStream.html │ │ │ │ ├── Tailer.html │ │ │ │ ├── TailerListener.html │ │ │ │ ├── TailerListenerAdapter.html │ │ │ │ ├── TeeInputStream.html │ │ │ │ ├── XmlStreamReader.html │ │ │ │ └── XmlStreamReaderException.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── monitor │ │ │ ├── FileAlterationListener.html │ │ │ ├── FileAlterationListenerAdaptor.html │ │ │ ├── FileAlterationMonitor.html │ │ │ ├── FileAlterationObserver.html │ │ │ ├── FileEntry.html │ │ │ ├── class-use │ │ │ │ ├── FileAlterationListener.html │ │ │ │ ├── FileAlterationListenerAdaptor.html │ │ │ │ ├── FileAlterationMonitor.html │ │ │ │ ├── FileAlterationObserver.html │ │ │ │ └── FileEntry.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── output │ │ │ ├── BrokenOutputStream.html │ │ │ ├── ByteArrayOutputStream.html │ │ │ ├── CloseShieldOutputStream.html │ │ │ ├── ClosedOutputStream.html │ │ │ ├── CountingOutputStream.html │ │ │ ├── DeferredFileOutputStream.html │ │ │ ├── DemuxOutputStream.html │ │ │ ├── FileWriterWithEncoding.html │ │ │ ├── LockableFileWriter.html │ │ │ ├── NullOutputStream.html │ │ │ ├── NullWriter.html │ │ │ ├── ProxyOutputStream.html │ │ │ ├── ProxyWriter.html │ │ │ ├── StringBuilderWriter.html │ │ │ ├── TaggedOutputStream.html │ │ │ ├── TeeOutputStream.html │ │ │ ├── ThresholdingOutputStream.html │ │ │ ├── WriterOutputStream.html │ │ │ ├── XmlStreamWriter.html │ │ │ ├── class-use │ │ │ │ ├── BrokenOutputStream.html │ │ │ │ ├── ByteArrayOutputStream.html │ │ │ │ ├── CloseShieldOutputStream.html │ │ │ │ ├── ClosedOutputStream.html │ │ │ │ ├── CountingOutputStream.html │ │ │ │ ├── DeferredFileOutputStream.html │ │ │ │ ├── DemuxOutputStream.html │ │ │ │ ├── FileWriterWithEncoding.html │ │ │ │ ├── LockableFileWriter.html │ │ │ │ ├── NullOutputStream.html │ │ │ │ ├── NullWriter.html │ │ │ │ ├── ProxyOutputStream.html │ │ │ │ ├── ProxyWriter.html │ │ │ │ ├── StringBuilderWriter.html │ │ │ │ ├── TaggedOutputStream.html │ │ │ │ ├── TeeOutputStream.html │ │ │ │ ├── ThresholdingOutputStream.html │ │ │ │ ├── WriterOutputStream.html │ │ │ │ └── XmlStreamWriter.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── package-use.html │ │ ├── overview-frame.html │ │ ├── overview-summary.html │ │ ├── overview-tree.html │ │ ├── package-list │ │ ├── resources │ │ └── inherit.gif │ │ ├── serialized-form.html │ │ └── stylesheet.css ├── jcommon-1.0.16.jar ├── jfreechart-1.0.13.jar └── sqlite-jdbc-3.7.2.jar └── src ├── QuantTrader.java └── com ├── .DS_Store ├── effing └── toolkit │ ├── Math2.java │ └── Util2.java └── qt ├── MainSystem.java ├── Module.java ├── OrderManager.java ├── StockDatabase.java ├── classes ├── Asset.java ├── Order.java ├── Portfolio.java └── Stock.java └── modules ├── backtest ├── Backtest.java ├── Macro.java ├── Script.java ├── macros │ ├── ListFunction.java │ ├── PairFunction.java │ └── StockFunction.java └── scripts │ ├── BuyOnGap.java │ ├── Example.java │ └── Test.java └── database ├── Database.java ├── StockFetchTask.java └── StockFetcher.java /README.md: -------------------------------------------------------------------------------- 1 | **Deprecated**: See https://github.com/effinggames/stock-trader for a better version written in Scala. 2 | 3 | Stock Backtester and Analysis application for EOD (End-of-day) data. Easy creation of java-based scripts, macros, user lists without touching internal code. Uses hot-reloading to rapidly edit scripts without restarting. Automatically downloads data from Yahoo finance. 4 | 5 | Easy to setup - Steps: 6 | 7 | 1. Download source and open in favorite IDE (I like Eclipse) 8 | 2. Add JVM options to run configuration: -d64 -Xms512m -Xmx4g 9 | 3. Add all the jars in resource folder to the build path 10 | 4. Run starting from the main QuantTrader class 11 | 5. Enter 'database download' to download initial set of Yahoo finance EOD data (~10 minutes). 12 | 6. Then enter 'backtest test' to verify everything works, or 'help' to see all commands. 13 | 14 | 15 | Add custom backtesting scripts to: com.qt.modules.backtest.scripts 16 | Add custom backtesting macros to: com.qt.modules.backtest.macros 17 | Add custom stock lists (SP500, NASDAQ100, etc) to: /UserLists (then do 'database rebuild') 18 | 19 | 20 | Example Script: 21 | ![](https://cloud.githubusercontent.com/assets/2387719/5312322/81460100-7c25-11e4-928b-b868ae26e7bb.png) 22 | 23 | Screenshots: 24 | 25 | ![](https://cloud.githubusercontent.com/assets/2387719/5312324/8a1dfcce-7c25-11e4-974f-8cd5393e8bbd.png) 26 | 27 | ![](https://cloud.githubusercontent.com/assets/2387719/5312325/8e59b954-7c25-11e4-9ad6-d45a4423bb08.png) 28 | 29 | ![](https://cloud.githubusercontent.com/assets/2387719/5312328/93cd961c-7c25-11e4-9fe9-93e3aaeb8a5d.png) 30 | 31 | Please fork and improve :) 32 | -------------------------------------------------------------------------------- /UserLists/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/UserLists/.DS_Store -------------------------------------------------------------------------------- /UserLists/SP500.txt: -------------------------------------------------------------------------------- 1 | XOM AAPL MSFT PG IBM JNJ GE JPM BAC T CVX WFC CSCO BRK/B KO PFE INTC GOOG MRK HPQ WMT PEP C ORCL PM COP MCD VZ GS ABT SLB DIS OXY UTX UPS QCOM MMM CMCSA AXP KFT AMGN BA HD USB MO BMY EMC CVS AMZN MDT CAT CL F TGT UNP MS LLY UNH EMR TWX V DD DTV BK MET PNC HON GILD TXN DOW MON LOW NEM FCX NWSA WAG APA SO DVN EXC GLW NKE EOG MHS ESRX PRU DE KMB HAL BAX PX COST TRV SPG D CELG APC FDX GIS EBAY GD LMT DELL MRO AFL WLP DUK NEE ADP TMO MA NSC CSX BHI DHR AGN VIA/B JCI TWC COF SBUX YUM BBT STT MCK RTN ACE AMT CME YHOO MOT SYY TJX ADM CB PEG NOC ITW AEP AMAT CTSH PCG BDX PCAR WM BRCM PCP HES ALL NOV APD ADBE SPLS SYK KSS ETR CMI HNZ GENZ BIIB SCHW CCL JNPR NTAP S CHK BEN SE PGR SWN KR K ISRG CAH ED PSA L EQR STI TROW AVP MMC NUE PPL BBY SRE VNO NTRS STJ AET SYMC XRX PGN INTU NBL ZMH BTU ETN FE LO ECL WMB COH MJN OMC AA CRM EIX BXP PPG WU CAG PCLN FITB CTL DISCA IP HIG SNDK VLO XEL HCP AMP SII BSX RSG AON BBBY A CBS HSP CHRW MUR MHP DPS SLE RAI PH HST FIS ABC CLX CCE IVZ LUV ADI COL LIFE HOT EP CI GR CTXS FRX ITT WY CAM HSY LLL PAYX ALTR SWK GPS EXPD MAT RF AVB DFS CNX DOV Q DTE MAR PFG HUM LH FLR SWY XLNX ICE EL M DGX AKAM CA VTR WDC BCR SJM UNM FTI MU APH MTB ROK NYX FTR LNC KEY CSC FISV PXD WHR TAP GNW LLTC CMA BMC AES LTD CEG CPB VAR BF/B ROST VFC GPC WFMI RRC ORLY GWW SIAL CLF SHW FAST FSLR FO DVA WEC X NVDA RHT ADSK WAT HCBK XL PCL DNR AZO AEE CNP HOG NRG HRS DRI WYNN KIM JWN VMC MYL APOL MCHP SLM SRCL CF ROP WIN TSN HCN ARG CERN EQT JCP HAS TDC QEP PBCT VRSN KLAC TIF MKC FDO FLS BLL PLD NBR RL ERTS AIG TXT OI SAI OKE PBI NU MFE LM HRB JEC IGT FLIR WPI ATI CEPH DO PWR CINF XRAY NI MCO HBAN IRM KMX SCG URBN MI PLL NWL FMC EXPE HP AMD PNW TMK AIZ MWV EMN MAS SUN CFN PTV LUK WYN IPG AVY CBG AYE EFX RHI ZION SNI POM CMS TEG GCI IFF RRD TE SEE DNB COG NSM CTAS LSI DV SHLD STZ BMS ANF LEG MEE GME HRL JBL DHI TSS CVH TLAB GT RDC BIG FHN PHM RSH PDCO ETFC WPO NDAQ LXK NVLS MOLX SNA PCS AIV SVU LEN WFR JDSU PKI KG R HAR NOVL DF QLGC THC CPWR GAS FII TER JNS AN TIE TSO MWW AKS EK ODP MDP NYT -------------------------------------------------------------------------------- /UserLists/SP500_2010.txt: -------------------------------------------------------------------------------- 1 | XOM AAPL MSFT PG IBM JNJ GE JPM BAC T CVX WFC CSCO BRK/B KO PFE INTC GOOG MRK HPQ WMT PEP C ORCL PM COP MCD VZ GS ABT SLB DIS OXY UTX UPS QCOM MMM CMCSA AXP KFT AMGN BA HD USB MO BMY EMC CVS AMZN MDT CAT CL F TGT UNP MS LLY UNH EMR TWX V DD DTV BK MET PNC HON GILD TXN DOW MON LOW NEM FCX NWSA WAG APA SO DVN EXC GLW NKE EOG MHS ESRX PRU DE KMB HAL BAX PX COST TRV SPG D CELG APC FDX GIS EBAY GD LMT DELL MRO AFL WLP DUK NEE ADP TMO MA NSC CSX BHI DHR AGN VIA/B JCI TWC COF SBUX YUM BBT STT MCK RTN ACE AMT CME YHOO MOT SYY TJX ADM CB PEG NOC ITW AEP AMAT CTSH PCG BDX PCAR WM BRCM PCP HES ALL NOV APD ADBE SPLS SYK KSS ETR CMI HNZ GENZ BIIB SCHW CCL JNPR NTAP S CHK BEN SE PGR SWN KR K ISRG CAH ED PSA L EQR STI TROW AVP MMC NUE PPL BBY SRE VNO NTRS STJ AET SYMC XRX PGN INTU NBL ZMH BTU ETN FE LO ECL WMB COH MJN OMC AA CRM EIX BXP PPG WU CAG PCLN FITB CTL DISCA IP HIG SNDK VLO XEL HCP AMP SII BSX RSG AON BBBY A CBS HSP CHRW MUR MHP DPS SLE RAI PH HST FIS ABC CLX CCE IVZ LUV ADI COL LIFE HOT EP CI GR CTXS FRX ITT WY CAM HSY LLL PAYX ALTR SWK GPS EXPD MAT RF AVB DFS CNX DOV Q DTE MAR PFG HUM LH FLR SWY XLNX ICE EL M DGX AKAM CA VTR WDC BCR SJM UNM FTI MU APH MTB ROK NYX FTR LNC KEY CSC FISV PXD WHR TAP GNW LLTC CMA BMC AES LTD CEG CPB VAR BF/B ROST VFC GPC WFMI RRC ORLY GWW SIAL CLF SHW FAST FSLR FO DVA WEC X NVDA RHT ADSK WAT HCBK XL PCL DNR AZO AEE CNP HOG NRG HRS DRI WYNN KIM JWN VMC MYL APOL MCHP SLM SRCL CF ROP WIN TSN HCN ARG CERN EQT JCP HAS TDC QEP PBCT VRSN KLAC TIF MKC FDO FLS BLL PLD NBR RL ERTS AIG TXT OI SAI OKE PBI NU MFE LM HRB JEC IGT FLIR WPI ATI CEPH DO PWR CINF XRAY NI MCO HBAN IRM KMX SCG URBN MI PLL NWL FMC EXPE HP AMD PNW TMK AIZ MWV EMN MAS SUN CFN PTV LUK WYN IPG AVY CBG AYE EFX RHI ZION SNI POM CMS TEG GCI IFF RRD TE SEE DNB COG NSM CTAS LSI DV SHLD STZ BMS ANF LEG MEE GME HRL JBL DHI TSS CVH TLAB GT RDC BIG FHN PHM RSH PDCO ETFC WPO NDAQ LXK NVLS MOLX SNA PCS AIV SVU LEN WFR JDSU PKI KG R HAR NOVL DF QLGC THC CPWR GAS FII TER JNS AN TIE TSO MWW AKS EK ODP MDP NYT -------------------------------------------------------------------------------- /UserLists/SP500_2013.txt: -------------------------------------------------------------------------------- 1 | AAPL XOM GE CVX IBM MSFT GOOG JNJ PG PFE T JPM BRK/B WFC PM KO ORCL BAC C VZ MRK WMT PEP QCOM CSCO CMCSA SLB INTC HD DIS AMZN MCD V UTX MO COP OXY GS EBAY MMM UNP AMGN USB CVS GILD CAT BMY AXP UPS ABBV UNH NWSA AIG MA ABT MON HON LLY BA TWX EMC F SPG CL DUK MDT MDLZ ACN ESRX COST LOW DD EMR CELG APC SBUX TGT PSX NKE BIIB MET HAL DOW SO TXN BAX DHR KMB WAG DE PCLN EOG PNC FCX AGN HPQ MS TJX PX BK D COF FDX NEE TRV BLK COV APA DTV AMT ADP NOV ACE YUM GIS ETN MPC KRFT VIAB PCP ITW TMO STT PRU CBS TWC VLO EXC MRO MCK KMI WMB LMT CSX HNZ AFL CTSH LYB CRM ISRG NSC DVN ALL GD JCI CB AEP YHOO PSA HCP NEM ADM BBT CMI CTL VTR BHI DELL HES BEN NBL PPG CCI ECL DFS MMC SE ADBE WLP GLW SYY APD TROW SCHW IP EQR SYK PCG AON CME PLD BRCM RTN S PPL CI BDX TEL INTU MSI MOS SRE PCAR FE DISCA ALXN WY ED CCL AET AMAT HCN BXP NOC LO PXD MJN WM CAM CAH PEG SYMC M NUE OMC EIX WFM STI EL ESV TYC AVB IR K A FITB VNO KR PH SHW FAST AMP RAI MAT ADI VFC AZO CAG COH GWW XEL L CF CTXS PGR ROST SWK BBBY ZMH NTAP DOV NU CERN STJ MTB ROK SNDK MHP HST HUM FTI HOT IVZ HSY HOG MYL ROP DLPH NTRS DG ORLY STX SWN ALTR RRC COG ICE MUR APH JNPR EMN PNR RF DTE GPC PAYX ABC LIFE ETR ACT FISV RL ADT FLR CLX WDC TDC HIG LTD NFLX RHT CHK BSX MAR XRX PRGO SJM EW XLNX AA CMG BF/B NE DVA KSS CCE BEAM GPS OKE WYNN PVH RSG DLTR CHRW KLAC SIAL WEC NYX DGX FIS MCO KMX DPS BWA AVP EQT KEY KIM EXPD LLTC ADSK SLM PFG SPLS CNP WHR XL WU MKC LUV LH FRX JWN CA LNC SRCL WYN NI COL TXT FMC WAT MU FFIV AEE FLS NVDA CNX PCL TIF BCR NRG TSO VAR MNST PLL CSC CBG LLL CFN MCHP HP VRSN MAS DNR VMC CPB BLL PETM NWL ARG PHM LRCX AES TSN AKAM HRB CMS TAP UNM JOY CMA DHI LEN EFX STZ CINF BTU JEC SCG MWV CVH PWR XRAY HBAN IFF EXPE PNW DRI IRM FOSL BMC IPG HRS SNI LUK FDO TMK QEP XYL WIN DO EA NBR RHI SWY TRIP HRL HSP CTAS HAS GAS GCI SNA POM URBN BBY PBCT ZION GNW RDC TEG LEG IGT OI GRMN THC AIV HCBK CLF FTR ANF FLIR AVY LSI PKI MOLX BMS SEE TSS JBL NFX DNB NDAQ ATI JDSU SAI GT TE X AIZ PCS CVC TER LM PDCO GME DF HAR WPX R ETFC JCP PBI FHN FSLR APOL WPO AN AMD -------------------------------------------------------------------------------- /databases/user_lists.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/databases/user_lists.db -------------------------------------------------------------------------------- /resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/.DS_Store -------------------------------------------------------------------------------- /resources/commons-io-2.4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/.DS_Store -------------------------------------------------------------------------------- /resources/commons-io-2.4/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons IO 2 | Copyright 2002-2012 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/RELEASE-NOTES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/RELEASE-NOTES.txt -------------------------------------------------------------------------------- /resources/commons-io-2.4/commons-io-2.4-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/commons-io-2.4-javadoc.jar -------------------------------------------------------------------------------- /resources/commons-io-2.4/commons-io-2.4-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/commons-io-2.4-sources.jar -------------------------------------------------------------------------------- /resources/commons-io-2.4/commons-io-2.4-test-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/commons-io-2.4-test-sources.jar -------------------------------------------------------------------------------- /resources/commons-io-2.4/commons-io-2.4-tests.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/commons-io-2.4-tests.jar -------------------------------------------------------------------------------- /resources/commons-io-2.4/commons-io-2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/commons-io-2.4.jar -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Commons IO 2.4 API 9 | 10 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | <H2> 32 | Frame Alert</H2> 33 | 34 | <P> 35 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 36 | <BR> 37 | Link to<A HREF="overview-summary.html">Non-frame version.</A> 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/Charsets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.Charsets (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.Charsets

86 |
87 | No usage of org.apache.commons.io.Charsets 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/CopyUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.CopyUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.CopyUtils

86 |
87 | No usage of org.apache.commons.io.CopyUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/DirectoryWalker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.DirectoryWalker (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.DirectoryWalker

86 |
87 | No usage of org.apache.commons.io.DirectoryWalker 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/EndianUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.EndianUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.EndianUtils

86 |
87 | No usage of org.apache.commons.io.EndianUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/FileCleaner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.FileCleaner (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.FileCleaner

86 |
87 | No usage of org.apache.commons.io.FileCleaner 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/FileExistsException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.FileExistsException (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.FileExistsException

86 |
87 | No usage of org.apache.commons.io.FileExistsException 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/FileSystemUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.FileSystemUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.FileSystemUtils

86 |
87 | No usage of org.apache.commons.io.FileSystemUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/FileUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.FileUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.FileUtils

86 |
87 | No usage of org.apache.commons.io.FileUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/FilenameUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.FilenameUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.FilenameUtils

86 |
87 | No usage of org.apache.commons.io.FilenameUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/HexDump.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.HexDump (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.HexDump

86 |
87 | No usage of org.apache.commons.io.HexDump 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/IOUtils.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.IOUtils (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.IOUtils

86 |
87 | No usage of org.apache.commons.io.IOUtils 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/class-use/TaggedIOException.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.TaggedIOException (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.TaggedIOException

86 |
87 | No usage of org.apache.commons.io.TaggedIOException 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/comparator/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io.comparator (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io.comparator 21 | 22 | 23 | 42 | 43 |
24 | Classes  25 | 26 |
27 | CompositeFileComparator 28 |
29 | DefaultFileComparator 30 |
31 | DirectoryFileComparator 32 |
33 | ExtensionFileComparator 34 |
35 | LastModifiedFileComparator 36 |
37 | NameFileComparator 38 |
39 | PathFileComparator 40 |
41 | SizeFileComparator
44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/comparator/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Package org.apache.commons.io.comparator (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Package
org.apache.commons.io.comparator

86 |
87 | No usage of org.apache.commons.io.comparator 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/filefilter/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io.filefilter (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io.filefilter 21 | 22 | 23 | 30 | 31 |
24 | Interfaces  25 | 26 |
27 | ConditionalFileFilter 28 |
29 | IOFileFilter
32 | 33 | 34 | 35 | 36 | 85 | 86 |
37 | Classes  38 | 39 |
40 | AbstractFileFilter 41 |
42 | AgeFileFilter 43 |
44 | AndFileFilter 45 |
46 | CanReadFileFilter 47 |
48 | CanWriteFileFilter 49 |
50 | DelegateFileFilter 51 |
52 | DirectoryFileFilter 53 |
54 | EmptyFileFilter 55 |
56 | FalseFileFilter 57 |
58 | FileFileFilter 59 |
60 | FileFilterUtils 61 |
62 | HiddenFileFilter 63 |
64 | MagicNumberFileFilter 65 |
66 | NameFileFilter 67 |
68 | NotFileFilter 69 |
70 | OrFileFilter 71 |
72 | PrefixFileFilter 73 |
74 | RegexFileFilter 75 |
76 | SizeFileFilter 77 |
78 | SuffixFileFilter 79 |
80 | TrueFileFilter 81 |
82 | WildcardFileFilter 83 |
84 | WildcardFilter
87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/BOMInputStream.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.BOMInputStream (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.BOMInputStream

86 |
87 | No usage of org.apache.commons.io.input.BOMInputStream 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/DemuxInputStream.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.DemuxInputStream (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.DemuxInputStream

86 |
87 | No usage of org.apache.commons.io.input.DemuxInputStream 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/NullInputStream.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.NullInputStream (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.NullInputStream

86 |
87 | No usage of org.apache.commons.io.input.NullInputStream 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/NullReader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.NullReader (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.NullReader

86 |
87 | No usage of org.apache.commons.io.input.NullReader 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/ProxyReader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.ProxyReader (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.ProxyReader

86 |
87 | No usage of org.apache.commons.io.input.ProxyReader 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/TeeInputStream.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.TeeInputStream (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.TeeInputStream

86 |
87 | No usage of org.apache.commons.io.input.TeeInputStream 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/class-use/XmlStreamReader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.input.XmlStreamReader (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.input.XmlStreamReader

86 |
87 | No usage of org.apache.commons.io.input.XmlStreamReader 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/input/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io.input (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io.input 21 | 22 | 23 | 28 | 29 |
24 | Interfaces  25 | 26 |
27 | TailerListener
30 | 31 | 32 | 33 | 34 | 83 | 84 |
35 | Classes  36 | 37 |
38 | AutoCloseInputStream 39 |
40 | BOMInputStream 41 |
42 | BoundedInputStream 43 |
44 | BrokenInputStream 45 |
46 | CharSequenceInputStream 47 |
48 | CharSequenceReader 49 |
50 | ClassLoaderObjectInputStream 51 |
52 | ClosedInputStream 53 |
54 | CloseShieldInputStream 55 |
56 | CountingInputStream 57 |
58 | DemuxInputStream 59 |
60 | NullInputStream 61 |
62 | NullReader 63 |
64 | ProxyInputStream 65 |
66 | ProxyReader 67 |
68 | ReaderInputStream 69 |
70 | ReversedLinesFileReader 71 |
72 | SwappedDataInputStream 73 |
74 | TaggedInputStream 75 |
76 | Tailer 77 |
78 | TailerListenerAdapter 79 |
80 | TeeInputStream 81 |
82 | XmlStreamReader
85 | 86 | 87 | 88 | 89 | 94 | 95 |
90 | Exceptions  91 | 92 |
93 | XmlStreamReaderException
96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/monitor/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io.monitor (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io.monitor 21 | 22 | 23 | 28 | 29 |
24 | Interfaces  25 | 26 |
27 | FileAlterationListener
30 | 31 | 32 | 33 | 34 | 45 | 46 |
35 | Classes  36 | 37 |
38 | FileAlterationListenerAdaptor 39 |
40 | FileAlterationMonitor 41 |
42 | FileAlterationObserver 43 |
44 | FileEntry
47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/output/class-use/ProxyWriter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Uses of Class org.apache.commons.io.output.ProxyWriter (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 52 | 55 | 56 | 57 | 58 | 61 | 77 | 78 |
53 | 54 |
79 | 80 | 81 | 82 |
83 |
84 |

85 | Uses of Class
org.apache.commons.io.output.ProxyWriter

86 |
87 | No usage of org.apache.commons.io.output.ProxyWriter 88 |

89 |


90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 112 | 115 | 116 | 117 | 118 | 121 | 137 | 138 |
113 | 114 |
139 | 140 | 141 | 142 |
143 | Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved. 144 | 145 | 146 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/output/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io.output (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io.output 21 | 22 | 23 | 64 | 65 |
24 | Classes  25 | 26 |
27 | BrokenOutputStream 28 |
29 | ByteArrayOutputStream 30 |
31 | ClosedOutputStream 32 |
33 | CloseShieldOutputStream 34 |
35 | CountingOutputStream 36 |
37 | DeferredFileOutputStream 38 |
39 | DemuxOutputStream 40 |
41 | FileWriterWithEncoding 42 |
43 | LockableFileWriter 44 |
45 | NullOutputStream 46 |
47 | NullWriter 48 |
49 | ProxyOutputStream 50 |
51 | ProxyWriter 52 |
53 | StringBuilderWriter 54 |
55 | TaggedOutputStream 56 |
57 | TeeOutputStream 58 |
59 | ThresholdingOutputStream 60 |
61 | WriterOutputStream 62 |
63 | XmlStreamWriter
66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/org/apache/commons/io/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.commons.io (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | org.apache.commons.io 21 | 22 | 23 | 56 | 57 |
24 | Classes  25 | 26 |
27 | ByteOrderMark 28 |
29 | Charsets 30 |
31 | CopyUtils 32 |
33 | DirectoryWalker 34 |
35 | EndianUtils 36 |
37 | FileCleaner 38 |
39 | FileCleaningTracker 40 |
41 | FileDeleteStrategy 42 |
43 | FilenameUtils 44 |
45 | FileSystemUtils 46 |
47 | FileUtils 48 |
49 | HexDump 50 |
51 | IOCase 52 |
53 | IOUtils 54 |
55 | LineIterator
58 | 59 | 60 | 61 | 62 | 73 | 74 |
63 | Exceptions  64 | 65 |
66 | DirectoryWalker.CancelException 67 |
68 | FileExistsException 69 |
70 | IOExceptionWithCause 71 |
72 | TaggedIOException
75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Overview List (Commons IO 2.4 API) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 |
23 |
26 | 27 | 28 | 29 | 47 | 48 |
All Classes 30 |

31 | 32 | Packages 33 |
34 | org.apache.commons.io 35 |
36 | org.apache.commons.io.comparator 37 |
38 | org.apache.commons.io.filefilter 39 |
40 | org.apache.commons.io.input 41 |
42 | org.apache.commons.io.monitor 43 |
44 | org.apache.commons.io.output 45 |
46 |

49 | 50 |

51 |   52 | 53 | 54 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/package-list: -------------------------------------------------------------------------------- 1 | org.apache.commons.io 2 | org.apache.commons.io.comparator 3 | org.apache.commons.io.filefilter 4 | org.apache.commons.io.input 5 | org.apache.commons.io.monitor 6 | org.apache.commons.io.output 7 | -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/resources/inherit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/commons-io-2.4/docs/resources/inherit.gif -------------------------------------------------------------------------------- /resources/commons-io-2.4/docs/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | 3 | /* Define colors, fonts and other style attributes here to override the defaults */ 4 | 5 | /* Page background color */ 6 | body { background-color: #FFFFFF; color:#000000 } 7 | 8 | /* Headings */ 9 | h1 { font-size: 145% } 10 | 11 | /* Table colors */ 12 | .TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ 13 | .TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ 14 | .TableRowColor { background: #FFFFFF; color:#000000 } /* White */ 15 | 16 | /* Font used in left-hand frame lists */ 17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 20 | 21 | /* Navigation bar fonts and colors */ 22 | .NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ 23 | .NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ 24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} 25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} 26 | 27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 29 | 30 | -------------------------------------------------------------------------------- /resources/jcommon-1.0.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/jcommon-1.0.16.jar -------------------------------------------------------------------------------- /resources/jfreechart-1.0.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/jfreechart-1.0.13.jar -------------------------------------------------------------------------------- /resources/sqlite-jdbc-3.7.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/resources/sqlite-jdbc-3.7.2.jar -------------------------------------------------------------------------------- /src/QuantTrader.java: -------------------------------------------------------------------------------- 1 | // 2 | // DataFeeder.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | 9 | import com.qt.MainSystem; 10 | 11 | public class QuantTrader { 12 | public static void main(String[] args) { 13 | // TODO Auto-generated method stub 14 | MainSystem.init(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robgraeber/quant-trader/56733cba58c626dcaad4bddc2ed257521931b911/src/com/.DS_Store -------------------------------------------------------------------------------- /src/com/effing/toolkit/Math2.java: -------------------------------------------------------------------------------- 1 | package com.effing.toolkit; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | public final class Math2 { 7 | public static double getMean(List values) { 8 | double mean = 0.0; 9 | if ((values != null) && (values.size() > 0)) { 10 | for (double value : values) { 11 | mean += value; 12 | } 13 | mean /= values.size(); 14 | } 15 | return mean; 16 | } 17 | 18 | public static double getStandardDeviation(List values) { 19 | double deviation = 0.0; 20 | if ((values != null) && (values.size() > 1)) { 21 | double mean = getMean(values); 22 | for (double value : values) { 23 | double delta = value-mean; 24 | deviation += delta*delta; 25 | } 26 | deviation = Math.sqrt(deviation/values.size()); 27 | } 28 | return deviation; 29 | } 30 | 31 | public static double getMedian(List values) { 32 | double median = 0.0; 33 | if (values != null) { 34 | int numValues = values.size(); 35 | if (numValues > 0) { 36 | Collections.sort(values); 37 | if ((numValues%2) == 0) { 38 | median = (values.get((numValues/2)-1)+values.get(numValues/2))/2.0; 39 | } else { 40 | median = values.get(numValues/2); 41 | } 42 | } 43 | } 44 | return median; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/effing/toolkit/Util2.java: -------------------------------------------------------------------------------- 1 | //Attribution: Mohamed Mansour, Dave Dopson 2 | //http://stackoverflow.com/questions/5125242/list-only-subdirectory-from-directory-not-files 3 | //https://github.com/ddopson/java-class-enumerator 4 | package com.effing.toolkit; 5 | 6 | import java.io.File; 7 | import java.io.FilenameFilter; 8 | import java.io.IOException; 9 | import java.net.URISyntaxException; 10 | import java.net.URL; 11 | import java.util.ArrayList; 12 | import java.util.Arrays; 13 | import java.util.Enumeration; 14 | import java.util.List; 15 | import java.util.jar.JarEntry; 16 | import java.util.jar.JarFile; 17 | 18 | //Random utility functions 19 | public final class Util2 { 20 | //checks for string equality, ignores case 21 | public static boolean arrayContainsString(List array, String str){ 22 | for(String str2 : array){ 23 | if(str2.equalsIgnoreCase(str)){ 24 | return true; 25 | } 26 | } 27 | return false; 28 | } 29 | public static String uppercaseFirstLetter(String str){ 30 | return Character.toUpperCase(str.charAt(0)) + str.substring(1); 31 | } 32 | public static void trimArray(List array, int maxLength){ 33 | if(array.size() <= maxLength){ 34 | return; 35 | } 36 | for(int i = array.size()-1; i>=0; i--){ 37 | if(i >= maxLength){ 38 | array.remove(i); 39 | } 40 | } 41 | } 42 | //Finds all subdirectories in a directory 43 | public static List getAllSubDirectories(String path){ 44 | File file = new File(path); 45 | String[] directories = file.list(new FilenameFilter() { 46 | public boolean accept(File current, String name) { 47 | return new File(current, name).isDirectory(); 48 | } 49 | }); 50 | //System.out.println(Arrays.asList(directories)); 51 | return new ArrayList(Arrays.asList(directories)); 52 | } 53 | //Finds all classes in a package/directory 54 | public static ArrayList> getClassesForPackage(String pkgname) { 55 | ArrayList> classes = new ArrayList>(); 56 | // Get a File object for the package 57 | File directory = null; 58 | String fullPath; 59 | String relPath = pkgname.replace('.', '/'); 60 | //System.out.println("ClassDiscovery: Package: " + pkgname + " becomes Path:" + relPath); 61 | URL resource = ClassLoader.getSystemClassLoader().getResource(relPath); 62 | //System.out.println("ClassDiscovery: Resource = " + resource); 63 | if (resource == null) { 64 | throw new RuntimeException("No resource for " + relPath); 65 | } 66 | fullPath = resource.getFile(); 67 | //System.out.println("ClassDiscovery: FullPath = " + resource); 68 | 69 | try { 70 | directory = new File(resource.toURI()); 71 | } catch (URISyntaxException e) { 72 | throw new RuntimeException(pkgname + " (" + resource + ") does not appear to be a valid URL / URI. Strange, since we got it from the system...", e); 73 | } catch (IllegalArgumentException e) { 74 | directory = null; 75 | } 76 | //System.out.println("ClassDiscovery: Directory = " + directory); 77 | 78 | if (directory != null && directory.exists()) { 79 | // Get the list of the files contained in the package 80 | String[] files = directory.list(); 81 | for (int i = 0; i < files.length; i++) { 82 | // we are only interested in .class files 83 | if (files[i].endsWith(".class") && files[i].indexOf("$") == -1) { 84 | // removes the .class extension 85 | String className = pkgname + '.' + files[i].substring(0, files[i].length() - 6); 86 | //System.out.println("ClassDiscovery: className = " + className); 87 | try { 88 | classes.add(Class.forName(className)); 89 | } 90 | catch (ClassNotFoundException e) { 91 | throw new RuntimeException("ClassNotFoundException loading " + className); 92 | } 93 | } 94 | } 95 | } 96 | else { 97 | try { 98 | String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); 99 | JarFile jarFile = new JarFile(jarPath); 100 | Enumeration entries = jarFile.entries(); 101 | while(entries.hasMoreElements()) { 102 | JarEntry entry = entries.nextElement(); 103 | String entryName = entry.getName(); 104 | if(entryName.startsWith(relPath) && entryName.length() > (relPath.length() + "/".length())) { 105 | System.out.println("ClassDiscovery: JarEntry: " + entryName); 106 | String className = entryName.replace('/', '.').replace('\\', '.').replace(".class", ""); 107 | System.out.println("ClassDiscovery: className = " + className); 108 | try { 109 | classes.add(Class.forName(className)); 110 | } 111 | catch (ClassNotFoundException e) { 112 | throw new RuntimeException("ClassNotFoundException loading " + className); 113 | } 114 | } 115 | } 116 | } catch (IOException e) { 117 | throw new RuntimeException(pkgname + " (" + directory + ") does not appear to be a valid package", e); 118 | } 119 | } 120 | return classes; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/com/qt/MainSystem.java: -------------------------------------------------------------------------------- 1 | // 2 | // MainSystem.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt; 9 | 10 | import java.io.BufferedReader; 11 | import java.io.IOException; 12 | import java.io.InputStreamReader; 13 | import java.util.ArrayList; 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | import com.effing.toolkit.Util2; 18 | 19 | //The central class that handles the console + loops through all the algorithms 20 | public class MainSystem { 21 | private static Boolean initialized = false; 22 | private static List moduleArray = new ArrayList(); 23 | //Initializer that starts the console loop and loads the modules 24 | public static void init(){ 25 | if(!initialized){ 26 | initialized = true; 27 | }else{ 28 | return; 29 | } 30 | System.out.println("Activating QuantTrader v1.02 -- Backtest Mode"); 31 | System.out.println("Warming up.. This may take a while"); 32 | System.out.println("Searching for Modules.."); 33 | for(String moduleName:Util2.getAllSubDirectories("src/com/qt/modules/")){ 34 | for(Class moduleClass:Util2.getClassesForPackage("com.qt.modules."+moduleName)){ 35 | try { 36 | if(Module.class.isAssignableFrom(moduleClass)){ 37 | Module module = (Module)moduleClass.newInstance(); 38 | moduleArray.add(module); 39 | System.out.println("Loading "+Util2.uppercaseFirstLetter(module.name)+" Module.. Success!"); 40 | } 41 | } catch (InstantiationException e) { 42 | // TODO Auto-generated catch block 43 | e.printStackTrace(); 44 | } catch (IllegalAccessException e) { 45 | // TODO Auto-generated catch block 46 | e.printStackTrace(); 47 | } 48 | 49 | } 50 | } 51 | inputPrompt(); 52 | } 53 | 54 | //the main console loop 55 | //most commands for the backtest and database module are case insensitive 56 | private static void inputPrompt(){ 57 | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); 58 | try { 59 | //System.out.println(""); 60 | System.out.println("What do you want to do now?"); 61 | String line = bufferedReader.readLine(); 62 | boolean matchFound = false; 63 | for(Module module:moduleArray){ 64 | if(line.matches(module.triggerWord+" (.*?)")){ 65 | String[] textInputs = line.split(" "); 66 | List parameters = new ArrayList(Arrays.asList(textInputs)); 67 | for(String str:parameters){ 68 | str.trim(); 69 | } 70 | parameters.remove(0); //removes trigger word 71 | module.activate(parameters); 72 | matchFound = true; 73 | break; 74 | }else if(line.matches("^"+module.triggerWord+"$")){ 75 | System.out.println(usageTextForModule(module)); //help text 76 | matchFound = true; 77 | break; 78 | } 79 | } 80 | if(line.equalsIgnoreCase("quit")||line.equalsIgnoreCase("exit")){ 81 | System.exit(0); 82 | }else if(!matchFound || line.equalsIgnoreCase("help")){ 83 | for(Module module:moduleArray){ 84 | System.out.println(usageTextForModule(module)); //help text 85 | } 86 | } 87 | } catch (IOException e) { 88 | e.printStackTrace(); 89 | } 90 | inputPrompt(); 91 | } 92 | //help text 93 | private static String usageTextForModule(Module module){ 94 | return Util2.uppercaseFirstLetter(module.name)+" Usage: "+module.helpText; 95 | } 96 | 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/com/qt/Module.java: -------------------------------------------------------------------------------- 1 | package com.qt; 2 | 3 | import java.util.List; 4 | //DataTrader uses a very flexible module system, 5 | //that automatically searches for modules in the modules namespace 6 | //Basically the main system just routes and feeds parameters to the modules 7 | //How the module itself is structured is unchecked 8 | public abstract class Module { 9 | public String name = "Module"; 10 | public String triggerWord = "aaa123"; 11 | public String helpText = "module "; 12 | public abstract void activate(List parameters); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/com/qt/classes/Asset.java: -------------------------------------------------------------------------------- 1 | // 2 | // StockAsset.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 16, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.classes; 9 | 10 | import com.qt.StockDatabase; 11 | 12 | 13 | //Asset represents the asset holding of a portfolio, basically a stock, quantity, and average cost for tracking purposes 14 | public class Asset { 15 | public String symbol; 16 | public int quantity; 17 | public double averageCost; 18 | public Stock stock; 19 | public Asset(String symbol, int quantity){ 20 | this.symbol = symbol; 21 | this.quantity = quantity; 22 | this.averageCost = 0; 23 | this.stock = StockDatabase.getStock(symbol); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/qt/classes/Order.java: -------------------------------------------------------------------------------- 1 | // 2 | // StockOrder.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 16, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.classes; 9 | 10 | 11 | //An order initiated by an algorithm and carried out by the order manager 12 | //Adjust commission and slippage values in order manager 13 | public class Order { 14 | public enum OrderType {BUY_AT_CLOSE, BUY_AT_OPEN, SELL_AT_CLOSE, SELL_AT_OPEN, SHORT_AT_OPEN, SHORT_AT_CLOSE}; 15 | 16 | public OrderType orderType; 17 | public String symbol; 18 | public int quantity; 19 | public int timeDelay; 20 | public Portfolio portfolio; 21 | public boolean isCommissionAndSlippageEnabled; 22 | 23 | public Order(OrderType orderType, String symbol, int quantity, Portfolio portfolio, int timeDelay, boolean isCommissionAndSlippageEnabled){ 24 | this.orderType = orderType; 25 | this.symbol = symbol; 26 | this.quantity = quantity; 27 | this.portfolio = portfolio; 28 | this.timeDelay = timeDelay; 29 | this.isCommissionAndSlippageEnabled = isCommissionAndSlippageEnabled; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/qt/classes/Portfolio.java: -------------------------------------------------------------------------------- 1 | package com.qt.classes; 2 | 3 | import java.util.ArrayList; 4 | // 5 | // Portfolio.java 6 | // DataTrader 7 | // 8 | // Created by Rob Graeber on Nov 3, 2012. 9 | // Copyright 2012 Rob Graeber. All rights reserved. 10 | // 11 | import java.util.List; 12 | 13 | import com.qt.StockDatabase; 14 | 15 | //Holds all the stock/assets and tracks algorithm results 16 | public class Portfolio { 17 | private static ArrayList portfolioArray = new ArrayList(); 18 | public double avaliableFunds = 100000; 19 | public double initialFunds = 100000; 20 | private List assetArray = new ArrayList(); 21 | 22 | public static Portfolio getNewPortfolio(double initialFunds){ 23 | 24 | Portfolio portfolio = new Portfolio(); 25 | portfolio.avaliableFunds = initialFunds; 26 | portfolio.initialFunds = initialFunds; 27 | portfolioArray.add(portfolio); 28 | return portfolio; 29 | } 30 | public void resetMe(){ 31 | this.avaliableFunds = this.initialFunds; 32 | assetArray = new ArrayList(); 33 | } 34 | public void resetMe(double initialFunds){ 35 | this.initialFunds = initialFunds; 36 | resetMe(); 37 | } 38 | 39 | public List getAssetArray(){ 40 | return assetArray; 41 | } 42 | public Asset getAsset(String symbol){ 43 | for(Asset asset : assetArray){ 44 | if (asset.symbol.equalsIgnoreCase(symbol)){ 45 | return asset; 46 | } 47 | } 48 | return new Asset("ASDF", 0); 49 | } 50 | public double getTotalValue(){ 51 | double totalValue = avaliableFunds; 52 | for(Asset asset:assetArray){ 53 | Stock stock = StockDatabase.getStock(asset.symbol); 54 | totalValue += stock.getClose() * asset.quantity; 55 | } 56 | return totalValue; 57 | } 58 | public void addAsset(String symbol, int quantity, double cost){ 59 | if(findSymbol(symbol) != null){ 60 | Asset asset = findSymbol(symbol); 61 | double currentCost = asset.quantity * asset.averageCost; 62 | currentCost += cost * quantity; 63 | asset.quantity += quantity; 64 | currentCost /= asset.quantity; 65 | asset.averageCost = currentCost; 66 | }else{ 67 | assetArray.add(new Asset(symbol, quantity)); 68 | findSymbol(symbol).averageCost = cost; 69 | } 70 | } 71 | public void removeAsset(String symbol, int quantity){ 72 | if(findSymbol(symbol) != null){ 73 | findSymbol(symbol).quantity -= quantity; 74 | if(findSymbol(symbol).quantity == 0){ 75 | assetArray.remove(findSymbol(symbol)); 76 | } 77 | }else{ 78 | System.out.println("Unable to remove asset -- Asset not found!"); 79 | } 80 | } 81 | public boolean containsSymbol(String symbol){ 82 | return getSymbolQuantity(symbol) != 0; 83 | } 84 | public int getSymbolQuantity(String symbol){ 85 | int quantity = 0; 86 | for(Asset asset:getAssetArray()){ 87 | if (asset.symbol.equalsIgnoreCase(symbol)){ 88 | quantity = asset.quantity; 89 | } 90 | } 91 | return quantity; 92 | } 93 | public Asset findSymbol(String symbol){ 94 | for(Asset asset:getAssetArray()){ 95 | if (asset.symbol.equalsIgnoreCase(symbol)){ 96 | return asset; 97 | } 98 | } 99 | return null; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/com/qt/classes/Stock.java: -------------------------------------------------------------------------------- 1 | // 2 | // Stock.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.classes; 9 | 10 | import java.util.Date; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import com.effing.toolkit.Math2; 15 | 16 | //The objects that holds massive array loaded from the database. 17 | //Has a bunch of price, volume, MA, etc, getters. 18 | public class Stock { 19 | //The day/tick all the stocks are on 20 | //Corresponds to rows in a database 21 | public static int currentId = 0; 22 | //Adjusts if stock is listed later than start date 23 | //Assumes that no stocks in data get delisted (yahoo finance doesn't include delisted stocks) 24 | public static int lengthTarget = 0; 25 | public String symbol; 26 | private List closeArray = new ArrayList(); 27 | private List openArray = new ArrayList(); 28 | private List highArray = new ArrayList(); 29 | private List lowArray = new ArrayList(); 30 | private List volumeArray = new ArrayList(); 31 | public List dateArray = new ArrayList(); 32 | public Stock(String theSymbol){ 33 | symbol = theSymbol; 34 | } 35 | public int getArraySize(){ 36 | return closeArray.size(); 37 | } 38 | public void addData(double open, double high, double low, double close, double volume, Date date){ 39 | openArray.add(new Double(open)); 40 | highArray.add(new Double(high)); 41 | lowArray.add(new Double(low)); 42 | closeArray.add(new Double(close)); 43 | volumeArray.add(new Double(volume)); 44 | dateArray.add(date); 45 | } 46 | public double getMinimumVolume(int overHowManyDays){ 47 | return getMinimumVolume(overHowManyDays, 0); 48 | } 49 | public double getMinimumVolume(int overHowManyDays, int daysAgo){ 50 | double minimumVolume = 10000000000.0; 51 | for (int i = 0; i volume){ 54 | minimumVolume = volume; 55 | } 56 | } 57 | return minimumVolume; 58 | } 59 | public double getAverageVolume(int overHowManyDays){ 60 | return getAverageVolume(overHowManyDays, 0); 61 | } 62 | public double getAverageVolume(int overHowManyDays, int daysAgo){ 63 | List volumeList = new ArrayList(); 64 | for (int i = 0; i= 0.0){ 67 | volumeList.add(volume); 68 | }else{ 69 | return -1.0;//before data start 70 | } 71 | } 72 | return Math2.getMean(volumeList); 73 | } 74 | //Moving standard deviation of close to close change, not the total change of the time period 75 | public double getMovingSD(int overHowManyDays){ 76 | return getMovingSD(overHowManyDays, 0); 77 | } 78 | public double getMovingSD(int overHowManyDays, int daysAgo){ 79 | List changeList = new ArrayList(); 80 | for (int i = 0; i closeArray = new ArrayList(); 92 | for (int i = 0; i= 0.0){ 95 | closeArray.add(close); 96 | } 97 | } 98 | return Math2.getMean(closeArray); 99 | } 100 | public double getPrice(){ 101 | return getPrice(0); 102 | } 103 | public double getVolume(){ 104 | return getVolume(0); 105 | } 106 | public double getHigh(){ 107 | return getHigh(0); 108 | } 109 | public double getLow(){ 110 | return getLow(0); 111 | } 112 | public double getOpen(){ 113 | return getOpen(0); 114 | } 115 | public double getClose(){ 116 | return getClose(0); 117 | } 118 | public Date getDate(){ 119 | return getDate(0); 120 | } 121 | public Date getDate(int daysAgo){ 122 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 123 | if(targetId < 0){ 124 | return dateArray.get(0); 125 | } 126 | if (targetId > closeArray.size()-1){ 127 | return dateArray.get(dateArray.size()-1); 128 | } 129 | return dateArray.get(targetId); 130 | } 131 | public double getPrice(int daysAgo){ 132 | return getClose(daysAgo); 133 | } 134 | public double getVolume(int daysAgo){ 135 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 136 | if(targetId < 0){ 137 | return -1.0; 138 | } 139 | if (targetId > closeArray.size()-1){ 140 | return -1.0; 141 | } 142 | return volumeArray.get(targetId).doubleValue(); 143 | } 144 | public double getOpen(int daysAgo){ 145 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 146 | if(targetId < 0){ 147 | return -1.0; 148 | } 149 | if (targetId > closeArray.size()-1){ 150 | return -1.0; 151 | } 152 | return openArray.get(targetId).doubleValue(); 153 | } 154 | public double getClose(int daysAgo){ 155 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 156 | if(targetId < 0){ 157 | return -1.0; 158 | } 159 | if (targetId > closeArray.size()-1){ 160 | return -1.0; 161 | } 162 | return closeArray.get(targetId).doubleValue(); 163 | } 164 | public double getHigh(int daysAgo){ 165 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 166 | if(targetId < 0){ 167 | return -1.0; 168 | } 169 | if (targetId > closeArray.size()-1){ 170 | return -1.0; 171 | } 172 | return highArray.get(targetId).doubleValue(); 173 | } 174 | public double getLow(int daysAgo){ 175 | int targetId = Stock.currentId-daysAgo - (lengthTarget - closeArray.size()); 176 | if(targetId < 0){ 177 | return -1.0; 178 | } 179 | if (targetId > closeArray.size()-1){ 180 | return -1.0; 181 | } 182 | return lowArray.get(targetId).doubleValue(); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/Macro.java: -------------------------------------------------------------------------------- 1 | package com.qt.modules.backtest; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | 7 | 8 | //Basically these are scripts that can take parameters, unique to the backtest module 9 | //i.e. "backtest stock:AAPL script1 script2" 10 | //unlimited parameters are possible, i.e. "backtest macro1:AAPL:GOOG:IBM:5:3" 11 | public abstract class Macro extends Script { 12 | public List param = new ArrayList(); 13 | public String triggerWord = "aaa123"; //the command 14 | 15 | public abstract void handleEnterTick(); 16 | 17 | //overwrite this to change it 18 | public String getDisplayName() { 19 | if(param.size()>0){ 20 | return param.get(0).toUpperCase(); 21 | }else{ 22 | return "NULL"; 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/Script.java: -------------------------------------------------------------------------------- 1 | // 2 | // Algorithm.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest; 9 | 10 | import com.qt.classes.Portfolio; 11 | 12 | 13 | 14 | //The main backtesting algorithms 15 | //Overwrite handleEnterFrame and issue your buy/sell orders to the OrderManager 16 | public abstract class Script { 17 | private Portfolio portfolio = Portfolio.getNewPortfolio(100000000); 18 | public Script() { 19 | } 20 | 21 | //called every tick/row of the stock database, 1 tick = 1 day when using EOD data 22 | public abstract void handleEnterTick(); 23 | 24 | public Portfolio getPortfolio() { 25 | return portfolio; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/macros/ListFunction.java: -------------------------------------------------------------------------------- 1 | // 2 | // Algo1.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest.macros; 9 | import java.util.List; 10 | 11 | import com.qt.OrderManager; 12 | import com.qt.StockDatabase; 13 | import com.qt.classes.Stock; 14 | import com.qt.classes.Order.OrderType; 15 | import com.qt.modules.backtest.Macro; 16 | 17 | //Simple algorithm that tracks a user-created list, ie a benchmark 18 | //Command format: "backtest list:SP500 script1 script2" 19 | public class ListFunction extends Macro{ 20 | public ListFunction(){ 21 | this.triggerWord = "list"; 22 | } 23 | public void handleEnterTick(){ 24 | List selectedStocks = StockDatabase.getStockArray(param.get(0)); 25 | if(getPortfolio().getSymbolQuantity(selectedStocks.get(0).symbol) <= 0){ 26 | for(Stock stock : selectedStocks){ 27 | int quantity = (int) Math.floor(getPortfolio().avaliableFunds/stock.getOpen()/selectedStocks.size()); 28 | if(quantity > 0){ 29 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/macros/PairFunction.java: -------------------------------------------------------------------------------- 1 | // 2 | // Algo1.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest.macros; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | import com.effing.toolkit.Util2; 13 | import com.qt.OrderManager; 14 | import com.qt.StockDatabase; 15 | import com.qt.classes.Stock; 16 | import com.qt.classes.Order.OrderType; 17 | import com.qt.modules.backtest.Macro; 18 | 19 | //Simple algorithm that tracks a pair's relative change, buys stock1, shorts stock2 20 | //Also accepts lists and defaults to list if found, hopefully there's no collisions 21 | //Command format: "backtest pair:KO:PEP script1 script2" 22 | public class PairFunction extends Macro{ 23 | public PairFunction(){ 24 | this.triggerWord = "pair"; 25 | } 26 | public void handleEnterTick(){ 27 | List selectedStocksBuy = new ArrayList(); 28 | List selectedStocksShort = new ArrayList(); 29 | if(Util2.arrayContainsString(StockDatabase.getListNames(), param.get(0))){ 30 | selectedStocksBuy = StockDatabase.getStockArray(param.get(0)); 31 | }else{ 32 | selectedStocksBuy.add(StockDatabase.getStock(param.get(0))); 33 | } 34 | if(Util2.arrayContainsString(StockDatabase.getListNames(), param.get(1))){ 35 | selectedStocksShort = StockDatabase.getStockArray(param.get(1)); 36 | }else{ 37 | selectedStocksShort.add(StockDatabase.getStock(param.get(1))); 38 | } 39 | 40 | for(Stock stock : selectedStocksBuy){ 41 | int quantity = (int) Math.floor(getPortfolio().initialFunds/stock.getOpen()/selectedStocksBuy.size()); 42 | if(quantity > 0 && getPortfolio().getSymbolQuantity(stock.symbol) <= 0){ 43 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 44 | } 45 | } 46 | for(Stock stock : selectedStocksShort){ 47 | int quantity = (int) Math.floor(getPortfolio().initialFunds/stock.getOpen()/selectedStocksShort.size()); 48 | if(quantity > 0 && getPortfolio().getSymbolQuantity(stock.symbol) >= 0){ 49 | OrderManager.submitOrder(OrderType.SHORT_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 50 | } 51 | } 52 | } 53 | public String getDisplayName(){ 54 | return param.get(0).toUpperCase() +":"+param.get(1).toUpperCase(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/macros/StockFunction.java: -------------------------------------------------------------------------------- 1 | // 2 | // Algo1.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest.macros; 9 | import com.qt.OrderManager; 10 | import com.qt.StockDatabase; 11 | import com.qt.classes.Stock; 12 | import com.qt.classes.Order.OrderType; 13 | import com.qt.modules.backtest.Macro; 14 | 15 | //Simple algorithm that tracks a certain stock, ie a benchmark 16 | //Command format: "backtest stock:APPL script1 script2" 17 | public class StockFunction extends Macro{ 18 | public StockFunction(){ 19 | this.triggerWord = "stock"; 20 | } 21 | public void handleEnterTick(){ 22 | Stock stock = StockDatabase.getStock(param.get(0)); 23 | if(getPortfolio().getSymbolQuantity(stock.symbol) <= 0){ 24 | int quantity = (int) Math.floor(getPortfolio().avaliableFunds/stock.getOpen()); 25 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/scripts/BuyOnGap.java: -------------------------------------------------------------------------------- 1 | // 2 | // BuyOnGapAlgo.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 20, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest.scripts; 9 | import java.util.ArrayList; 10 | import java.util.Collections; 11 | import java.util.Comparator; 12 | import java.util.List; 13 | 14 | import com.effing.toolkit.Util2; 15 | import com.qt.OrderManager; 16 | import com.qt.StockDatabase; 17 | import com.qt.classes.Stock; 18 | import com.qt.classes.Order.OrderType; 19 | import com.qt.modules.backtest.Script; 20 | 21 | 22 | //Buy at the open 100 stocks within the S&P500 which have the lowest returns 23 | //from their previous day's lows to the current day's open, provided that 24 | //the gap down is greater than one standard deviation. 25 | //Exit such long positions at the day's close. 26 | //Special thanks to Ernie Chan for this strategy 27 | //Source: http://epchan.blogspot.com/2012/04/life-and-death-of-strategy.html 28 | public class BuyOnGap extends Script { 29 | 30 | public BuyOnGap() { 31 | 32 | } 33 | 34 | @Override 35 | public void handleEnterTick() { 36 | List stockArray = new ArrayList(StockDatabase.getStockArray("sp500_2010")); 37 | 38 | for(int i = stockArray.size()-1; i >= 0; i--){ 39 | Stock stock = stockArray.get(i); 40 | double returns = stock.getOpen(0) - stock.getLow(1); 41 | boolean criteria = Stock.currentId > 90 && returns < -1*stock.getMovingSD(90, 1); 42 | if(!criteria){ 43 | stockArray.remove(i); 44 | } 45 | } 46 | Collections.sort(stockArray, stockChangeComparator); 47 | Util2.trimArray(stockArray, 100); 48 | System.out.println("BuyOnGap Buys: "+stockArray.size()); 49 | double fundsPerOrder = getPortfolio().initialFunds / stockArray.size(); 50 | for(Stock stock : stockArray){ 51 | int quantity = (int) Math.floor(fundsPerOrder/stock.getOpen()); 52 | if(quantity > 0){ 53 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0, true); 54 | OrderManager.submitOrder(OrderType.SELL_AT_CLOSE, stock.symbol, quantity, getPortfolio(), 0, true); 55 | } 56 | } 57 | } 58 | 59 | //sorts a stock array to have the biggest % losers first 60 | public static Comparator stockChangeComparator = new Comparator() { 61 | 62 | public int compare(Stock stock1, Stock stock2) { 63 | double s1Gap = stock1.getOpen(0) - stock1.getLow(1); 64 | double s2Gap = stock2.getOpen(0) - stock2.getLow(1); 65 | double stock1Value = s1Gap/stock1.getClose(1); 66 | double stock2Value = s2Gap/stock2.getClose(1); 67 | 68 | if(stock1Value > stock2Value){ 69 | return 1; 70 | }else if (stock1Value < stock2Value){ 71 | return -1; 72 | }else{ 73 | return 0; 74 | } 75 | } 76 | 77 | }; 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/scripts/Example.java: -------------------------------------------------------------------------------- 1 | // 2 | // Algo1.java 3 | // DataTrader 4 | // 5 | // Created by Rob Graeber on Nov 3, 2012. 6 | // Copyright 2012 Rob Graeber. All rights reserved. 7 | // 8 | package com.qt.modules.backtest.scripts; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | import com.qt.OrderManager; 13 | import com.qt.StockDatabase; 14 | import com.qt.StockDatabase.ListType; 15 | import com.qt.classes.Stock; 16 | import com.qt.classes.Order.OrderType; 17 | import com.qt.modules.backtest.Script; 18 | 19 | //To add new algorithm for testing, see MainSystem.java->init() 20 | //Here's a sample algorithm to shows off the basic ordering structure: 21 | 22 | //handleEnterTick() is called every new tick, in this case 1 tick = 1 day 23 | //Access stocks from the StockDatabase, and Stock objects have price and volume info 24 | //Each algo has an attached portfolio accessed by getPortfolio() 25 | //Submit orders to the OrderManager, calculate on your own the quantity of shares to buy 26 | //Note: Keep in mind survivorship bias, commissions, and not using future info when crafting strategies 27 | 28 | public class Example extends Script{ 29 | public Example(){ 30 | 31 | } 32 | public void handleEnterTick(){ 33 | List selectedStocks = new ArrayList(); 34 | for (Stock stock : StockDatabase.getStockArray(ListType.SP500)){ 35 | if(stock.getClose(1)>1.0 && stock.getVolume(1)>100000){ 36 | selectedStocks.add(stock); 37 | } 38 | } 39 | double totalFundsPerDay = getPortfolio().initialFunds; 40 | double fundsPerOrder = totalFundsPerDay / selectedStocks.size(); 41 | for(Stock stock : selectedStocks){ 42 | int quantity = (int) Math.floor(fundsPerOrder/stock.getOpen()); 43 | if(quantity > 0){ 44 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 45 | OrderManager.submitOrder(OrderType.SELL_AT_CLOSE, stock.symbol, quantity, getPortfolio(), 0); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/com/qt/modules/backtest/scripts/Test.java: -------------------------------------------------------------------------------- 1 | package com.qt.modules.backtest.scripts; 2 | 3 | import com.qt.OrderManager; 4 | import com.qt.StockDatabase; 5 | import com.qt.classes.Stock; 6 | import com.qt.classes.Order.OrderType; 7 | import com.qt.modules.backtest.Script; 8 | 9 | //For testing purposes 10 | public class Test extends Script { 11 | 12 | @Override 13 | public void handleEnterTick() { 14 | Stock stock = StockDatabase.getStock("IBM"); 15 | System.out.println("Close: "+stock.getClose()); 16 | System.out.println("Price change: "+(stock.getClose()-stock.getClose(1))); 17 | System.out.println("MA 30: "+stock.getMA(30)); 18 | System.out.println("SD 5: "+stock.getMovingSD(5)); 19 | System.out.println("SD 30: "+stock.getMovingSD(30)); 20 | System.out.println("SD 90: "+stock.getMovingSD(90)); 21 | if(getPortfolio().getSymbolQuantity(stock.symbol) <= 0){ 22 | int quantity = (int) Math.floor(getPortfolio().avaliableFunds/stock.getOpen()); 23 | OrderManager.submitOrder(OrderType.BUY_AT_OPEN, stock.symbol, quantity, getPortfolio(), 0); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/com/qt/modules/database/Database.java: -------------------------------------------------------------------------------- 1 | package com.qt.modules.database; 2 | 3 | import java.util.List; 4 | 5 | import com.qt.Module; 6 | import com.qt.StockDatabase; 7 | 8 | //The core database module 9 | //Handles the user lists, downloading data from yahoo, and some wrapper functions for the StockDatabase class 10 | public class Database extends Module { 11 | public Database(){ 12 | this.name = "Database"; 13 | this.triggerWord = "database"; 14 | this.helpText = "database "; 15 | } 16 | @Override 17 | public void activate(List parameters) { 18 | // TODO Auto-generated method stub 19 | for (String parameter:parameters){ 20 | if(parameter.equalsIgnoreCase("download")){ 21 | rebuildMe(); 22 | downloadMe(); 23 | }else if(parameter.equalsIgnoreCase("rebuild")){ 24 | rebuildMe(); //rebuilds list database 25 | }else if(parameter.equalsIgnoreCase("preload")){ 26 | StockDatabase.preloadMe(); //preloads symbols in memory 27 | }else if(parameter.equalsIgnoreCase("purge")){ 28 | StockDatabase.cleanCache(); //purges symbols in memory 29 | }else if(parameter.equalsIgnoreCase("stats")){ 30 | System.out.println("Total Symbols in Database: "+StockDatabase.totalSymbolCount()); 31 | System.out.println("Total Symbols in Memory: "+StockDatabase.activeSymbolCount()); 32 | }else if(parameter.equalsIgnoreCase("lists")){ 33 | System.out.println("User Lists:"); 34 | for(String listName : StockDatabase.getListNames()){ 35 | System.out.println(listName); 36 | } 37 | System.out.println(""); 38 | } 39 | } 40 | } 41 | //Downloads all AMEX,NYSE,NASDAQ eod stock data from Yahoo and inserts into database 42 | //Rebuilds whole database each time, not the best solution but it's not that bad 43 | //Takes around 10-20 minutes, mainly to download the 7000+ stock csv's from yahoo 44 | private void downloadMe(){ 45 | StockFetcher.downloadStocks("databases/StockLists/NYSE.txt", "databases/nyse_eod.db"); 46 | StockFetcher.downloadStocks("databases/StockLists/NASDAQ.txt", "databases/nasdaq_eod.db"); 47 | StockFetcher.downloadStocks("databases/StockLists/AMEX.txt", "databases/amex_eod.db"); 48 | } 49 | //rebuilds the stock_lists.db from txt lists in resources/custom-lists/ folder 50 | private void rebuildMe(){ 51 | StockFetcher.parseListsIntoDatabase("UserLists/","databases/user_lists.db"); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/com/qt/modules/database/StockFetchTask.java: -------------------------------------------------------------------------------- 1 | package com.qt.modules.database; 2 | 3 | //Used to download multiple stock csv's in an asynchronous way 4 | public class StockFetchTask implements Runnable { 5 | 6 | private String symbol; 7 | private String databaseName; 8 | public StockFetchTask(String symbol, String databaseName) { 9 | this.symbol = symbol; 10 | this.databaseName = databaseName; 11 | } 12 | @Override 13 | public void run() { 14 | // TODO Auto-generated method stub 15 | StockFetcher.getStockCSV(symbol, databaseName); 16 | //StockFetcher.getStock(symbol, databaseName); 17 | } 18 | 19 | } 20 | --------------------------------------------------------------------------------