Python 3.5.2
Keras 2.0.6
TensorFlow 1.2
pymongo
tqdm
nltk
googletrans
brew install mongodb --with-openssl
brew services start mongodb
mongod --dbpath (Your Porject Folder)/Data/DB
When you storing stock data with mongodb mode, you may meet too many open files problem, try the following codes in command line:
sysctl -w kern.maxfiles=20480 (or whatever number you choose)
sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)
launchctl limit maxfiles 1000000 (or whatever number you choose)
brew services restart mongodb
mongodump -h localhost:27017 -d DB_STOCK -o ./
Cover stock related data fetching, storaging in either MongoDB or CSV mode (See config.ini [Setting] sector for more detail).
- Stock:(NSDQ, NYSE)-> US, (HKSE) -> HK, (SSE,SZSE) -> CHN
- Earning: US stock market earning info.
- Short: US stock market short squeeze info. (Require Multi IP Routing Support)
- News: NewsRiver
- Media: Twitter Data
** US Stock List **
DB : DB_STOCK
SHEET: SHEET_US_DAILY_LIST
ITEM : symbol, name, market_cap, sector, industry, stock_update, news_update
** US Stock Daily **
DB : DB_STOCK
SHEET: SHEET_US_DAILY_DATA
ITEM : symbol (stock symbol)
data -> [{date, open, high, low, close, adj_close, volume}]
** US Stock Earning **
DB : DB_STOCK
SHEET: SHEET_US_EARN
ITEM : symbol (date)
data -> [{date, symbol, analyist, estimate, actual, surprise}]
** US News **
DB : DB_STOCK
SHEET: SHEET_US_NEWS
ITEM : symbol, date, time, title, source, ranking, sentiment, uri, url, body_html, body_eng, body_chn
cd Source/FetchData
python Fetch_Data_Stock_US_Daily.py
Under Development...
Correlation
Company1 Company2 Correlation QQQ TQQQ 0.999 IBB BIB 0.999 INSE XBKS 0.999 JAG JPT 0.999 ACWX VXUS 0.995 IXUS ACWX 0.993 VONE SPY 0.992 IXUS VXUS 0.991 VTWO VTWV 0.988 NTB FBK 0.988 GOOG GOOGL 0.987
cd Source/StockProcessing
python Correlation_Stock_US.py
This sector is directly clone from: Link
More in mind:
- The approach use only "Adj Close" price as input, it's supposed more features combinations shall be joined to the party.
- The Trading Strategy is a little mediocre and limited, better rewrite it.
- At most only two tickers are allowed in the trading system, rewrite it.
testing output:
init cash: 100000
Columns: [AMD, NVDA, SPY, ^VIX]
Index: []
Runner: Taking action 2016-03-16 00:00:00 buy
Runner: Taking action 2016-03-17 00:00:00 buy
Runner: Taking action 2016-03-18 00:00:00 hold
......
Runner: Taking action 2017-06-12 00:00:00 buy
Runner: Taking action 2017-06-13 00:00:00 buy
Runner: Taking action 2017-06-14 00:00:00 buy
Final outcome: 121500.348294
cd Source/ReinforcementLearning
python runner.py
More AI approach will be arranged and upload ASAP