├── .gitignore ├── misc ├── outliers.png ├── which-stock.png └── overbought-oversold.png ├── output ├── download.png ├── rnn-only.png ├── stack-xgb.png ├── tesla-nes.png ├── download (1).png ├── encoder-rnn.png ├── lstm-seq2seq.png ├── stack-ensemble.png ├── arima-investing.png ├── evolution-strategy.png ├── lstm-seq2seq-attention.png ├── lstm-seq2seq-bidirectional.png └── lstm-seq2seq-bidirectional-attention.png ├── simulation ├── mcmc.png ├── monte-carlo.png └── portfolio-optimization.png ├── realtime-agent ├── agent.pkl ├── README.md ├── LYFT.csv ├── app.py ├── FSV.csv └── GWR.csv ├── output-agent ├── abcd-strategy.png ├── actor-critic.png ├── turtle-agent.png ├── neuro-evolution.png ├── q-learning-agent.png ├── actor-critic-duel.png ├── double-q-learning.png ├── curiosity-q-learning.png ├── duel-q-learning-agent.png ├── moving-average-agent.png ├── policy-gradient-agent.png ├── recurrent-q-learning.png ├── signal-rolling-agent.png ├── actor-critic-recurrent.png ├── double-duel-q-learning.png ├── duel-curiosity-q-learning.png ├── duel-recurrent-q-learning.png ├── evolution-strategy-agent.png ├── actor-critic-duel-recurrent.png ├── double-recurrent-q-learning.png ├── neuro-evolution-novelty-search.png ├── recurrent-curiosity-q-learning.png └── double-duel-recurrent-q-learning.png ├── stock-forecasting-js ├── css │ ├── xmark.gif │ └── style.css ├── screenshot │ ├── 1.png │ ├── 2.png │ ├── 3.png │ └── 4.png ├── fonts │ └── roboto │ │ ├── Roboto-Bold.woff │ │ ├── Roboto-Thin.woff │ │ ├── Roboto-Bold.woff2 │ │ ├── Roboto-Light.woff │ │ ├── Roboto-Light.woff2 │ │ ├── Roboto-Medium.woff │ │ ├── Roboto-Medium.woff2 │ │ ├── Roboto-Regular.woff │ │ ├── Roboto-Thin.woff2 │ │ └── Roboto-Regular.woff2 ├── README.md ├── index.html └── js │ └── papaparse.min.js ├── deep-learning ├── __pycache__ │ └── dnc.cpython-36.pyc ├── util.py ├── autoencoder.py ├── dnc.py └── access.py ├── dataset ├── usd-myr.csv ├── eur-myr.csv ├── oil.csv ├── GOOG.csv ├── MONDY.csv ├── FSV.csv ├── INFY.csv └── SINA.csv ├── stacking ├── model.py └── autoencoder.py ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *DS_Store 2 | *ipynb_checkpoints 3 | *__pycache__ 4 | -------------------------------------------------------------------------------- /misc/outliers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/misc/outliers.png -------------------------------------------------------------------------------- /misc/which-stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/misc/which-stock.png -------------------------------------------------------------------------------- /output/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/download.png -------------------------------------------------------------------------------- /output/rnn-only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/rnn-only.png -------------------------------------------------------------------------------- /output/stack-xgb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/stack-xgb.png -------------------------------------------------------------------------------- /output/tesla-nes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/tesla-nes.png -------------------------------------------------------------------------------- /simulation/mcmc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/simulation/mcmc.png -------------------------------------------------------------------------------- /output/download (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/download (1).png -------------------------------------------------------------------------------- /output/encoder-rnn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/encoder-rnn.png -------------------------------------------------------------------------------- /output/lstm-seq2seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/lstm-seq2seq.png -------------------------------------------------------------------------------- /output/stack-ensemble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/stack-ensemble.png -------------------------------------------------------------------------------- /realtime-agent/agent.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/realtime-agent/agent.pkl -------------------------------------------------------------------------------- /misc/overbought-oversold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/misc/overbought-oversold.png -------------------------------------------------------------------------------- /output/arima-investing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/arima-investing.png -------------------------------------------------------------------------------- /simulation/monte-carlo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/simulation/monte-carlo.png -------------------------------------------------------------------------------- /output-agent/abcd-strategy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/abcd-strategy.png -------------------------------------------------------------------------------- /output-agent/actor-critic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/actor-critic.png -------------------------------------------------------------------------------- /output-agent/turtle-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/turtle-agent.png -------------------------------------------------------------------------------- /output/evolution-strategy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/evolution-strategy.png -------------------------------------------------------------------------------- /output-agent/neuro-evolution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/neuro-evolution.png -------------------------------------------------------------------------------- /output-agent/q-learning-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/q-learning-agent.png -------------------------------------------------------------------------------- /output/lstm-seq2seq-attention.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/lstm-seq2seq-attention.png -------------------------------------------------------------------------------- /output-agent/actor-critic-duel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/actor-critic-duel.png -------------------------------------------------------------------------------- /output-agent/double-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/double-q-learning.png -------------------------------------------------------------------------------- /stock-forecasting-js/css/xmark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/css/xmark.gif -------------------------------------------------------------------------------- /output-agent/curiosity-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/curiosity-q-learning.png -------------------------------------------------------------------------------- /output-agent/duel-q-learning-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/duel-q-learning-agent.png -------------------------------------------------------------------------------- /output-agent/moving-average-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/moving-average-agent.png -------------------------------------------------------------------------------- /output-agent/policy-gradient-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/policy-gradient-agent.png -------------------------------------------------------------------------------- /output-agent/recurrent-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/recurrent-q-learning.png -------------------------------------------------------------------------------- /output-agent/signal-rolling-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/signal-rolling-agent.png -------------------------------------------------------------------------------- /output/lstm-seq2seq-bidirectional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/lstm-seq2seq-bidirectional.png -------------------------------------------------------------------------------- /simulation/portfolio-optimization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/simulation/portfolio-optimization.png -------------------------------------------------------------------------------- /stock-forecasting-js/screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/screenshot/1.png -------------------------------------------------------------------------------- /stock-forecasting-js/screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/screenshot/2.png -------------------------------------------------------------------------------- /stock-forecasting-js/screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/screenshot/3.png -------------------------------------------------------------------------------- /stock-forecasting-js/screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/screenshot/4.png -------------------------------------------------------------------------------- /output-agent/actor-critic-recurrent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/actor-critic-recurrent.png -------------------------------------------------------------------------------- /output-agent/double-duel-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/double-duel-q-learning.png -------------------------------------------------------------------------------- /output-agent/duel-curiosity-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/duel-curiosity-q-learning.png -------------------------------------------------------------------------------- /output-agent/duel-recurrent-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/duel-recurrent-q-learning.png -------------------------------------------------------------------------------- /output-agent/evolution-strategy-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/evolution-strategy-agent.png -------------------------------------------------------------------------------- /deep-learning/__pycache__/dnc.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/deep-learning/__pycache__/dnc.cpython-36.pyc -------------------------------------------------------------------------------- /output-agent/actor-critic-duel-recurrent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/actor-critic-duel-recurrent.png -------------------------------------------------------------------------------- /output-agent/double-recurrent-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/double-recurrent-q-learning.png -------------------------------------------------------------------------------- /output-agent/neuro-evolution-novelty-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/neuro-evolution-novelty-search.png -------------------------------------------------------------------------------- /output-agent/recurrent-curiosity-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/recurrent-curiosity-q-learning.png -------------------------------------------------------------------------------- /output/lstm-seq2seq-bidirectional-attention.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output/lstm-seq2seq-bidirectional-attention.png -------------------------------------------------------------------------------- /output-agent/double-duel-recurrent-q-learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/output-agent/double-duel-recurrent-q-learning.png -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /stock-forecasting-js/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/algorithmictradinglstm/Stock-Prediction-Models/HEAD/stock-forecasting-js/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /dataset/usd-myr.csv: -------------------------------------------------------------------------------- 1 | Historical USD to MYR Exchange Rates,Unnamed: 1 2 | 02-11-17,4.226 3 | 01-11-17,4.232 4 | 31-10-17,4.231 5 | 30-10-17,4.238 6 | 29-10-17,4.241 7 | 28-10-17,4.241 8 | 27-10-17,4.24 9 | 26-10-17,4.2283 10 | 25-10-17,4.233 11 | 24-10-17,4.2325 12 | 23-10-17,4.23 13 | 22-10-17,4.224 14 | 21-10-17,4.224 15 | 20-10-17,4.2245 16 | 19-10-17,4.221 17 | 18-10-17,4.21 18 | 17-10-17,4.2195 19 | 16-10-17,4.2155 20 | 15-10-17,4.22 21 | 14-10-17,4.22 22 | 13-10-17,4.2095 23 | 12-10-17,4.217 24 | 11-10-17,4.211 25 | 10-10-17,4.2215 26 | 09-10-17,4.232 27 | 08-10-17,4.236 28 | 07-10-17,4.236 29 | 06-10-17,4.2345 30 | 05-10-17,4.2295 31 | 04-10-17,4.2235 32 | -------------------------------------------------------------------------------- /dataset/eur-myr.csv: -------------------------------------------------------------------------------- 1 | Historical EUR to MYR Exchange Rates,Unnamed: 1 2 | 02-11-17,4.926 3 | 01-11-17,4.9232 4 | 31-10-17,4.9255 5 | 30-10-17,4.9239 6 | 29-10-17,4.9251 7 | 28-10-17,4.9251 8 | 27-10-17,4.9325 9 | 26-10-17,5.0033 10 | 25-10-17,4.9782 11 | 24-10-17,4.98 12 | 23-10-17,4.9788 13 | 22-10-17,4.9794 14 | 21-10-17,4.9794 15 | 20-10-17,4.9947 16 | 19-10-17,4.9835 17 | 18-10-17,4.9576 18 | 17-10-17,4.9717 19 | 16-10-17,4.9764 20 | 15-10-17,4.9899 21 | 14-10-17,4.9899 22 | 13-10-17,4.987 23 | 12-10-17,5.0071 24 | 11-10-17,4.9793 25 | 10-10-17,4.9729 26 | 09-10-17,4.9701 27 | 08-10-17,4.9701 28 | 07-10-17,4.9701 29 | 06-10-17,4.9613 30 | 05-10-17,4.9747 31 | 04-10-17,4.9776 32 | -------------------------------------------------------------------------------- /stock-forecasting-js/README.md: -------------------------------------------------------------------------------- 1 | # Stock forecasting JS 2 | 3 | LSTM Model for stock forecasting and buying simulation inside Tensorflow JS, so everyone can try! 4 | 5 | ## Stack 6 | 7 | Graphic library: [Echarts](https://ecomfe.github.io/echarts-examples/public/index.html), [D3](https://d3js.org/) 8 | 9 | CSV parsing: [Papaparse JS](https://www.papaparse.com/) 10 | 11 | Linear algebra: [numeric JS](https://github.com/sloisel/numeric), [numJS](https://github.com/cliffordwolf/NumJS), [Tensorflow JS](https://js.tensorflow.org/) 12 | 13 | ## How-to 14 | 15 | 1. Clone this folder and just open [index.html](index.html), 16 | 17 | Or, go to [huseinhouse.com/stock-forecasting-js](https://huseinhouse.com/stock-forecasting-js/)! 18 | 19 | ![alt text](screenshot/1.png) 20 | 21 | 2. Check hyper parameters you want to tune, 22 | 23 | ![alt text](screenshot/2.png) 24 | 25 | 3. You can upload any stock CSV, downloaded from Yahoo finance or any website. Any error, please open an issue. 26 | 27 | 4. Train the model and wait it's fitting! 28 | 29 | 5. After done training, it will predict where to buy and sell, 30 | 31 | ![alt text](screenshot/3.png) 32 | 33 | Comparing histogram and loss graph, 34 | 35 | ![alt text](screenshot/4.png) 36 | -------------------------------------------------------------------------------- /stacking/model.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | import numpy as np 3 | 4 | class Model: 5 | def __init__(self, learning_rate, num_layers, size, size_layer, output_size, forget_bias = 0.1): 6 | 7 | def lstm_cell(size_layer): 8 | return tf.nn.rnn_cell.LSTMCell(size_layer, state_is_tuple = False) 9 | rnn_cells = tf.nn.rnn_cell.MultiRNNCell([lstm_cell(size_layer) for _ in range(num_layers)], state_is_tuple = False) 10 | self.X = tf.placeholder(tf.float32, (None, None, size)) 11 | self.Y = tf.placeholder(tf.float32, (None, output_size)) 12 | drop = tf.contrib.rnn.DropoutWrapper(rnn_cells, output_keep_prob = forget_bias) 13 | self.hidden_layer = tf.placeholder(tf.float32, (None, num_layers * 2 * size_layer)) 14 | self.outputs, self.last_state = tf.nn.dynamic_rnn(drop, self.X, initial_state = self.hidden_layer, dtype = tf.float32) 15 | rnn_W = tf.Variable(tf.random_normal((size_layer, output_size))) 16 | rnn_B = tf.Variable(tf.random_normal([output_size])) 17 | self.logits = tf.matmul(self.outputs[-1], rnn_W) + rnn_B 18 | self.cost = tf.reduce_mean(tf.square(self.Y - self.logits)) 19 | self.optimizer = tf.train.AdamOptimizer(learning_rate).minimize(self.cost) -------------------------------------------------------------------------------- /dataset/oil.csv: -------------------------------------------------------------------------------- 1 | "Date","Price","Open","High","Low","Vol.","Change %" 2 | "Nov 02, 2017","54.27","54.26","54.39","54.22","0","0.06" 3 | "Nov 01, 2017","54.24","54.59","55.22","53.89","0","-0.26" 4 | "Oct 31, 2017","54.38","54.08","54.85","53.93","497.30K","0.42" 5 | "Oct 30, 2017","54.15","54.16","54.46","53.75","565.04K","0.46" 6 | "Oct 27, 2017","53.90","52.80","54.20","52.25","730.92K","2.39" 7 | "Oct 26, 2017","52.64","52.19","52.86","51.91","594.65K","0.88" 8 | "Oct 25, 2017","52.18","52.56","52.57","51.89","681.74K","-0.55" 9 | "Oct 24, 2017","52.47","51.89","52.62","51.55","709.55K","1.10" 10 | "Oct 23, 2017","51.90","52.07","52.30","51.68","583.56K","0.84" 11 | "Oct 20, 2017","51.47","51.42","51.73","50.70","32.96K","0.35" 12 | "Oct 19, 2017","51.29","52.05","52.17","51.07","127.41K","-1.44" 13 | "Oct 18, 2017","52.04","51.94","52.33","51.69","152.62K","0.31" 14 | "Oct 17, 2017","51.88","51.93","52.25","51.21","471.61K","0.02" 15 | "Oct 16, 2017","51.87","51.43","52.37","51.35","520.73K","0.82" 16 | "Oct 13, 2017","51.45","50.73","51.72","50.70","667.50K","1.68" 17 | "Oct 12, 2017","50.60","51.00","51.13","50.15","729.27K","-1.36" 18 | "Oct 11, 2017","51.30","50.94","51.42","50.61","651.95K","0.75" 19 | "Oct 10, 2017","50.92","49.55","51.06","49.54","664.84K","2.70" 20 | "Oct 09, 2017","49.58","49.25","49.79","49.13","505.08K","0.59" 21 | "Oct 06, 2017","49.29","50.75","50.82","49.10","743.11K","-2.95" 22 | "Oct 05, 2017","50.79","49.88","51.22","49.85","654.39K","1.62" 23 | "Oct 04, 2017","49.98","50.16","50.67","49.76","598.84K","-0.87" 24 | "Oct 03, 2017","50.42","50.59","50.73","50.14","462.74K","-0.32" 25 | "Oct 02, 2017","50.58","51.64","51.71","50.07","600.93K","-2.11" 26 | "","","","","","","" 27 | "","Highest:55.22","Lowest:49.10","Difference:6.12","Average:51.82","Change %:5.03" 28 | -------------------------------------------------------------------------------- /dataset/GOOG.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2017-10-02,959.979980,962.539978,947.840027,953.270020,953.270020,1283400 3 | 2017-10-03,954.000000,958.000000,949.140015,957.789978,957.789978,888300 4 | 2017-10-04,957.000000,960.390015,950.690002,951.679993,951.679993,952400 5 | 2017-10-05,955.489990,970.909973,955.179993,969.960022,969.960022,1213800 6 | 2017-10-06,966.700012,979.460022,963.359985,978.890015,978.890015,1173900 7 | 2017-10-09,980.000000,985.424988,976.109985,977.000000,977.000000,891400 8 | 2017-10-10,980.000000,981.570007,966.080017,972.599976,972.599976,968400 9 | 2017-10-11,973.719971,990.710022,972.250000,989.250000,989.250000,1693300 10 | 2017-10-12,987.450012,994.119995,985.000000,987.830017,987.830017,1262400 11 | 2017-10-13,992.000000,997.210022,989.000000,989.679993,989.679993,1169800 12 | 2017-10-16,992.099976,993.906982,984.000000,992.000000,992.000000,910500 13 | 2017-10-17,990.289978,996.440002,988.590027,992.179993,992.179993,1290200 14 | 2017-10-18,991.770020,996.719971,986.974976,992.809998,992.809998,1057600 15 | 2017-10-19,986.000000,988.880005,978.390015,984.450012,984.450012,1313600 16 | 2017-10-20,989.440002,991.000000,984.580017,988.200012,988.200012,1183200 17 | 2017-10-23,989.520020,989.520020,966.119995,968.450012,968.450012,1478400 18 | 2017-10-24,970.000000,972.229980,961.000000,970.539978,970.539978,1212200 19 | 2017-10-25,968.369995,976.090027,960.520020,973.330017,973.330017,1211300 20 | 2017-10-26,980.000000,987.599976,972.200012,972.559998,972.559998,2042100 21 | 2017-10-27,1009.190002,1048.390015,1008.200012,1019.270020,1019.270020,5167700 22 | 2017-10-30,1014.000000,1024.969971,1007.500000,1017.109985,1017.109985,2085100 23 | 2017-10-31,1015.219971,1024.000000,1010.419983,1016.640015,1016.640015,1330700 24 | 2017-11-01,1017.210022,1029.670044,1016.950012,1025.500000,1025.500000,1373444 25 | -------------------------------------------------------------------------------- /deep-learning/util.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """DNC util ops and modules.""" 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import numpy as np 22 | import tensorflow as tf 23 | 24 | 25 | def batch_invert_permutation(permutations): 26 | """Returns batched `tf.invert_permutation` for every row in `permutations`.""" 27 | with tf.name_scope('batch_invert_permutation', values=[permutations]): 28 | unpacked = tf.unstack(permutations) 29 | inverses = [tf.invert_permutation(permutation) for permutation in unpacked] 30 | return tf.stack(inverses) 31 | 32 | 33 | def batch_gather(values, indices): 34 | """Returns batched `tf.gather` for every row in the input.""" 35 | with tf.name_scope('batch_gather', values=[values, indices]): 36 | unpacked = zip(tf.unstack(values), tf.unstack(indices)) 37 | result = [tf.gather(value, index) for value, index in unpacked] 38 | return tf.stack(result) 39 | 40 | 41 | def one_hot(length, index): 42 | """Return an nd array of given `length` filled with 0s and a 1 at `index`.""" 43 | result = np.zeros(length) 44 | result[index] = 1 45 | return result 46 | -------------------------------------------------------------------------------- /stacking/autoencoder.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | import numpy as np 3 | import time 4 | 5 | def reducedimension(input_, dimension = 2, learning_rate = 0.01, hidden_layer = 256, epoch = 20): 6 | 7 | input_size = input_.shape[1] 8 | X = tf.placeholder("float", [None, input_size]) 9 | 10 | weights = { 11 | 'encoder_h1': tf.Variable(tf.random_normal([input_size, hidden_layer])), 12 | 'encoder_h2': tf.Variable(tf.random_normal([hidden_layer, dimension])), 13 | 'decoder_h1': tf.Variable(tf.random_normal([dimension, hidden_layer])), 14 | 'decoder_h2': tf.Variable(tf.random_normal([hidden_layer, input_size])), 15 | } 16 | 17 | biases = { 18 | 'encoder_b1': tf.Variable(tf.random_normal([hidden_layer])), 19 | 'encoder_b2': tf.Variable(tf.random_normal([dimension])), 20 | 'decoder_b1': tf.Variable(tf.random_normal([hidden_layer])), 21 | 'decoder_b2': tf.Variable(tf.random_normal([input_size])), 22 | } 23 | 24 | first_layer_encoder = tf.nn.sigmoid(tf.add(tf.matmul(X, weights['encoder_h1']), biases['encoder_b1'])) 25 | second_layer_encoder = tf.nn.sigmoid(tf.add(tf.matmul(first_layer_encoder, weights['encoder_h2']), biases['encoder_b2'])) 26 | first_layer_decoder = tf.nn.sigmoid(tf.add(tf.matmul(second_layer_encoder, weights['decoder_h1']), biases['decoder_b1'])) 27 | second_layer_decoder = tf.nn.sigmoid(tf.add(tf.matmul(first_layer_decoder, weights['decoder_h2']), biases['decoder_b2'])) 28 | cost = tf.reduce_mean(tf.pow(X - second_layer_decoder, 2)) 29 | optimizer = tf.train.RMSPropOptimizer(learning_rate).minimize(cost) 30 | sess = tf.InteractiveSession() 31 | sess.run(tf.global_variables_initializer()) 32 | 33 | for i in range(epoch): 34 | last_time = time.time() 35 | _, loss = sess.run([optimizer, cost], feed_dict={X: input_}) 36 | if (i + 1) % 10 == 0: 37 | print('epoch:', i + 1, 'loss:', loss, 'time:', time.time() - last_time) 38 | 39 | vectors = sess.run(second_layer_encoder, feed_dict={X: input_}) 40 | tf.reset_default_graph() 41 | return vectors -------------------------------------------------------------------------------- /deep-learning/autoencoder.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | import numpy as np 3 | import time 4 | 5 | def reducedimension(input_, dimension = 2, learning_rate = 0.01, hidden_layer = 256, epoch = 20): 6 | 7 | input_size = input_.shape[1] 8 | X = tf.placeholder("float", [None, input_size]) 9 | 10 | weights = { 11 | 'encoder_h1': tf.Variable(tf.random_normal([input_size, hidden_layer])), 12 | 'encoder_h2': tf.Variable(tf.random_normal([hidden_layer, dimension])), 13 | 'decoder_h1': tf.Variable(tf.random_normal([dimension, hidden_layer])), 14 | 'decoder_h2': tf.Variable(tf.random_normal([hidden_layer, input_size])), 15 | } 16 | 17 | biases = { 18 | 'encoder_b1': tf.Variable(tf.random_normal([hidden_layer])), 19 | 'encoder_b2': tf.Variable(tf.random_normal([dimension])), 20 | 'decoder_b1': tf.Variable(tf.random_normal([hidden_layer])), 21 | 'decoder_b2': tf.Variable(tf.random_normal([input_size])), 22 | } 23 | 24 | first_layer_encoder = tf.nn.sigmoid(tf.add(tf.matmul(X, weights['encoder_h1']), biases['encoder_b1'])) 25 | second_layer_encoder = tf.nn.sigmoid(tf.add(tf.matmul(first_layer_encoder, weights['encoder_h2']), biases['encoder_b2'])) 26 | first_layer_decoder = tf.nn.sigmoid(tf.add(tf.matmul(second_layer_encoder, weights['decoder_h1']), biases['decoder_b1'])) 27 | second_layer_decoder = tf.nn.sigmoid(tf.add(tf.matmul(first_layer_decoder, weights['decoder_h2']), biases['decoder_b2'])) 28 | cost = tf.reduce_mean(tf.pow(X - second_layer_decoder, 2)) 29 | optimizer = tf.train.RMSPropOptimizer(learning_rate).minimize(cost) 30 | sess = tf.InteractiveSession() 31 | sess.run(tf.global_variables_initializer()) 32 | 33 | for i in range(epoch): 34 | last_time = time.time() 35 | _, loss = sess.run([optimizer, cost], feed_dict={X: input_}) 36 | if (i + 1) % 10 == 0: 37 | print('epoch:', i + 1, 'loss:', loss, 'time:', time.time() - last_time) 38 | 39 | vectors = sess.run(second_layer_encoder, feed_dict={X: input_}) 40 | tf.reset_default_graph() 41 | return vectors -------------------------------------------------------------------------------- /realtime-agent/README.md: -------------------------------------------------------------------------------- 1 | ## How-to, this model based on [evolution-strategy](https://github.com/huseinzol05/Stock-Prediction-Models/tree/master/agent) 2 | 3 | 1. You can check [agent.ipynb](agent.ipynb) for to train an evolution strategy to do realtime trading. 4 | 5 | I trained the model to learn trading on different stocks, 6 | 7 | ```python 8 | ['TWTR.csv', 9 | 'GOOG.csv', 10 | 'FB.csv', 11 | 'LB.csv', 12 | 'MTDR.csv', 13 | 'CPRT.csv', 14 | 'FSV.csv', 15 | 'TSLA.csv', 16 | 'SINA.csv', 17 | 'GWR.csv'] 18 | ``` 19 | 20 | You might want to add more to cover more stochastic patterns. 21 | 22 | 2. Run [app.py](app.py) to serve the checkpoint model using Flask, 23 | 24 | ```bash 25 | python3 app.py 26 | ``` 27 | 28 | ```text 29 | * Serving Flask app "app" (lazy loading) 30 | * Environment: production 31 | WARNING: This is a development server. Do not use it in a production deployment. 32 | Use a production WSGI server instead. 33 | * Debug mode: off 34 | * Running on http://0.0.0.0:8005/ (Press CTRL+C to quit) 35 | ``` 36 | 37 | 3. You can check requests example in [request.ipynb](request.ipynb) to get a kickstart. 38 | 39 | ```bash 40 | curl http://localhost:8005/trade?data=[13.1, 13407500] 41 | ``` 42 | 43 | ```python 44 | {'action': 'sell', 'balance': 971.1199990000001, 'investment': '10.224268 %', 'status': 'sell 1 unit, price 16.709999', 'timestamp': '2019-05-26 01:12:10.370206'} 45 | {'action': 'nothing', 'balance': 971.1199990000001, 'status': 'do nothing', 'timestamp': '2019-05-26 01:12:10.376245'} 46 | {'action': 'sell', 'balance': 987.7799990000001, 'investment': '11.066667 %', 'status': 'sell 1 unit, price 16.660000', 'timestamp': '2019-05-26 01:12:10.382282'} 47 | {'action': 'nothing', 'balance': 987.7799990000001, 'status': 'do nothing', 'timestamp': '2019-05-26 01:12:10.388330'} 48 | {'action': 'nothing', 'balance': 987.7799990000001, 'status': 'do nothing', 'timestamp': '2019-05-26 01:12:10.394324'} 49 | {'action': 'sell', 'balance': 1006.1299990000001, 'investment': '18.387097 %', 'status': 'sell 1 unit, price 18.350000', 'timestamp': '2019-05-26 01:12:10.400104'} 50 | {'action': 'nothing', 'balance': 1006.1299990000001, 'status': 'do nothing', 'timestamp': '2019-05-26 01:12:10.405804'} 51 | {'action': 'nothing', 'balance': 1006.1299990000001, 'status': 'do nothing', 'timestamp': '2019-05-26 01:12:10.411531'} 52 | ``` 53 | 54 | ## Notes 55 | 56 | 1. You can use this code to integrate with realtime socket, or any APIs you wanted, imagination is your limit now. 57 | -------------------------------------------------------------------------------- /realtime-agent/LYFT.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2019-03-29,87.330002,88.599998,78.019997,78.290001,78.290001,71485200 3 | 2019-04-01,74.900002,75.000000,67.779999,69.010002,69.010002,41799300 4 | 2019-04-02,66.900002,70.199997,66.099998,68.970001,68.970001,22483300 5 | 2019-04-03,70.059998,72.000000,69.120003,70.000000,70.000000,15662300 6 | 2019-04-04,70.480003,72.889999,70.220001,72.000000,72.000000,9229300 7 | 2019-04-05,73.940002,76.099998,73.300003,74.449997,74.449997,11200100 8 | 2019-04-08,74.989998,74.989998,70.230003,70.230003,70.230003,6599500 9 | 2019-04-09,69.500000,69.699997,67.110001,67.440002,67.440002,8223300 10 | 2019-04-10,67.250000,67.349998,59.750000,60.119999,60.119999,26392100 11 | 2019-04-11,61.099998,62.299999,60.310001,61.009998,61.009998,12405700 12 | 2019-04-12,61.380001,61.490002,57.660000,59.895000,59.895000,13787500 13 | 2019-04-15,59.720001,59.799999,55.560001,56.110001,56.110001,14345900 14 | 2019-04-16,56.860001,57.939999,56.180000,56.250000,56.250000,9965000 15 | 2019-04-17,56.500000,59.610001,55.619999,59.509998,59.509998,10768300 16 | 2019-04-18,59.650002,59.660000,57.599998,58.360001,58.360001,6869900 17 | 2019-04-22,57.900002,61.230000,57.651001,60.939999,60.939999,5265600 18 | 2019-04-23,62.020000,62.099998,59.330002,60.250000,60.250000,11975000 19 | 2019-04-24,60.110001,60.488998,57.770000,57.820000,57.820000,5158000 20 | 2019-04-25,58.200001,58.457001,55.861000,56.340000,56.340000,5097100 21 | 2019-04-26,56.299999,57.529999,54.320000,57.240002,57.240002,5981000 22 | 2019-04-29,57.599998,60.709999,56.000000,60.590000,60.590000,7231800 23 | 2019-04-30,59.930000,61.400002,58.220001,59.799999,59.799999,6072700 24 | 2019-05-01,60.700001,60.709999,58.532001,58.750000,58.750000,3443000 25 | 2019-05-02,58.439999,62.009998,57.330002,61.500000,61.500000,6634300 26 | 2019-05-03,61.209999,62.985001,60.101002,62.509998,62.509998,9393600 27 | 2019-05-06,60.549999,61.500000,59.900002,60.570000,60.570000,5184600 28 | 2019-05-07,60.340000,61.599998,58.119999,59.340000,59.340000,11591700 29 | 2019-05-08,57.689999,60.450001,52.779999,52.910000,52.910000,22640400 30 | 2019-05-09,54.070000,56.450001,53.099998,55.180000,55.180000,9603500 31 | 2019-05-10,56.389999,56.490002,50.020000,51.090000,51.090000,23111200 32 | 2019-05-13,50.000000,50.090000,47.169998,48.150002,48.150002,10007400 33 | 2019-05-14,48.820000,51.389999,48.000000,50.520000,50.520000,7007400 34 | 2019-05-15,50.200001,54.849998,49.860001,54.040001,54.040001,7909300 35 | 2019-05-16,54.099998,56.720001,53.549999,55.599998,55.599998,7101700 36 | 2019-05-17,54.500000,55.110001,53.459999,53.790001,53.790001,4326500 37 | 2019-05-20,52.139999,54.689999,51.845001,54.630001,54.630001,2710000 38 | 2019-05-21,54.770000,56.029999,53.529999,55.509998,55.509998,3490700 39 | 2019-05-22,54.680000,57.959999,54.619999,57.880001,57.880001,3911900 40 | 2019-05-23,56.820000,58.466900,56.320202,58.110001,58.110001,3646300 41 | -------------------------------------------------------------------------------- /stock-forecasting-js/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | .icon-block { 3 | padding: 0 15px; 4 | } 5 | 6 | .icon-block .material-icons { 7 | font-size: inherit; 8 | } 9 | 10 | .toast{ 11 | background-color: #fff; 12 | color: #323232; 13 | } 14 | 15 | input[type=text].valid, input[type=number].valid{ 16 | border-bottom: 1px solid #90a4ae; 17 | box-shadow: 0 1px 0 0 #90a4ae; 18 | } 19 | 20 | input:not([type]):focus:not([readonly]), input[type=text]:focus:not([readonly]), input[type=password]:focus:not([readonly]), input[type=email]:focus:not([readonly]), input[type=url]:focus:not([readonly]), 21 | input[type=time]:focus:not([readonly]), input[type=date]:focus:not([readonly]), input[type=datetime]:focus:not([readonly]), input[type=datetime-local]:focus:not([readonly]), input[type=tel]:focus:not([readonly]), input[type=number]:focus:not([readonly]), 22 | input[type=search]:focus:not([readonly]), textarea.materialize-textarea:focus:not([readonly]){ 23 | border-bottom: 1px solid #90a4ae; 24 | box-shadow: 0 1px 0 0 #90a4ae; 25 | } 26 | 27 | input:not([type]):focus:not([readonly])+label, input[type=text]:focus:not([readonly])+label, input[type=password]:focus:not([readonly])+label, 28 | input[type=email]:focus:not([readonly])+label, input[type=url]:focus:not([readonly])+label, input[type=time]:focus:not([readonly])+label, 29 | input[type=date]:focus:not([readonly])+label, input[type=datetime]:focus:not([readonly])+label, input[type=datetime-local]:focus:not([readonly])+label, 30 | input[type=tel]:focus:not([readonly])+label, input[type=number]:focus:not([readonly])+label, input[type=search]:focus:not([readonly])+label, 31 | textarea.materialize-textarea:focus:not([readonly])+label{ 32 | color: #90a4ae; 33 | } 34 | 35 | .dropdown-content li>a, .dropdown-content li>span{ 36 | color: #90a4ae; 37 | } 38 | 39 | .tablescreen{ 40 | width: 100%; 41 | height: 100%; 42 | position: fixed; 43 | z-index: 1000; 44 | top: 50%; 45 | left: 50%; 46 | transform: translate(-50%, -50%); 47 | background-color: rgb(0,0,0); 48 | background-color: rgba(0,0,0,0.5); 49 | display: none; 50 | } 51 | 52 | .card-table{ 53 | z-index: 10000; 54 | position: fixed; 55 | width: 80%; 56 | padding-left: 3%; 57 | padding-right: 3%; 58 | height:70%; 59 | top: 50%; 60 | left: 50%; 61 | transform: translate(-50%, -50%); 62 | } 63 | 64 | .loadingscreen, .loadingscreen-fail, .imagescreen{ 65 | width: 100%; 66 | height: 100%; 67 | position: fixed; 68 | z-index: 1000; 69 | top: 50%; 70 | left: 50%; 71 | transform: translate(-50%, -50%); 72 | background-color: rgb(0,0,0); 73 | background-color: rgba(0,0,0,0.5); 74 | display: none; 75 | } 76 | 77 | .imagefail{ 78 | width: 130px; 79 | height: 130px; 80 | display: inherit; 81 | } 82 | 83 | .imagetoshow{ 84 | width: 700px; 85 | height: 700px; 86 | display: inherit; 87 | } 88 | 89 | .card-loading{ 90 | z-index: 10000; 91 | position: fixed; 92 | width: 20%; 93 | top: 50%; 94 | left: 50%; 95 | transform: translate(-50%, -50%); 96 | } 97 | 98 | .card-image-display{ 99 | width: 50%; 100 | } 101 | 102 | .card-image-loading{ 103 | margin-top: 20px; 104 | } 105 | 106 | .preloader-wrapper.big{ 107 | width: 120px; 108 | height: 120px; 109 | } 110 | 111 | @media (max-width: 1400px){ 112 | .imagetoshow{ 113 | width: 500px; 114 | height: 500px; 115 | display: inherit; 116 | } 117 | 118 | .swarmplot{ 119 | width: 1000px; 120 | } 121 | 122 | .correlation{ 123 | width: 500px; 124 | } 125 | 126 | } 127 | 128 | @media (max-width: 480px){ 129 | 130 | .boxplot, .heatmap, .pairplot, .swarmplot, .barplot, .correlation{ 131 | width: 320px; 132 | } 133 | 134 | .mobile-switch{ 135 | margin-top: 20px; 136 | width: 50%; 137 | } 138 | 139 | h1{ 140 | font-size: 3.5rem; 141 | } 142 | 143 | .card-loading{ 144 | width: 80%; 145 | } 146 | 147 | .card-fail{ 148 | width: 80%; 149 | } 150 | .card-image-display{ 151 | width: 90%; 152 | } 153 | .imagetoshow{ 154 | width: 300px; 155 | height: 300px; 156 | display: inherit; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /deep-learning/dnc.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """DNC Cores. 16 | 17 | These modules create a DNC core. They take input, pass parameters to the memory 18 | access module, and integrate the output of memory to form an output. 19 | """ 20 | 21 | from __future__ import absolute_import 22 | from __future__ import division 23 | from __future__ import print_function 24 | 25 | import collections 26 | import numpy as np 27 | import sonnet as snt 28 | import tensorflow as tf 29 | 30 | import access 31 | 32 | DNCState = collections.namedtuple('DNCState', ('access_output', 'access_state', 33 | 'controller_state')) 34 | 35 | 36 | class DNC(snt.RNNCore): 37 | """DNC core module. 38 | 39 | Contains controller and memory access module. 40 | """ 41 | 42 | def __init__(self, 43 | access_config, 44 | controller_config, 45 | output_size, 46 | clip_value=None, 47 | name='dnc'): 48 | """Initializes the DNC core. 49 | 50 | Args: 51 | access_config: dictionary of access module configurations. 52 | controller_config: dictionary of controller (LSTM) module configurations. 53 | output_size: output dimension size of core. 54 | clip_value: clips controller and core output values to between 55 | `[-clip_value, clip_value]` if specified. 56 | name: module name (default 'dnc'). 57 | 58 | Raises: 59 | TypeError: if direct_input_size is not None for any access module other 60 | than KeyValueMemory. 61 | """ 62 | super(DNC, self).__init__(name=name) 63 | 64 | with self._enter_variable_scope(): 65 | self._controller = snt.LSTM(**controller_config) 66 | self._access = access.MemoryAccess(**access_config) 67 | 68 | self._access_output_size = np.prod(self._access.output_size.as_list()) 69 | self._output_size = output_size 70 | self._clip_value = clip_value or 0 71 | 72 | self._output_size = tf.TensorShape([output_size]) 73 | self._state_size = DNCState( 74 | access_output=self._access_output_size, 75 | access_state=self._access.state_size, 76 | controller_state=self._controller.state_size) 77 | 78 | def _clip_if_enabled(self, x): 79 | if self._clip_value > 0: 80 | return tf.clip_by_value(x, -self._clip_value, self._clip_value) 81 | else: 82 | return x 83 | 84 | def _build(self, inputs, prev_state): 85 | """Connects the DNC core into the graph. 86 | 87 | Args: 88 | inputs: Tensor input. 89 | prev_state: A `DNCState` tuple containing the fields `access_output`, 90 | `access_state` and `controller_state`. `access_state` is a 3-D Tensor 91 | of shape `[batch_size, num_reads, word_size]` containing read words. 92 | `access_state` is a tuple of the access module's state, and 93 | `controller_state` is a tuple of controller module's state. 94 | 95 | Returns: 96 | A tuple `(output, next_state)` where `output` is a tensor and `next_state` 97 | is a `DNCState` tuple containing the fields `access_output`, 98 | `access_state`, and `controller_state`. 99 | """ 100 | 101 | prev_access_output = prev_state.access_output 102 | prev_access_state = prev_state.access_state 103 | prev_controller_state = prev_state.controller_state 104 | 105 | batch_flatten = snt.BatchFlatten() 106 | controller_input = tf.concat( 107 | [batch_flatten(inputs), batch_flatten(prev_access_output)], 1) 108 | 109 | controller_output, controller_state = self._controller( 110 | controller_input, prev_controller_state) 111 | 112 | controller_output = self._clip_if_enabled(controller_output) 113 | controller_state = snt.nest.map(self._clip_if_enabled, controller_state) 114 | 115 | access_output, access_state = self._access(controller_output, 116 | prev_access_state) 117 | 118 | output = tf.concat([controller_output, batch_flatten(access_output)], 1) 119 | output = snt.Linear( 120 | output_size=self._output_size.as_list()[0], 121 | name='output_linear')(output) 122 | output = self._clip_if_enabled(output) 123 | 124 | return output, DNCState( 125 | access_output=access_output, 126 | access_state=access_state, 127 | controller_state=controller_state) 128 | 129 | def initial_state(self, batch_size, dtype=tf.float32): 130 | return DNCState( 131 | controller_state=self._controller.initial_state(batch_size, dtype), 132 | access_state=self._access.initial_state(batch_size, dtype), 133 | access_output=tf.zeros( 134 | [batch_size] + self._access.output_size.as_list(), dtype)) 135 | 136 | @property 137 | def state_size(self): 138 | return self._state_size 139 | 140 | @property 141 | def output_size(self): 142 | return self._output_size 143 | -------------------------------------------------------------------------------- /stock-forecasting-js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 |
12 |
13 | 96 |
97 | 98 | 99 |
WARNING, This website may hang during training, and do not use this website to buy real stock!

Default stock is Google 2018, you can try upload any stock CSV
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | 140 |
141 |
142 |
143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | logo 4 | 5 |

6 |

7 | MIT License 8 | 9 | 10 |

11 | 12 | --- 13 | 14 | **Stock-Prediction-Models**, Gathers machine learning and deep learning models for Stock forecasting, included trading bots and simulations. 15 | 16 | ## Table of contents 17 | * [Models](https://github.com/huseinzol05/Stock-Prediction-Models#models) 18 | * [Agents](https://github.com/huseinzol05/Stock-Prediction-Models#agents) 19 | * [Realtime Agent](realtime-agent) 20 | * [Data Explorations](https://github.com/huseinzol05/Stock-Prediction-Models#data-explorations) 21 | * [Simulations](https://github.com/huseinzol05/Stock-Prediction-Models#simulations) 22 | * [Tensorflow-js](https://github.com/huseinzol05/Stock-Prediction-Models#tensorflow-js) 23 | * [Misc](https://github.com/huseinzol05/Stock-Prediction-Models#misc) 24 | * [Results](https://github.com/huseinzol05/Stock-Prediction-Models#results) 25 | * [Results Agent](https://github.com/huseinzol05/Stock-Prediction-Models#results-agent) 26 | * [Results signal prediction](https://github.com/huseinzol05/Stock-Prediction-Models#results-signal-prediction) 27 | * [Results analysis](https://github.com/huseinzol05/Stock-Prediction-Models#results-analysis) 28 | * [Results simulation](https://github.com/huseinzol05/Stock-Prediction-Models#results-simulation) 29 | 30 | ## Contents 31 | 32 | ### Models 33 | 34 | #### [Deep-learning models](deep-learning) 35 | 1. LSTM Recurrent Neural Network 36 | 2. Encoder-Decoder Feed-forward + LSTM Recurrent Neural Network 37 | 3. LSTM Bidirectional Neural Network 38 | 4. 2-Path LSTM Recurrent Neural Network 39 | 5. GRU Recurrent Neural Network 40 | 6. Encoder-Decoder Feed-forward + GRU Recurrent Neural Network 41 | 7. GRU Bidirectional Neural Network 42 | 8. 2-Path GRU Recurrent Neural Network 43 | 9. Vanilla Recurrent Neural Network 44 | 10. Encoder-Decoder Feed-forward + Vanilla Recurrent Neural Network 45 | 11. Vanilla Bidirectional Neural Network 46 | 12. 2-Path Vanilla Recurrent Neural Network 47 | 13. LSTM Sequence-to-Sequence Recurrent Neural Network 48 | 14. LSTM with Attention Recurrent Neural Network 49 | 15. LSTM Sequence-to-Sequence with Attention Recurrent Neural Network 50 | 16. LSTM Sequence-to-Sequence Bidirectional Recurrent Neural Network 51 | 17. LSTM Sequence-to-Sequence with Attention Bidirectional Recurrent Neural Network 52 | 18. LSTM with Attention Scaled-Dot Recurrent Neural Network 53 | 19. LSTM with Dilated Recurrent Neural Network 54 | 20. Only Attention Neural Network 55 | 21. Multihead Attention Neural Network 56 | 22. LSTM with Bahdanau Attention 57 | 23. LSTM with Luong Attention 58 | 24. LSTM with Bahdanau + Luong Attention 59 | 25. DNC Recurrent Neural Network 60 | 26. Residual LSTM Recurrent Neural Network 61 | 27. Byte-net 62 | 28. Attention is all you need 63 | 29. Fairseq 64 | 30. Dilation CNN + LSTM RNN 65 | 66 | #### [Stacking models](stacking) 67 | 1. Deep Feed-forward Auto-Encoder Neural Network to reduce dimension + Deep Recurrent Neural Network + ARIMA + Extreme Boosting Gradient Regressor 68 | 2. Adaboost + Bagging + Extra Trees + Gradient Boosting + Random Forest + XGB 69 | 70 | ### [Agents](agent) 71 | 72 | 1. Turtle-trading agent 73 | 2. Moving-average agent 74 | 3. Signal rolling agent 75 | 4. Policy-gradient agent 76 | 5. Q-learning agent 77 | 6. Evolution-strategy agent 78 | 7. Double Q-learning agent 79 | 8. Recurrent Q-learning agent 80 | 9. Double Recurrent Q-learning agent 81 | 10. Duel Q-learning agent 82 | 11. Double Duel Q-learning agent 83 | 12. Duel Recurrent Q-learning agent 84 | 13. Double Duel Recurrent Q-learning agent 85 | 14. Actor-critic agent 86 | 15. Actor-critic Duel agent 87 | 16. Actor-critic Recurrent agent 88 | 17. Actor-critic Duel Recurrent agent 89 | 18. Curiosity Q-learning agent 90 | 19. Recurrent Curiosity Q-learning agent 91 | 20. Duel Curiosity Q-learning agent 92 | 21. Neuro-evolution agent 93 | 22. Neuro-evolution with Novelty search agent 94 | 23. ABCD strategy agent 95 | 96 | ### [Data Explorations](misc) 97 | 98 | 1. stock market study on TESLA stock, [tesla-study.ipynb](misc/tesla-study.ipynb) 99 | 2. Outliers study using K-means, SVM, and Gaussian on TESLA stock, [outliers.ipynb](misc/outliers.ipynb) 100 | 3. Overbought-Oversold study on TESLA stock, [overbought-oversold.ipynb](misc/overbought-oversold.ipynb) 101 | 4. Which stock you need to buy? [which-stock.ipynb](misc/which-stock.ipynb) 102 | 103 | ### [Simulations](simulation) 104 | 105 | 1. Stock market simulation using Monte Carlo, [stock-forecasting-monte-carlo.ipynb](simulation/stock-forecasting-monte-carlo.ipynb) 106 | 2. Stock market simulation using Monte Carlo Markov Chain Metropolis-Hasting, [mcmc-stock-market.ipynb](simulation/mcmc-stock-market.ipynb) 107 | 3. Portfolio optimization, [portfolio-optimization.ipynb](simulation/portfolio-optimization.ipynb), inspired from https://pythonforfinance.net/2017/01/21/investment-portfolio-optimisation-with-python/ 108 | 109 | ### [Tensorflow-js](stock-forecasting-js) 110 | 111 | I code [LSTM Recurrent Neural Network](deep-learning/1.lstm.ipynb) and [Simple signal rolling agent](agent/simple-agent.ipynb) inside Tensorflow JS, you can try it here, [huseinhouse.com/stock-forecasting-js](https://huseinhouse.com/stock-forecasting-js/), you can download any historical CSV and upload dynamically. 112 | 113 | ### [Misc](misc) 114 | 115 | 1. fashion trending prediction with cross-validation, [fashion-forecasting.ipynb](misc/fashion-forecasting.ipynb) 116 | 2. Bitcoin analysis with LSTM prediction, [bitcoin-analysis-lstm.ipynb](misc/bitcoin-analysis-lstm.ipynb) 117 | 3. Kijang Emas Bank Negara, [kijang-emas-bank-negara.ipynb](misc/kijang-emas-bank-negara.ipynb) 118 | 119 | ## Results 120 | 121 | ### Results Agent 122 | 123 | **This agent only able to buy or sell 1 unit per transaction.** 124 | 125 | 1. Turtle-trading agent, [turtle-agent.ipynb](agent/1.turtle-agent.ipynb) 126 | 127 | 128 | 129 | 2. Moving-average agent, [moving-average-agent.ipynb](agent/2.moving-average-agent.ipynb) 130 | 131 | 132 | 133 | 3. Signal rolling agent, [signal-rolling-agent.ipynb](agent/3.signal-rolling-agent.ipynb) 134 | 135 | 136 | 137 | 4. Policy-gradient agent, [policy-gradient-agent.ipynb](agent/4.policy-gradient-agent.ipynb) 138 | 139 | 140 | 141 | 5. Q-learning agent, [q-learning-agent.ipynb](agent/5.q-learning-agent.ipynb) 142 | 143 | 144 | 145 | 6. Evolution-strategy agent, [evolution-strategy-agent.ipynb](agent/6.evolution-strategy-agent.ipynb) 146 | 147 | 148 | 149 | 7. Double Q-learning agent, [double-q-learning-agent.ipynb](agent/7.double-q-learning-agent.ipynb) 150 | 151 | 152 | 153 | 8. Recurrent Q-learning agent, [recurrent-q-learning-agent.ipynb](agent/8.recurrent-q-learning-agent.ipynb) 154 | 155 | 156 | 157 | 9. Double Recurrent Q-learning agent, [double-recurrent-q-learning-agent.ipynb](agent/9.double-recurrent-q-learning-agent.ipynb) 158 | 159 | 160 | 161 | 10. Duel Q-learning agent, [duel-q-learning-agent.ipynb](agent/10.duel-q-learning-agent.ipynb) 162 | 163 | 164 | 165 | 11. Double Duel Q-learning agent, [double-duel-q-learning-agent.ipynb](agent/11.double-duel-q-learning-agent.ipynb) 166 | 167 | 168 | 169 | 12. Duel Recurrent Q-learning agent, [duel-recurrent-q-learning-agent.ipynb](agent/12.duel-recurrent-q-learning-agent.ipynb) 170 | 171 | 172 | 173 | 13. Double Duel Recurrent Q-learning agent, [double-duel-recurrent-q-learning-agent.ipynb](agent/13.double-duel-recurrent-q-learning-agent.ipynb) 174 | 175 | 176 | 177 | 14. Actor-critic agent, [actor-critic-agent.ipynb](agent/14.actor-critic-agent.ipynb) 178 | 179 | 180 | 181 | 15. Actor-critic Duel agent, [actor-critic-duel-agent.ipynb](agent/14.actor-critic-duel-agent.ipynb) 182 | 183 | 184 | 185 | 16. Actor-critic Recurrent agent, [actor-critic-recurrent-agent.ipynb](agent/16.actor-critic-recurrent-agent.ipynb) 186 | 187 | 188 | 189 | 17. Actor-critic Duel Recurrent agent, [actor-critic-duel-recurrent-agent.ipynb](agent/17.actor-critic-duel-recurrent-agent.ipynb) 190 | 191 | 192 | 193 | 18. Curiosity Q-learning agent, [curiosity-q-learning-agent.ipynb](agent/18.curiosity-q-learning-agent.ipynb) 194 | 195 | 196 | 197 | 19. Recurrent Curiosity Q-learning agent, [recurrent-curiosity-q-learning.ipynb](agent/19.recurrent-curiosity-q-learning-agent.ipynb) 198 | 199 | 200 | 201 | 20. Duel Curiosity Q-learning agent, [duel-curiosity-q-learning-agent.ipynb](agent/20.duel-curiosity-q-learning-agent.ipynb) 202 | 203 | 204 | 205 | 21. Neuro-evolution agent, [neuro-evolution.ipynb](agent/21.neuro-evolution-agent.ipynb) 206 | 207 | 208 | 209 | 22. Neuro-evolution with Novelty search agent, [neuro-evolution-novelty-search.ipynb](agent/22.neuro-evolution-novelty-search-agent.ipynb) 210 | 211 | 212 | 213 | 23. ABCD strategy agent, [abcd-strategy.ipynb](agent/23.abcd-strategy-agent.ipynb) 214 | 215 | 216 | 217 | ### Results free agent 218 | 219 | **This agent able to buy or sell N-units per transaction.** 220 | 221 | evolution strategy agent [evolution-strategy-agent.ipynb](free-agent/evolution-strategy-agent.ipynb) 222 | 223 | ```text 224 | total gained 11037.529911, total investment 110.375299 % 225 | ``` 226 | 227 | evolution strategy with bayesian agent [evolution-strategy-bayesian-agent.ipynb](free-agent/evolution-strategy-bayesian-agent.ipynb) 228 | 229 | ```text 230 | total gained 13295.469683, total investment 132.954697 % 231 | ``` 232 | 233 | 234 | 235 | ### Results signal prediction 236 | 237 | _**Not included all, each notebooks already rendered the result.**_ 238 | 239 | 1. LSTM Recurrent Neural Network 240 | 241 | 242 | 243 | 2. LSTM Bidirectional Neural Network 244 | 245 | 246 | 247 | 3. 2-Path LSTM Recurrent Neural Network 248 | 249 | 250 | 251 | 4. Deep Feed-forward Auto-Encoder Neural Network to reduce dimension + Deep Recurrent Neural Network + ARIMA + Extreme Boosting Gradient Regressor 252 | 253 | 254 | 255 | 5. LSTM Sequence-to-Sequence Recurrent Neural Network 256 | 257 | 258 | 259 | 6. LSTM Sequence-to-Sequence with Attention Recurrent Neural Network 260 | 261 | 262 | 263 | 7. LSTM Sequence-to-Sequence with Attention Bidirectional Recurrent Neural Network 264 | 265 | 266 | 267 | 8. Encoder-Decoder Feed-forward + LSTM Recurrent Neural Network 268 | 269 | 270 | 271 | 9. Adaboost + Bagging + Extra Trees + Gradient Boosting + Random Forest + XGB 272 | 273 | 274 | 275 | ### Results analysis 276 | 277 | 1. Outliers study using K-means, SVM, and Gaussian on TESLA stock 278 | 279 | 280 | 281 | 2. Overbought-Oversold study on TESLA stock 282 | 283 | 284 | 285 | 3. Which stock you need to buy? 286 | 287 | 288 | 289 | ### Results simulation 290 | 291 | 1. Stock market simulation using Monte Carlo 292 | 293 | 294 | 295 | 2. Stock market simulation using Monte Carlo Markov Chain Metropolis-Hasting 296 | 297 | 298 | 299 | 3. Portfolio optimization 300 | 301 | 302 | -------------------------------------------------------------------------------- /deep-learning/access.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ============================================================================== 15 | """DNC access modules.""" 16 | 17 | from __future__ import absolute_import 18 | from __future__ import division 19 | from __future__ import print_function 20 | 21 | import collections 22 | import sonnet as snt 23 | import tensorflow as tf 24 | 25 | import addressing 26 | import util 27 | 28 | AccessState = collections.namedtuple('AccessState', ( 29 | 'memory', 'read_weights', 'write_weights', 'linkage', 'usage')) 30 | 31 | 32 | def _erase_and_write(memory, address, reset_weights, values): 33 | """Module to erase and write in the external memory. 34 | 35 | Erase operation: 36 | M_t'(i) = M_{t-1}(i) * (1 - w_t(i) * e_t) 37 | 38 | Add operation: 39 | M_t(i) = M_t'(i) + w_t(i) * a_t 40 | 41 | where e are the reset_weights, w the write weights and a the values. 42 | 43 | Args: 44 | memory: 3-D tensor of shape `[batch_size, memory_size, word_size]`. 45 | address: 3-D tensor `[batch_size, num_writes, memory_size]`. 46 | reset_weights: 3-D tensor `[batch_size, num_writes, word_size]`. 47 | values: 3-D tensor `[batch_size, num_writes, word_size]`. 48 | 49 | Returns: 50 | 3-D tensor of shape `[batch_size, num_writes, word_size]`. 51 | """ 52 | with tf.name_scope('erase_memory', values=[memory, address, reset_weights]): 53 | expand_address = tf.expand_dims(address, 3) 54 | reset_weights = tf.expand_dims(reset_weights, 2) 55 | weighted_resets = expand_address * reset_weights 56 | reset_gate = tf.reduce_prod(1 - weighted_resets, [1]) 57 | memory *= reset_gate 58 | 59 | with tf.name_scope('additive_write', values=[memory, address, values]): 60 | add_matrix = tf.matmul(address, values, adjoint_a=True) 61 | memory += add_matrix 62 | 63 | return memory 64 | 65 | 66 | class MemoryAccess(snt.RNNCore): 67 | """Access module of the Differentiable Neural Computer. 68 | 69 | This memory module supports multiple read and write heads. It makes use of: 70 | 71 | * `addressing.TemporalLinkage` to track the temporal ordering of writes in 72 | memory for each write head. 73 | * `addressing.FreenessAllocator` for keeping track of memory usage, where 74 | usage increase when a memory location is written to, and decreases when 75 | memory is read from that the controller says can be freed. 76 | 77 | Write-address selection is done by an interpolation between content-based 78 | lookup and using unused memory. 79 | 80 | Read-address selection is done by an interpolation of content-based lookup 81 | and following the link graph in the forward or backwards read direction. 82 | """ 83 | 84 | def __init__(self, 85 | memory_size=128, 86 | word_size=20, 87 | num_reads=1, 88 | num_writes=1, 89 | name='memory_access'): 90 | """Creates a MemoryAccess module. 91 | 92 | Args: 93 | memory_size: The number of memory slots (N in the DNC paper). 94 | word_size: The width of each memory slot (W in the DNC paper) 95 | num_reads: The number of read heads (R in the DNC paper). 96 | num_writes: The number of write heads (fixed at 1 in the paper). 97 | name: The name of the module. 98 | """ 99 | super(MemoryAccess, self).__init__(name=name) 100 | self._memory_size = memory_size 101 | self._word_size = word_size 102 | self._num_reads = num_reads 103 | self._num_writes = num_writes 104 | 105 | self._write_content_weights_mod = addressing.CosineWeights( 106 | num_writes, word_size, name='write_content_weights') 107 | self._read_content_weights_mod = addressing.CosineWeights( 108 | num_reads, word_size, name='read_content_weights') 109 | 110 | self._linkage = addressing.TemporalLinkage(memory_size, num_writes) 111 | self._freeness = addressing.Freeness(memory_size) 112 | 113 | def _build(self, inputs, prev_state): 114 | """Connects the MemoryAccess module into the graph. 115 | 116 | Args: 117 | inputs: tensor of shape `[batch_size, input_size]`. This is used to 118 | control this access module. 119 | prev_state: Instance of `AccessState` containing the previous state. 120 | 121 | Returns: 122 | A tuple `(output, next_state)`, where `output` is a tensor of shape 123 | `[batch_size, num_reads, word_size]`, and `next_state` is the new 124 | `AccessState` named tuple at the current time t. 125 | """ 126 | inputs = self._read_inputs(inputs) 127 | 128 | # Update usage using inputs['free_gate'] and previous read & write weights. 129 | usage = self._freeness( 130 | write_weights=prev_state.write_weights, 131 | free_gate=inputs['free_gate'], 132 | read_weights=prev_state.read_weights, 133 | prev_usage=prev_state.usage) 134 | 135 | # Write to memory. 136 | write_weights = self._write_weights(inputs, prev_state.memory, usage) 137 | memory = _erase_and_write( 138 | prev_state.memory, 139 | address=write_weights, 140 | reset_weights=inputs['erase_vectors'], 141 | values=inputs['write_vectors']) 142 | 143 | linkage_state = self._linkage(write_weights, prev_state.linkage) 144 | 145 | # Read from memory. 146 | read_weights = self._read_weights( 147 | inputs, 148 | memory=memory, 149 | prev_read_weights=prev_state.read_weights, 150 | link=linkage_state.link) 151 | read_words = tf.matmul(read_weights, memory) 152 | 153 | return (read_words, AccessState( 154 | memory=memory, 155 | read_weights=read_weights, 156 | write_weights=write_weights, 157 | linkage=linkage_state, 158 | usage=usage)) 159 | 160 | def _read_inputs(self, inputs): 161 | """Applies transformations to `inputs` to get control for this module.""" 162 | 163 | def _linear(first_dim, second_dim, name, activation=None): 164 | """Returns a linear transformation of `inputs`, followed by a reshape.""" 165 | linear = snt.Linear(first_dim * second_dim, name=name)(inputs) 166 | if activation is not None: 167 | linear = activation(linear, name=name + '_activation') 168 | return tf.reshape(linear, [-1, first_dim, second_dim]) 169 | 170 | # v_t^i - The vectors to write to memory, for each write head `i`. 171 | write_vectors = _linear(self._num_writes, self._word_size, 'write_vectors') 172 | 173 | # e_t^i - Amount to erase the memory by before writing, for each write head. 174 | erase_vectors = _linear(self._num_writes, self._word_size, 'erase_vectors', 175 | tf.sigmoid) 176 | 177 | # f_t^j - Amount that the memory at the locations read from at the previous 178 | # time step can be declared unused, for each read head `j`. 179 | free_gate = tf.sigmoid( 180 | snt.Linear(self._num_reads, name='free_gate')(inputs)) 181 | 182 | # g_t^{a, i} - Interpolation between writing to unallocated memory and 183 | # content-based lookup, for each write head `i`. Note: `a` is simply used to 184 | # identify this gate with allocation vs writing (as defined below). 185 | allocation_gate = tf.sigmoid( 186 | snt.Linear(self._num_writes, name='allocation_gate')(inputs)) 187 | 188 | # g_t^{w, i} - Overall gating of write amount for each write head. 189 | write_gate = tf.sigmoid( 190 | snt.Linear(self._num_writes, name='write_gate')(inputs)) 191 | 192 | # \pi_t^j - Mixing between "backwards" and "forwards" positions (for 193 | # each write head), and content-based lookup, for each read head. 194 | num_read_modes = 1 + 2 * self._num_writes 195 | read_mode = snt.BatchApply(tf.nn.softmax)( 196 | _linear(self._num_reads, num_read_modes, name='read_mode')) 197 | 198 | # Parameters for the (read / write) "weights by content matching" modules. 199 | write_keys = _linear(self._num_writes, self._word_size, 'write_keys') 200 | write_strengths = snt.Linear(self._num_writes, name='write_strengths')( 201 | inputs) 202 | 203 | read_keys = _linear(self._num_reads, self._word_size, 'read_keys') 204 | read_strengths = snt.Linear(self._num_reads, name='read_strengths')(inputs) 205 | 206 | result = { 207 | 'read_content_keys': read_keys, 208 | 'read_content_strengths': read_strengths, 209 | 'write_content_keys': write_keys, 210 | 'write_content_strengths': write_strengths, 211 | 'write_vectors': write_vectors, 212 | 'erase_vectors': erase_vectors, 213 | 'free_gate': free_gate, 214 | 'allocation_gate': allocation_gate, 215 | 'write_gate': write_gate, 216 | 'read_mode': read_mode, 217 | } 218 | return result 219 | 220 | def _write_weights(self, inputs, memory, usage): 221 | """Calculates the memory locations to write to. 222 | 223 | This uses a combination of content-based lookup and finding an unused 224 | location in memory, for each write head. 225 | 226 | Args: 227 | inputs: Collection of inputs to the access module, including controls for 228 | how to chose memory writing, such as the content to look-up and the 229 | weighting between content-based and allocation-based addressing. 230 | memory: A tensor of shape `[batch_size, memory_size, word_size]` 231 | containing the current memory contents. 232 | usage: Current memory usage, which is a tensor of shape `[batch_size, 233 | memory_size]`, used for allocation-based addressing. 234 | 235 | Returns: 236 | tensor of shape `[batch_size, num_writes, memory_size]` indicating where 237 | to write to (if anywhere) for each write head. 238 | """ 239 | with tf.name_scope('write_weights', values=[inputs, memory, usage]): 240 | # c_t^{w, i} - The content-based weights for each write head. 241 | write_content_weights = self._write_content_weights_mod( 242 | memory, inputs['write_content_keys'], 243 | inputs['write_content_strengths']) 244 | 245 | # a_t^i - The allocation weights for each write head. 246 | write_allocation_weights = self._freeness.write_allocation_weights( 247 | usage=usage, 248 | write_gates=(inputs['allocation_gate'] * inputs['write_gate']), 249 | num_writes=self._num_writes) 250 | 251 | # Expands gates over memory locations. 252 | allocation_gate = tf.expand_dims(inputs['allocation_gate'], -1) 253 | write_gate = tf.expand_dims(inputs['write_gate'], -1) 254 | 255 | # w_t^{w, i} - The write weightings for each write head. 256 | return write_gate * (allocation_gate * write_allocation_weights + 257 | (1 - allocation_gate) * write_content_weights) 258 | 259 | def _read_weights(self, inputs, memory, prev_read_weights, link): 260 | """Calculates read weights for each read head. 261 | 262 | The read weights are a combination of following the link graphs in the 263 | forward or backward directions from the previous read position, and doing 264 | content-based lookup. The interpolation between these different modes is 265 | done by `inputs['read_mode']`. 266 | 267 | Args: 268 | inputs: Controls for this access module. This contains the content-based 269 | keys to lookup, and the weightings for the different read modes. 270 | memory: A tensor of shape `[batch_size, memory_size, word_size]` 271 | containing the current memory contents to do content-based lookup. 272 | prev_read_weights: A tensor of shape `[batch_size, num_reads, 273 | memory_size]` containing the previous read locations. 274 | link: A tensor of shape `[batch_size, num_writes, memory_size, 275 | memory_size]` containing the temporal write transition graphs. 276 | 277 | Returns: 278 | A tensor of shape `[batch_size, num_reads, memory_size]` containing the 279 | read weights for each read head. 280 | """ 281 | with tf.name_scope( 282 | 'read_weights', values=[inputs, memory, prev_read_weights, link]): 283 | # c_t^{r, i} - The content weightings for each read head. 284 | content_weights = self._read_content_weights_mod( 285 | memory, inputs['read_content_keys'], inputs['read_content_strengths']) 286 | 287 | # Calculates f_t^i and b_t^i. 288 | forward_weights = self._linkage.directional_read_weights( 289 | link, prev_read_weights, forward=True) 290 | backward_weights = self._linkage.directional_read_weights( 291 | link, prev_read_weights, forward=False) 292 | 293 | backward_mode = inputs['read_mode'][:, :, :self._num_writes] 294 | forward_mode = ( 295 | inputs['read_mode'][:, :, self._num_writes:2 * self._num_writes]) 296 | content_mode = inputs['read_mode'][:, :, 2 * self._num_writes] 297 | 298 | read_weights = ( 299 | tf.expand_dims(content_mode, 2) * content_weights + tf.reduce_sum( 300 | tf.expand_dims(forward_mode, 3) * forward_weights, 2) + 301 | tf.reduce_sum(tf.expand_dims(backward_mode, 3) * backward_weights, 2)) 302 | 303 | return read_weights 304 | 305 | @property 306 | def state_size(self): 307 | """Returns a tuple of the shape of the state tensors.""" 308 | return AccessState( 309 | memory=tf.TensorShape([self._memory_size, self._word_size]), 310 | read_weights=tf.TensorShape([self._num_reads, self._memory_size]), 311 | write_weights=tf.TensorShape([self._num_writes, self._memory_size]), 312 | linkage=self._linkage.state_size, 313 | usage=self._freeness.state_size) 314 | 315 | @property 316 | def output_size(self): 317 | """Returns the output shape.""" 318 | return tf.TensorShape([self._num_reads, self._word_size]) 319 | -------------------------------------------------------------------------------- /realtime-agent/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, jsonify 2 | import numpy as np 3 | import pickle 4 | import json 5 | from sklearn.preprocessing import MinMaxScaler 6 | import pandas as pd 7 | from datetime import datetime 8 | 9 | app = Flask(__name__) 10 | 11 | window_size = 20 12 | skip = 1 13 | layer_size = 500 14 | output_size = 3 15 | 16 | def softmax(z): 17 | assert len(z.shape) == 2 18 | s = np.max(z, axis=1) 19 | s = s[:, np.newaxis] 20 | e_x = np.exp(z - s) 21 | div = np.sum(e_x, axis=1) 22 | div = div[:, np.newaxis] 23 | return e_x / div 24 | 25 | def get_state(parameters, t, window_size = 20): 26 | outside = [] 27 | d = t - window_size + 1 28 | for parameter in parameters: 29 | block = ( 30 | parameter[d : t + 1] 31 | if d >= 0 32 | else -d * [parameter[0]] + parameter[0 : t + 1] 33 | ) 34 | res = [] 35 | for i in range(window_size - 1): 36 | res.append(block[i + 1] - block[i]) 37 | for i in range(1, window_size, 1): 38 | res.append(block[i] - block[0]) 39 | outside.append(res) 40 | return np.array(outside).reshape((1, -1)) 41 | 42 | 43 | class Deep_Evolution_Strategy: 44 | 45 | inputs = None 46 | 47 | def __init__( 48 | self, weights, reward_function, population_size, sigma, learning_rate 49 | ): 50 | self.weights = weights 51 | self.reward_function = reward_function 52 | self.population_size = population_size 53 | self.sigma = sigma 54 | self.learning_rate = learning_rate 55 | 56 | def _get_weight_from_population(self, weights, population): 57 | weights_population = [] 58 | for index, i in enumerate(population): 59 | jittered = self.sigma * i 60 | weights_population.append(weights[index] + jittered) 61 | return weights_population 62 | 63 | def get_weights(self): 64 | return self.weights 65 | 66 | def train(self, epoch = 100, print_every = 1): 67 | lasttime = time.time() 68 | for i in range(epoch): 69 | population = [] 70 | rewards = np.zeros(self.population_size) 71 | for k in range(self.population_size): 72 | x = [] 73 | for w in self.weights: 74 | x.append(np.random.randn(*w.shape)) 75 | population.append(x) 76 | for k in range(self.population_size): 77 | weights_population = self._get_weight_from_population( 78 | self.weights, population[k] 79 | ) 80 | rewards[k] = self.reward_function(weights_population) 81 | rewards = (rewards - np.mean(rewards)) / (np.std(rewards) + 1e-7) 82 | for index, w in enumerate(self.weights): 83 | A = np.array([p[index] for p in population]) 84 | self.weights[index] = ( 85 | w 86 | + self.learning_rate 87 | / (self.population_size * self.sigma) 88 | * np.dot(A.T, rewards).T 89 | ) 90 | if (i + 1) % print_every == 0: 91 | print( 92 | 'iter %d. reward: %f' 93 | % (i + 1, self.reward_function(self.weights)) 94 | ) 95 | print('time taken to train:', time.time() - lasttime, 'seconds') 96 | 97 | class Model: 98 | 99 | DROPOUT = 0.9 100 | def __init__(self, input_size, layer_size, output_size): 101 | self.weights = [ 102 | np.random.normal(scale = 0.05, size = (input_size, layer_size)), 103 | np.random.normal(scale = 0.05, size = (layer_size, layer_size)), 104 | np.random.normal(scale = 0.05, size = (layer_size, output_size)), 105 | np.zeros((1, layer_size)), 106 | np.zeros((1, layer_size)), 107 | ] 108 | 109 | def predict(self, inputs): 110 | feed = np.dot(inputs, self.weights[0]) + self.weights[-2] 111 | feed = np.dot(feed, self.weights[1]) + self.weights[-1] 112 | decision = np.dot(feed, self.weights[2]) 113 | return decision 114 | 115 | def get_weights(self): 116 | return self.weights 117 | 118 | def set_weights(self, weights): 119 | self.weights = weights 120 | 121 | 122 | class Agent: 123 | 124 | POPULATION_SIZE = 15 125 | SIGMA = 0.1 126 | LEARNING_RATE = 0.03 127 | 128 | def __init__(self, model, timeseries, skip, initial_money, real_trend, minmax): 129 | self.model = model 130 | self.timeseries = timeseries 131 | self.skip = skip 132 | self.real_trend = real_trend 133 | self.initial_money = initial_money 134 | self.es = Deep_Evolution_Strategy( 135 | self.model.get_weights(), 136 | self.get_reward, 137 | self.POPULATION_SIZE, 138 | self.SIGMA, 139 | self.LEARNING_RATE, 140 | ) 141 | self.minmax = minmax 142 | self._initiate() 143 | 144 | def _initiate(self): 145 | # i assume first index is the close value 146 | self.trend = self.timeseries[0] 147 | self._mean = np.mean(self.trend) 148 | self._std = np.std(self.trend) 149 | self._inventory = [] 150 | self._capital = self.initial_money 151 | self._queue = [] 152 | self._scaled_capital = self.minmax.transform([[self._capital, 2]])[0, 0] 153 | 154 | def reset_capital(self, capital): 155 | if capital: 156 | self._capital = capital 157 | self._scaled_capital = self.minmax.transform([[self._capital, 2]])[0, 0] 158 | self._queue = [] 159 | self._inventory = [] 160 | 161 | def trade(self, data): 162 | """ 163 | you need to make sure the data is [close, volume] 164 | """ 165 | scaled_data = self.minmax.transform([data])[0] 166 | real_close = data[0] 167 | close = scaled_data[0] 168 | if len(self._queue) >= window_size: 169 | self._queue.pop(0) 170 | self._queue.append(scaled_data) 171 | if len(self._queue) < window_size: 172 | return { 173 | 'status': 'data not enough to trade', 174 | 'action': 'fail', 175 | 'balance': self._capital, 176 | 'timestamp': str(datetime.now()), 177 | } 178 | state = self.get_state( 179 | window_size - 1, 180 | self._inventory, 181 | self._scaled_capital, 182 | timeseries = np.array(self._queue).T.tolist(), 183 | ) 184 | action, prob = self.act_softmax(state) 185 | print(prob) 186 | if action == 1 and self._scaled_capital >= close: 187 | self._inventory.append(close) 188 | self._scaled_capital -= close 189 | self._capital -= real_close 190 | return { 191 | 'status': 'buy 1 unit, cost %f' % (real_close), 192 | 'action': 'buy', 193 | 'balance': self._capital, 194 | 'timestamp': str(datetime.now()), 195 | } 196 | elif action == 2 and len(self._inventory): 197 | bought_price = self._inventory.pop(0) 198 | self._scaled_capital += close 199 | self._capital += real_close 200 | scaled_bought_price = self.minmax.inverse_transform( 201 | [[bought_price, 2]] 202 | )[0, 0] 203 | try: 204 | invest = ( 205 | (real_close - scaled_bought_price) / scaled_bought_price 206 | ) * 100 207 | except: 208 | invest = 0 209 | return { 210 | 'status': 'sell 1 unit, price %f' % (real_close), 211 | 'investment': invest, 212 | 'gain': real_close - scaled_bought_price, 213 | 'balance': self._capital, 214 | 'action': 'sell', 215 | 'timestamp': str(datetime.now()), 216 | } 217 | else: 218 | return { 219 | 'status': 'do nothing', 220 | 'action': 'nothing', 221 | 'balance': self._capital, 222 | 'timestamp': str(datetime.now()), 223 | } 224 | 225 | def change_data(self, timeseries, skip, initial_money, real_trend, minmax): 226 | self.timeseries = timeseries 227 | self.skip = skip 228 | self.initial_money = initial_money 229 | self.real_trend = real_trend 230 | self.minmax = minmax 231 | self._initiate() 232 | 233 | def act(self, sequence): 234 | decision = self.model.predict(np.array(sequence)) 235 | 236 | return np.argmax(decision[0]) 237 | 238 | def act_softmax(self, sequence): 239 | decision = self.model.predict(np.array(sequence)) 240 | 241 | return np.argmax(decision[0]), softmax(decision)[0] 242 | 243 | def get_state(self, t, inventory, capital, timeseries): 244 | state = get_state(timeseries, t) 245 | len_inventory = len(inventory) 246 | if len_inventory: 247 | mean_inventory = np.mean(inventory) 248 | else: 249 | mean_inventory = 0 250 | z_inventory = (mean_inventory - self._mean) / self._std 251 | z_capital = (capital - self._mean) / self._std 252 | concat_parameters = np.concatenate( 253 | [state, [[len_inventory, z_inventory, z_capital]]], axis = 1 254 | ) 255 | return concat_parameters 256 | 257 | def get_reward(self, weights): 258 | initial_money = self._scaled_capital 259 | starting_money = initial_money 260 | invests = [] 261 | self.model.weights = weights 262 | inventory = [] 263 | state = self.get_state(0, inventory, starting_money, self.timeseries) 264 | 265 | for t in range(0, len(self.trend) - 1, self.skip): 266 | action = self.act(state) 267 | if action == 1 and starting_money >= self.trend[t]: 268 | inventory.append(self.trend[t]) 269 | starting_money -= self.trend[t] 270 | 271 | elif action == 2 and len(inventory): 272 | bought_price = inventory.pop(0) 273 | starting_money += self.trend[t] 274 | invest = ((self.trend[t] - bought_price) / bought_price) * 100 275 | invests.append(invest) 276 | 277 | state = self.get_state( 278 | t + 1, inventory, starting_money, self.timeseries 279 | ) 280 | invests = np.mean(invests) 281 | if np.isnan(invests): 282 | invests = 0 283 | score = (starting_money - initial_money) / initial_money * 100 284 | return invests * 0.7 + score * 0.3 285 | 286 | def fit(self, iterations, checkpoint): 287 | self.es.train(iterations, print_every = checkpoint) 288 | 289 | def buy(self): 290 | initial_money = self._scaled_capital 291 | starting_money = initial_money 292 | 293 | real_initial_money = self.initial_money 294 | real_starting_money = self.initial_money 295 | inventory = [] 296 | real_inventory = [] 297 | state = self.get_state(0, inventory, starting_money, self.timeseries) 298 | states_sell = [] 299 | states_buy = [] 300 | 301 | for t in range(0, len(self.trend) - 1, self.skip): 302 | action, prob = self.act_softmax(state) 303 | print(t, prob) 304 | 305 | if action == 1 and starting_money >= self.trend[t] and t < (len(self.trend) - 1 - window_size): 306 | inventory.append(self.trend[t]) 307 | real_inventory.append(self.real_trend[t]) 308 | real_starting_money -= self.real_trend[t] 309 | starting_money -= self.trend[t] 310 | states_buy.append(t) 311 | print( 312 | 'day %d: buy 1 unit at price %f, total balance %f' 313 | % (t, self.real_trend[t], real_starting_money) 314 | ) 315 | 316 | elif action == 2 and len(inventory): 317 | bought_price = inventory.pop(0) 318 | real_bought_price = real_inventory.pop(0) 319 | starting_money += self.trend[t] 320 | real_starting_money += self.real_trend[t] 321 | states_sell.append(t) 322 | try: 323 | invest = ( 324 | (self.real_trend[t] - real_bought_price) 325 | / real_bought_price 326 | ) * 100 327 | except: 328 | invest = 0 329 | print( 330 | 'day %d, sell 1 unit at price %f, investment %f %%, total balance %f,' 331 | % (t, self.real_trend[t], invest, real_starting_money) 332 | ) 333 | state = self.get_state( 334 | t + 1, inventory, starting_money, self.timeseries 335 | ) 336 | 337 | invest = ( 338 | (real_starting_money - real_initial_money) / real_initial_money 339 | ) * 100 340 | total_gains = real_starting_money - real_initial_money 341 | return states_buy, states_sell, total_gains, invest 342 | 343 | 344 | with open('model.pkl', 'rb') as fopen: 345 | model = pickle.load(fopen) 346 | 347 | df = pd.read_csv('TWTR.csv') 348 | real_trend = df['Close'].tolist() 349 | parameters = [df['Close'].tolist(), df['Volume'].tolist()] 350 | minmax = MinMaxScaler(feature_range = (100, 200)).fit(np.array(parameters).T) 351 | scaled_parameters = minmax.transform(np.array(parameters).T).T.tolist() 352 | initial_money = np.max(parameters[0]) * 2 353 | 354 | agent = Agent(model = model, 355 | timeseries = scaled_parameters, 356 | skip = skip, 357 | initial_money = initial_money, 358 | real_trend = real_trend, 359 | minmax = minmax) 360 | 361 | @app.route('/', methods = ['GET']) 362 | def hello(): 363 | return jsonify({'status': 'OK'}) 364 | 365 | 366 | @app.route('/inventory', methods = ['GET']) 367 | def inventory(): 368 | return jsonify(agent._inventory) 369 | 370 | 371 | @app.route('/queue', methods = ['GET']) 372 | def queue(): 373 | return jsonify(agent._queue) 374 | 375 | 376 | @app.route('/balance', methods = ['GET']) 377 | def balance(): 378 | return jsonify(agent._capital) 379 | 380 | 381 | @app.route('/trade', methods = ['GET']) 382 | def trade(): 383 | data = json.loads(request.args.get('data')) 384 | return jsonify(agent.trade(data)) 385 | 386 | 387 | @app.route('/reset', methods = ['GET']) 388 | def reset(): 389 | money = json.loads(request.args.get('money')) 390 | agent.reset_capital(money) 391 | return jsonify(True) 392 | 393 | 394 | if __name__ == '__main__': 395 | app.run(host = '0.0.0.0', port = 8005) 396 | -------------------------------------------------------------------------------- /dataset/MONDY.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2018-07-13,56.889999,56.889999,56.889999,56.889999,54.963757,0 3 | 2018-07-16,56.639999,56.639999,56.639999,56.639999,54.722221,320 4 | 2018-07-17,57.730000,57.730000,57.730000,57.730000,55.775318,538 5 | 2018-07-18,57.810001,57.810001,57.810001,57.810001,55.852608,522 6 | 2018-07-19,56.700001,57.279999,52.380001,52.380001,50.606461,2047 7 | 2018-07-20,52.380001,52.380001,52.380001,52.380001,50.606461,0 8 | 2018-07-23,52.380001,52.380001,52.380001,52.380001,50.606461,0 9 | 2018-07-24,57.349998,57.349998,57.290001,57.290001,55.350212,349 10 | 2018-07-25,57.290001,57.290001,57.290001,57.290001,55.350212,0 11 | 2018-07-26,57.310001,57.509998,53.080002,57.509998,55.562763,728 12 | 2018-07-27,57.590000,57.590000,57.590000,57.590000,55.640057,357 13 | 2018-07-30,57.869999,57.869999,57.669998,57.669998,55.717346,294 14 | 2018-07-31,58.549999,58.549999,58.549999,58.549999,56.567551,398 15 | 2018-08-01,58.299999,58.590000,58.299999,58.590000,56.606197,451 16 | 2018-08-02,57.189999,57.189999,57.189999,57.189999,55.253601,294 17 | 2018-08-03,58.496101,58.496101,58.496101,58.496101,56.515476,663 18 | 2018-08-06,58.496101,58.496101,58.496101,58.496101,56.515476,0 19 | 2018-08-07,60.619999,60.619999,60.490002,60.490002,58.441868,638 20 | 2018-08-08,58.000000,58.000000,58.000000,58.000000,56.036175,302 21 | 2018-08-09,60.270000,60.470001,60.270000,60.470001,58.422546,1523 22 | 2018-08-10,58.110001,58.400002,58.110001,58.400002,56.422630,766 23 | 2018-08-13,57.770000,57.770000,56.000000,56.000000,54.103893,457 24 | 2018-08-14,56.950001,57.330002,56.950001,57.330002,55.388863,844 25 | 2018-08-15,57.330002,57.330002,57.330002,57.330002,55.388863,0 26 | 2018-08-16,56.020000,56.049999,55.900002,55.900002,54.007278,839 27 | 2018-08-17,56.439999,56.439999,56.439999,56.439999,54.528992,183 28 | 2018-08-20,56.439999,56.439999,56.439999,56.439999,54.528992,0 29 | 2018-08-21,56.439999,56.439999,56.439999,56.439999,54.528992,0 30 | 2018-08-22,58.380001,58.380001,58.380001,58.380001,56.403309,430 31 | 2018-08-23,57.410000,57.410000,57.410000,57.410000,55.942810,369 32 | 2018-08-24,57.810001,58.009998,55.750000,55.750000,54.325233,2546 33 | 2018-08-27,59.209999,59.209999,55.290001,55.290001,53.876991,657 34 | 2018-08-28,58.720001,58.720001,58.720001,58.720001,57.219334,970 35 | 2018-08-29,59.000000,59.000000,59.000000,59.000000,57.492176,1111 36 | 2018-08-30,57.049999,57.049999,55.709999,55.709999,54.286255,594 37 | 2018-08-31,55.689999,57.970001,55.689999,57.970001,56.488503,823 38 | 2018-09-04,57.869999,58.070000,57.869999,58.070000,56.585945,541 39 | 2018-09-05,58.070000,58.070000,58.070000,58.070000,56.585945,0 40 | 2018-09-06,57.320000,57.320000,57.320000,57.320000,55.855110,1033 41 | 2018-09-07,56.650002,56.650002,53.849998,53.849998,52.473789,411 42 | 2018-09-10,53.849998,53.849998,53.849998,53.849998,52.473789,0 43 | 2018-09-11,54.090000,54.090000,54.090000,54.090000,52.707657,361 44 | 2018-09-12,56.450001,56.650002,54.000000,54.000000,52.619957,915 45 | 2018-09-13,54.759998,57.250000,54.759998,57.250000,55.786900,530 46 | 2018-09-14,56.162498,58.360001,56.162498,58.360001,56.868534,541 47 | 2018-09-17,58.389999,58.590000,58.389999,58.590000,57.092655,422 48 | 2018-09-18,57.919998,58.119999,57.919998,58.119999,56.634666,534 49 | 2018-09-19,58.349998,58.349998,58.349998,58.349998,56.858788,155 50 | 2018-09-20,58.869999,59.070000,58.869999,59.070000,57.560387,355 51 | 2018-09-21,59.119999,59.320000,59.119999,59.320000,57.803997,552 52 | 2018-09-24,59.320000,59.320000,59.320000,59.320000,57.803997,0 53 | 2018-09-25,59.320000,59.320000,59.320000,59.320000,57.803997,0 54 | 2018-09-26,58.689999,58.889999,58.689999,58.889999,57.384987,607 55 | 2018-09-27,58.540001,58.540001,58.540001,58.540001,57.043934,393 56 | 2018-09-28,58.540001,58.540001,58.540001,58.540001,57.043934,0 57 | 2018-10-01,57.830002,57.849998,57.650002,57.650002,56.176678,610 58 | 2018-10-02,57.330002,57.330002,57.330002,57.330002,55.864857,191 59 | 2018-10-03,57.230000,57.230000,57.230000,57.230000,55.767410,628 60 | 2018-10-04,54.630001,54.630001,54.630001,54.630001,53.233860,181 61 | 2018-10-05,54.660000,54.860001,54.660000,54.860001,53.457981,280 62 | 2018-10-08,51.759998,54.430000,51.560001,54.430000,53.038971,884 63 | 2018-10-09,54.430000,54.430000,54.430000,54.430000,53.038971,0 64 | 2018-10-10,47.779999,49.470001,47.779999,47.779999,46.558918,503 65 | 2018-10-11,47.529999,49.630001,46.470001,49.630001,48.361641,3604 66 | 2018-10-12,46.130001,46.130001,46.130001,46.130001,44.951088,2170 67 | 2018-10-15,48.000000,48.349998,48.000000,48.349998,47.114349,934 68 | 2018-10-16,49.500000,49.500000,49.500000,49.500000,48.234962,213 69 | 2018-10-17,49.500000,49.500000,48.790001,48.790001,47.543106,489 70 | 2018-10-18,47.372002,47.372002,47.372002,47.372002,46.161346,275 71 | 2018-10-19,48.990002,48.990002,48.990002,48.990002,47.737999,352 72 | 2018-10-22,46.090000,48.730000,46.090000,48.730000,47.484638,723 73 | 2018-10-23,47.480000,47.480000,45.310001,45.310001,44.152042,341 74 | 2018-10-24,45.310001,45.310001,45.310001,45.310001,44.152042,0 75 | 2018-10-25,47.500000,47.500000,45.910000,45.910000,44.736710,506 76 | 2018-10-26,45.910000,45.910000,45.910000,45.910000,44.736710,0 77 | 2018-10-29,45.910000,45.910000,45.910000,45.910000,44.736710,0 78 | 2018-10-30,45.509998,45.509998,45.509998,45.509998,44.346931,497 79 | 2018-10-31,47.049999,47.049999,46.790001,46.790001,45.594219,591 80 | 2018-11-01,47.049999,47.049999,47.049999,47.049999,45.847572,349 81 | 2018-11-02,47.490002,47.500000,47.490002,47.494999,46.281200,1008 82 | 2018-11-05,48.959999,48.959999,48.959999,48.959999,47.708763,455 83 | 2018-11-06,50.000000,50.000000,47.540001,47.540001,46.325054,963 84 | 2018-11-07,47.790001,47.790001,47.790001,47.790001,46.568665,288 85 | 2018-11-08,47.790001,47.790001,47.790001,47.790001,46.568665,0 86 | 2018-11-09,47.360001,47.360001,47.360001,47.360001,46.149654,268 87 | 2018-11-12,44.029999,46.230000,43.880001,43.880001,42.758591,1785 88 | 2018-11-13,46.689999,46.689999,46.689999,46.689999,45.496773,1146 89 | 2018-11-14,47.779999,47.779999,47.779999,47.779999,46.558918,2250 90 | 2018-11-15,47.700001,47.700001,47.700001,47.700001,46.480965,626 91 | 2018-11-16,47.700001,47.700001,47.700001,47.700001,46.480965,0 92 | 2018-11-19,47.700001,47.700001,47.700001,47.700001,46.480965,0 93 | 2018-11-20,47.700001,47.700001,47.700001,47.700001,46.480965,0 94 | 2018-11-21,45.430000,47.950001,45.430000,47.950001,46.724575,590 95 | 2018-11-23,47.950001,47.950001,47.950001,47.950001,46.724575,0 96 | 2018-11-26,46.470001,46.470001,46.470001,46.470001,45.282398,427 97 | 2018-11-27,44.721401,45.910000,44.721401,45.910000,44.736710,934 98 | 2018-11-28,43.810001,43.810001,43.810001,43.810001,42.690380,1041 99 | 2018-11-29,46.049999,46.049999,46.049999,46.049999,44.873131,640 100 | 2018-11-30,44.520000,44.520000,42.740002,42.740002,41.647724,658 101 | 2018-12-03,46.330002,46.330002,44.650002,46.259998,45.077763,1756 102 | 2018-12-04,44.080002,44.080002,44.080002,44.080002,42.953480,802 103 | 2018-12-06,41.750000,43.169998,41.750000,43.169998,42.066730,1655 104 | 2018-12-07,41.950001,42.450001,41.110001,41.110001,40.059380,2218 105 | 2018-12-10,40.830002,42.189999,39.970001,39.970001,38.948513,1240 106 | 2018-12-11,41.340000,42.549999,40.650002,42.549999,41.462578,22122 107 | 2018-12-12,43.980000,43.990002,43.980000,43.990002,42.865780,681 108 | 2018-12-13,42.230000,42.230000,42.230000,42.230000,41.150757,487 109 | 2018-12-14,42.060001,42.060001,40.150002,40.150002,39.123917,653 110 | 2018-12-17,39.599998,40.709999,39.490002,40.709999,39.669601,12561 111 | 2018-12-18,39.570000,39.570000,39.570000,39.570000,38.558735,659 112 | 2018-12-19,42.330002,42.330002,42.130001,42.130001,41.053314,833 113 | 2018-12-20,39.639999,42.369999,39.639999,42.369999,41.287178,634 114 | 2018-12-21,41.840000,41.840000,41.840000,41.840000,40.770725,682 115 | 2018-12-24,42.380001,42.380001,42.380001,42.380001,41.296925,433 116 | 2018-12-26,42.380001,42.380001,42.380001,42.380001,41.296925,0 117 | 2018-12-27,41.340000,41.340000,41.340000,41.340000,40.283501,437 118 | 2018-12-28,41.340000,41.340000,41.340000,41.340000,40.283501,0 119 | 2018-12-31,44.299999,44.310001,44.189999,44.189999,43.060665,1769 120 | 2019-01-02,43.169998,43.630001,43.169998,43.630001,42.514980,662 121 | 2019-01-03,43.130001,43.130001,43.130001,43.130001,42.027756,303 122 | 2019-01-04,43.584702,43.584702,43.584702,43.584702,42.470837,13482 123 | 2019-01-07,45.169998,45.169998,45.160000,45.160000,44.005875,768 124 | 2019-01-08,45.410000,45.410000,45.410000,45.410000,44.249489,500 125 | 2019-01-09,45.410000,45.410000,45.410000,45.410000,44.249489,0 126 | 2019-01-10,45.410000,45.410000,45.410000,45.410000,44.249489,0 127 | 2019-01-11,46.500000,46.799999,46.500000,46.599998,45.409073,22858 128 | 2019-01-14,46.599998,46.799999,46.599998,46.799999,45.603962,2155 129 | 2019-01-15,46.799999,46.799999,46.799999,46.799999,45.603962,0 130 | 2019-01-16,46.799999,46.799999,46.799999,46.799999,45.603962,269 131 | 2019-01-17,49.349998,49.349998,49.349998,49.349998,48.088795,793 132 | 2019-01-18,49.509998,49.549999,49.509998,49.549999,48.283684,506 133 | 2019-01-22,47.119999,49.980000,47.119999,49.980000,48.702694,5183 134 | 2019-01-23,49.950001,50.099998,47.279999,50.090000,48.809883,2687 135 | 2019-01-24,49.360001,49.570000,49.360001,49.570000,48.303173,7566 136 | 2019-01-25,48.540001,51.139999,48.540001,51.139999,49.833050,668 137 | 2019-01-28,51.000000,51.000000,51.000000,51.000000,49.696629,1144 138 | 2019-01-29,51.660000,51.660000,51.459999,51.660000,50.339760,562 139 | 2019-01-30,52.110001,52.310001,51.750000,51.750000,50.427460,1681 140 | 2019-01-31,50.669998,50.900002,50.400002,50.900002,49.599186,1109 141 | 2019-02-01,49.794998,49.794998,49.794998,49.794998,48.522423,352 142 | 2019-02-04,51.049999,51.259998,51.049999,51.259998,49.949982,772 143 | 2019-02-05,51.250000,51.250000,51.250000,51.250000,49.940239,5765 144 | 2019-02-06,51.250000,51.250000,51.250000,51.250000,49.940239,0 145 | 2019-02-07,46.560001,46.560001,46.560001,46.560001,45.370098,543 146 | 2019-02-08,49.259998,49.650002,49.259998,49.650002,48.381130,741 147 | 2019-02-11,49.650002,49.650002,49.650002,49.650002,48.381130,0 148 | 2019-02-12,50.029999,50.029999,50.029999,50.029999,48.751415,261 149 | 2019-02-13,50.720001,50.919998,50.720001,50.919998,49.618671,551 150 | 2019-02-14,50.919998,50.919998,50.919998,50.919998,49.618671,0 151 | 2019-02-15,50.919998,50.919998,50.919998,50.919998,49.618671,0 152 | 2019-02-19,50.919998,50.919998,50.919998,50.919998,49.618671,0 153 | 2019-02-20,49.930000,49.930000,49.930000,49.930000,48.653973,339 154 | 2019-02-21,51.230000,51.230000,51.230000,51.230000,49.920750,200 155 | 2019-02-22,51.650002,51.919998,50.404999,51.919998,50.593113,756 156 | 2019-02-25,51.919998,51.919998,51.919998,51.919998,50.593113,0 157 | 2019-02-26,51.209999,52.520000,51.209999,52.520000,51.177784,614 158 | 2019-02-27,50.220001,50.220001,50.220001,50.220001,48.936562,151 159 | 2019-02-28,46.790001,48.320000,46.790001,48.320000,47.085117,460 160 | 2019-03-01,48.320000,48.320000,48.320000,48.320000,47.085117,0 161 | 2019-03-04,48.650002,48.650002,47.430000,47.430000,46.217865,639 162 | 2019-03-05,47.430000,47.430000,47.430000,47.430000,46.217865,0 163 | 2019-03-06,47.430000,47.430000,47.430000,47.430000,46.217865,0 164 | 2019-03-07,49.330002,49.400002,48.029999,49.400002,48.137520,1703 165 | 2019-03-08,49.400002,49.400002,49.400002,49.400002,48.137520,0 166 | 2019-03-11,49.400002,49.400002,49.400002,49.400002,48.137520,0 167 | 2019-03-12,49.400002,49.400002,49.400002,49.400002,48.137520,0 168 | 2019-03-13,49.400002,49.400002,49.400002,49.400002,48.137520,0 169 | 2019-03-14,48.619999,48.619999,48.619999,48.619999,47.377449,238 170 | 2019-03-15,46.810001,48.970001,46.810001,48.970001,47.718510,21435 171 | 2019-03-18,48.639999,49.060001,48.639999,49.060001,47.806210,3681 172 | 2019-03-19,48.395000,49.830002,48.060001,48.060001,46.831764,3475 173 | 2019-03-20,48.139999,49.820000,48.139999,48.750000,47.504128,2702 174 | 2019-03-21,48.549999,48.750000,47.500000,48.750000,47.504128,1842 175 | 2019-03-22,46.450001,46.450001,46.450001,46.450001,45.262909,7506 176 | 2019-03-25,46.910000,46.910000,43.840000,46.759998,45.564983,1482 177 | 2019-03-26,44.930000,46.060001,44.930000,46.060001,44.882877,284 178 | 2019-03-27,46.060001,46.060001,46.060001,46.060001,44.882877,0 179 | 2019-03-28,46.529999,46.529999,46.529999,46.529999,45.340862,369 180 | 2019-03-29,46.529999,46.529999,46.529999,46.529999,45.340862,0 181 | 2019-04-01,48.150002,48.150002,46.880001,46.880001,45.681919,2118 182 | 2019-04-02,46.880001,46.880001,46.880001,46.880001,45.681919,0 183 | 2019-04-03,48.310001,48.310001,47.139999,47.139999,45.935276,841 184 | 2019-04-04,46.549999,46.599998,46.400002,46.400002,45.214188,18054 185 | 2019-04-05,47.755001,48.970001,47.755001,48.970001,47.718510,923 186 | 2019-04-08,48.025002,48.025002,48.025002,48.025002,46.797661,229 187 | 2019-04-09,49.160000,49.160000,48.689999,48.689999,47.445660,407 188 | 2019-04-10,47.200001,47.200001,47.200001,47.200001,45.993744,664 189 | 2019-04-11,45.820000,45.820000,45.820000,45.820000,45.820000,352 190 | 2019-04-12,45.820000,45.820000,45.820000,45.820000,45.820000,0 191 | 2019-04-15,49.500000,49.680000,48.000000,49.680000,49.680000,1399 192 | 2019-04-16,46.689999,46.689999,46.689999,46.689999,46.689999,363 193 | 2019-04-17,45.389999,45.709999,44.827202,45.709999,45.709999,10278 194 | 2019-04-18,47.099998,47.099998,45.904999,45.950001,45.950001,764 195 | 2019-04-22,44.480000,44.480000,44.480000,44.480000,44.480000,299 196 | 2019-04-23,47.209999,47.209999,47.209999,47.209999,47.209999,518 197 | 2019-04-24,44.935001,44.935001,44.935001,44.935001,44.935001,448 198 | 2019-04-25,46.180000,46.180000,46.180000,46.180000,46.180000,383 199 | 2019-04-26,43.700001,45.990002,43.700001,45.990002,45.990002,337 200 | 2019-04-29,45.119999,45.119999,45.119999,45.119999,45.119999,325 201 | 2019-04-30,44.834999,44.834999,44.834999,44.834999,44.834999,371 202 | 2019-05-01,44.500000,44.500000,44.500000,44.500000,44.500000,837 203 | 2019-05-02,45.500000,45.500000,45.500000,45.500000,45.500000,512 204 | 2019-05-03,45.500000,45.500000,45.500000,45.500000,45.500000,336 205 | 2019-05-06,45.500000,45.500000,45.500000,45.500000,45.500000,377 206 | 2019-05-07,44.110001,44.110001,43.500000,43.500000,43.500000,1538 207 | 2019-05-08,42.299999,42.299999,42.299999,42.299999,42.299999,555 208 | 2019-05-09,44.900002,44.900002,43.980000,43.980000,43.980000,557 209 | 2019-05-10,42.779999,45.259998,42.779999,45.259998,45.259998,410 210 | 2019-05-13,44.700001,44.700001,44.700001,44.700001,44.700001,523 211 | 2019-05-14,42.299999,42.299999,42.299999,42.299999,42.299999,485 212 | 2019-05-15,42.259998,42.259998,42.259998,42.259998,42.259998,487 213 | 2019-05-16,42.259998,42.259998,42.259998,42.259998,42.259998,0 214 | 2019-05-17,45.900002,45.900002,45.900002,45.900002,45.900002,210 215 | 2019-05-20,43.500000,44.540001,43.500000,44.540001,44.540001,625 216 | 2019-05-21,44.500000,44.500000,44.500000,44.500000,44.500000,381 217 | 2019-05-22,43.435001,43.930000,43.435001,43.930000,43.930000,325 218 | 2019-05-23,44.500000,44.500000,44.430000,44.430000,44.430000,969 219 | 2019-05-24,43.470001,43.470001,43.299999,43.299999,43.299999,1168 220 | 2019-05-28,43.270000,43.270000,43.270000,43.270000,43.270000,368 221 | 2019-05-29,42.189999,42.189999,42.189999,42.189999,42.189999,490 222 | 2019-05-30,43.669998,43.669998,42.959999,42.959999,42.959999,392 223 | 2019-05-31,42.959999,42.959999,42.959999,42.959999,42.959999,0 224 | 2019-06-03,42.959999,42.959999,42.959999,42.959999,42.959999,0 225 | 2019-06-04,44.070000,44.070000,41.860001,41.860001,41.860001,1808 226 | 2019-06-05,44.000000,44.340000,44.000000,44.340000,44.340000,779 227 | 2019-06-06,41.500000,41.500000,41.500000,41.500000,41.500000,502 228 | 2019-06-07,44.000000,44.500000,44.000000,44.250000,44.250000,4369 229 | 2019-06-10,44.259998,44.259998,44.259998,44.259998,44.259998,2461 230 | 2019-06-11,44.000000,44.099998,44.000000,44.099998,44.099998,3424 231 | 2019-06-12,44.500000,44.500000,44.250000,44.500000,44.500000,1681 232 | 2019-06-13,46.000000,46.000000,45.000000,45.750000,45.750000,1551 233 | 2019-06-14,43.460999,45.189999,43.460999,45.189999,45.189999,6990 234 | 2019-06-17,45.369999,45.369999,44.000000,44.750000,44.750000,1353 235 | 2019-06-18,45.130001,45.130001,44.250000,44.250000,44.250000,734 236 | 2019-06-19,45.750000,46.000000,44.450001,46.000000,46.000000,811 237 | 2019-06-20,45.849998,45.849998,45.849998,45.849998,45.849998,553 238 | 2019-06-21,45.750000,45.799999,45.750000,45.799999,45.799999,2475 239 | 2019-06-24,46.000000,46.000000,46.000000,46.000000,46.000000,719 240 | 2019-06-25,46.369999,46.369999,46.299999,46.299999,46.299999,985 241 | 2019-06-26,46.369999,46.369999,45.759998,45.759998,45.759998,1021 242 | 2019-06-27,45.759998,45.759998,45.759998,45.759998,45.759998,0 243 | 2019-06-28,46.509998,46.509998,46.509998,46.509998,46.509998,6919 244 | 2019-07-01,46.509998,46.509998,46.509998,46.509998,46.509998,0 245 | 2019-07-02,46.310001,46.310001,44.860001,45.584999,45.584999,517 246 | 2019-07-03,46.400002,46.400002,46.400002,46.400002,46.400002,1750 247 | 2019-07-05,46.349998,46.400002,46.349998,46.400002,46.400002,422 248 | 2019-07-08,46.400002,46.400002,46.400002,46.400002,46.400002,0 249 | 2019-07-09,43.779999,43.779999,43.779999,43.779999,43.779999,610 250 | 2019-07-10,44.775002,45.770000,44.700001,45.770000,45.770000,2156 251 | 2019-07-11,42.860001,42.860001,42.860001,42.860001,42.860001,306 252 | 2019-07-12,44.984402,46.509998,44.984402,45.450001,45.450001,492057 253 | -------------------------------------------------------------------------------- /dataset/FSV.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2018-05-23,71.050003,71.910004,71.050003,71.620003,71.106422,13000 3 | 2018-05-24,71.870003,71.919998,71.300003,71.449997,70.937630,28000 4 | 2018-05-25,71.760002,71.889999,71.528000,71.879997,71.364548,11900 5 | 2018-05-29,71.510002,71.510002,70.610001,70.800003,70.292305,17400 6 | 2018-05-30,71.419998,71.419998,70.480003,70.720001,70.212875,48300 7 | 2018-05-31,70.730003,70.860001,70.300003,70.389999,69.885231,13700 8 | 2018-06-01,70.489998,70.730003,70.050003,70.430000,69.924950,17700 9 | 2018-06-04,70.500000,70.739998,70.459999,70.639999,70.133446,8400 10 | 2018-06-05,70.919998,71.489998,70.629997,70.980003,70.471008,10800 11 | 2018-06-06,71.120003,72.169998,71.120003,71.790001,71.275200,12000 12 | 2018-06-07,72.250000,72.250000,71.662003,72.120003,71.602829,14900 13 | 2018-06-08,72.349998,72.519997,71.955002,72.419998,71.900681,11200 14 | 2018-06-11,72.620003,73.610001,72.269997,73.449997,72.923286,12500 15 | 2018-06-12,73.323997,73.680000,72.949997,73.510002,72.982864,11300 16 | 2018-06-13,74.290001,74.290001,73.550003,74.160004,73.628197,36400 17 | 2018-06-14,73.919998,74.709999,73.629997,74.250000,73.717560,11100 18 | 2018-06-15,74.370003,74.470001,73.690002,73.739998,73.211212,13000 19 | 2018-06-18,73.440002,74.098999,73.080002,73.980003,73.449493,10000 20 | 2018-06-19,73.220001,73.660004,73.089996,73.309998,72.784302,13000 21 | 2018-06-20,72.930000,74.250000,72.930000,74.089996,73.558701,29200 22 | 2018-06-21,73.739998,74.349998,73.739998,74.099998,73.568634,16900 23 | 2018-06-22,73.720001,74.599998,73.720001,74.269997,73.737419,15300 24 | 2018-06-25,73.879997,74.220001,73.815002,74.029999,73.499138,13500 25 | 2018-06-26,73.540001,74.540001,73.540001,74.339996,73.806908,20500 26 | 2018-06-27,73.959999,74.389999,73.650002,73.849998,73.320427,13900 27 | 2018-06-28,74.629997,75.300003,74.379997,75.059998,74.658226,11700 28 | 2018-06-29,75.050003,76.320000,75.050003,76.040001,75.632980,25700 29 | 2018-07-02,75.000000,77.930000,75.000000,77.930000,77.512863,10500 30 | 2018-07-03,77.129997,77.849998,75.830002,76.160004,75.752335,80400 31 | 2018-07-05,76.129997,77.620003,75.959999,77.050003,76.637581,48400 32 | 2018-07-06,77.680000,77.970001,77.300003,77.559998,77.144836,22800 33 | 2018-07-09,77.550003,78.730003,77.462997,78.370003,77.950508,53800 34 | 2018-07-10,78.665001,79.269997,78.260002,78.309998,77.890823,67100 35 | 2018-07-11,78.599998,78.980003,78.110001,78.629997,78.209114,67700 36 | 2018-07-12,78.809998,80.790001,78.489998,80.680000,80.248138,74400 37 | 2018-07-13,80.570000,80.570000,78.559998,78.820000,78.398102,20300 38 | 2018-07-16,78.849998,78.849998,77.959000,78.250000,77.831154,16000 39 | 2018-07-17,78.349998,78.629997,77.800003,77.940002,77.522812,21700 40 | 2018-07-18,77.290001,78.099998,77.279999,77.940002,77.522812,15200 41 | 2018-07-19,77.870003,78.690002,77.830002,78.055000,77.637192,13500 42 | 2018-07-20,78.070000,79.209999,77.639999,78.959999,78.537346,17800 43 | 2018-07-23,78.949997,78.949997,78.044998,78.519997,78.099701,10700 44 | 2018-07-24,78.550003,78.559998,77.790001,78.480003,78.059921,21600 45 | 2018-07-25,79.190002,85.269997,79.150002,83.959999,83.510582,44800 46 | 2018-07-26,84.949997,86.050003,83.250000,85.099998,84.644478,22700 47 | 2018-07-27,85.320000,85.320000,83.010002,84.050003,83.600105,20200 48 | 2018-07-30,83.040001,83.430000,81.940002,82.269997,81.829620,20900 49 | 2018-07-31,82.459999,83.620003,82.260002,83.180000,82.734756,23700 50 | 2018-08-01,82.540001,83.739998,81.800003,82.889999,82.446312,17800 51 | 2018-08-02,82.879997,83.190002,81.900002,83.120003,82.675087,43100 52 | 2018-08-03,83.379997,83.489998,81.849998,82.190002,81.750053,16700 53 | 2018-08-06,83.800003,83.800003,82.040001,83.010002,82.565674,7200 54 | 2018-08-07,82.849998,82.849998,81.070000,81.330002,80.894661,16600 55 | 2018-08-08,80.930000,82.809998,80.930000,82.570000,82.128021,18100 56 | 2018-08-09,83.040001,83.139999,82.160004,82.209999,81.769951,18500 57 | 2018-08-10,82.199997,83.160004,81.510002,82.440002,81.998726,42100 58 | 2018-08-13,82.449997,84.389999,80.820000,81.720001,81.282578,17100 59 | 2018-08-14,81.540001,82.790001,81.440002,82.269997,81.829620,13000 60 | 2018-08-15,82.260002,82.389999,81.580002,82.139999,81.700325,16500 61 | 2018-08-16,82.199997,82.980003,82.199997,82.480003,82.038513,30500 62 | 2018-08-17,82.629997,86.440002,82.629997,85.370003,84.913040,67100 63 | 2018-08-20,86.059998,86.059998,84.620003,85.000000,84.545013,25800 64 | 2018-08-21,85.690002,86.129997,85.129997,86.040001,85.579445,16300 65 | 2018-08-22,86.029999,86.305000,85.620003,86.059998,85.599342,20500 66 | 2018-08-23,86.050003,86.224998,85.550003,85.629997,85.171638,18100 67 | 2018-08-24,86.209999,86.889999,85.750000,86.489998,86.027039,25000 68 | 2018-08-27,87.239998,87.989998,86.269997,87.720001,87.250458,31100 69 | 2018-08-28,88.139999,88.430000,87.230003,87.540001,87.071419,24500 70 | 2018-08-29,87.550003,90.205002,86.860001,87.290001,86.822762,32300 71 | 2018-08-30,87.169998,87.309998,86.169998,86.430000,85.967361,15100 72 | 2018-08-31,86.199997,86.199997,85.250000,85.860001,85.400414,23600 73 | 2018-09-04,86.089996,86.089996,83.879997,85.750000,85.291008,28200 74 | 2018-09-05,85.120003,86.010002,85.120003,85.680000,85.221382,20600 75 | 2018-09-06,86.510002,87.190002,85.709999,87.190002,86.723305,17500 76 | 2018-09-07,86.610001,87.540001,86.430000,86.690002,86.225975,7300 77 | 2018-09-10,87.059998,87.565002,86.674004,87.279999,86.812813,22700 78 | 2018-09-11,87.290001,87.440002,85.440002,85.940002,85.479988,18600 79 | 2018-09-12,86.860001,86.860001,85.680000,86.250000,85.788330,24400 80 | 2018-09-13,86.570000,86.739998,85.279999,85.570000,85.111969,14600 81 | 2018-09-14,85.199997,86.070000,85.183998,85.400002,84.942871,17800 82 | 2018-09-17,84.599998,85.769997,84.580002,85.430000,84.972717,9100 83 | 2018-09-18,85.699997,86.620003,85.570000,86.169998,85.708755,21900 84 | 2018-09-19,86.430000,86.430000,84.739998,84.790001,84.336143,17400 85 | 2018-09-20,85.180000,85.910004,84.860001,85.139999,84.684265,10900 86 | 2018-09-21,85.379997,85.379997,84.339996,84.889999,84.435608,16500 87 | 2018-09-24,84.860001,85.199997,84.629997,84.690002,84.236679,19500 88 | 2018-09-25,84.750000,85.000000,84.538002,84.900002,84.445549,32800 89 | 2018-09-26,84.820000,84.970001,82.639999,83.120003,82.675087,25900 90 | 2018-09-27,83.110001,83.698997,82.699997,83.589996,83.277817,21600 91 | 2018-09-28,83.820000,85.260002,83.820000,84.660004,84.343834,38200 92 | 2018-10-01,85.199997,86.080002,83.709999,84.150002,83.835732,20700 93 | 2018-10-02,84.110001,84.120003,82.855003,83.139999,82.829498,15000 94 | 2018-10-03,83.150002,83.550003,82.580002,83.000000,82.690025,15200 95 | 2018-10-04,83.454002,83.454002,82.010002,82.769997,82.460884,23900 96 | 2018-10-05,82.599998,83.250000,82.010002,82.470001,82.162010,12200 97 | 2018-10-08,82.139999,82.139999,80.879997,80.879997,80.577942,15100 98 | 2018-10-09,80.669998,81.720001,80.620003,80.839996,80.538086,56000 99 | 2018-10-10,80.849998,80.849998,78.449997,78.449997,78.157021,31100 100 | 2018-10-11,78.430000,79.389999,78.184998,78.620003,78.326385,21600 101 | 2018-10-12,79.449997,79.860001,78.315002,78.680000,78.386162,16300 102 | 2018-10-15,78.639999,79.089996,78.000000,78.320000,78.027504,20300 103 | 2018-10-16,79.180000,80.230003,79.000000,79.830002,79.531868,88500 104 | 2018-10-17,79.639999,80.080002,79.135002,79.589996,79.292755,98200 105 | 2018-10-18,78.980003,80.349998,78.980003,79.629997,79.332603,32900 106 | 2018-10-19,80.290001,81.949997,80.269997,81.430000,81.125893,23300 107 | 2018-10-22,81.940002,82.510002,81.370003,81.559998,81.255402,27400 108 | 2018-10-23,81.080002,81.080002,78.089996,78.470001,78.176941,24100 109 | 2018-10-24,77.720001,78.739998,74.750000,75.820000,75.536835,78400 110 | 2018-10-25,76.540001,76.540001,73.989998,74.440002,74.161995,30400 111 | 2018-10-26,73.279999,73.639999,72.059998,72.330002,72.059875,33400 112 | 2018-10-29,72.320000,72.779999,70.970001,71.190002,70.924133,31700 113 | 2018-10-30,70.750000,71.669998,70.750000,71.500000,71.232971,29100 114 | 2018-10-31,72.489998,74.010002,72.099998,73.400002,73.125885,91300 115 | 2018-11-01,74.199997,75.339996,72.790001,75.010002,74.729866,133600 116 | 2018-11-02,75.500000,75.760002,74.720001,75.339996,75.058632,138300 117 | 2018-11-05,75.330002,75.660004,73.900002,74.300003,74.022522,47400 118 | 2018-11-06,74.389999,74.889999,73.949997,74.699997,74.421021,22800 119 | 2018-11-07,75.169998,75.360001,74.540001,74.970001,74.690018,38900 120 | 2018-11-08,75.540001,75.570000,74.949997,75.260002,74.978935,11300 121 | 2018-11-09,75.239998,75.239998,73.894997,74.500000,74.221764,17000 122 | 2018-11-12,74.455002,74.629997,73.964996,74.349998,74.072327,81200 123 | 2018-11-13,74.339996,75.290001,73.760002,74.320000,74.042442,278800 124 | 2018-11-14,74.360001,74.900002,74.360001,74.540001,74.261620,30100 125 | 2018-11-15,74.274002,74.300003,72.379997,72.559998,72.289017,72200 126 | 2018-11-16,72.430000,73.410004,72.040001,73.290001,73.016296,48300 127 | 2018-11-19,73.589996,73.650002,72.849998,73.250000,72.976440,67000 128 | 2018-11-20,72.209999,73.190002,71.910004,72.790001,72.518158,75900 129 | 2018-11-21,72.800003,73.970001,72.419998,73.900002,73.624008,102500 130 | 2018-11-23,73.440002,73.720001,72.000000,73.160004,72.886780,14100 131 | 2018-11-26,73.209999,74.660004,73.209999,74.199997,73.922882,33800 132 | 2018-11-27,74.040001,74.290001,73.610001,74.070000,73.793373,35100 133 | 2018-11-28,74.080002,74.650002,73.709999,74.410004,74.132111,27500 134 | 2018-11-29,74.690002,75.385002,73.860001,74.870003,74.590393,28600 135 | 2018-11-30,74.879997,75.849998,74.669998,75.639999,75.357513,24900 136 | 2018-12-03,76.860001,77.820000,75.639999,77.650002,77.360008,34700 137 | 2018-12-04,77.639999,78.279999,75.764999,76.269997,75.985153,69500 138 | 2018-12-06,75.809998,75.930000,73.790001,75.930000,75.646423,49100 139 | 2018-12-07,75.919998,76.650002,74.209999,74.820000,74.540573,21500 140 | 2018-12-10,74.970001,74.989998,72.800003,73.089996,72.817032,28800 141 | 2018-12-11,73.459999,73.480003,72.599998,72.650002,72.378685,20600 142 | 2018-12-12,73.519997,73.760002,72.800003,72.919998,72.647667,18200 143 | 2018-12-13,72.540001,72.919998,71.529999,71.639999,71.372452,19200 144 | 2018-12-14,71.419998,71.419998,69.870003,70.550003,70.286522,37900 145 | 2018-12-17,69.989998,70.139999,66.930000,67.139999,66.889259,45600 146 | 2018-12-18,67.489998,69.160004,67.400002,68.440002,68.184402,78500 147 | 2018-12-19,68.430000,70.050003,68.080002,68.320000,68.064850,42600 148 | 2018-12-20,68.639999,68.639999,65.339996,65.769997,65.524368,40600 149 | 2018-12-21,65.730003,67.199997,65.029999,65.959999,65.713661,78100 150 | 2018-12-24,65.775002,66.610001,65.529999,66.410004,66.161987,39200 151 | 2018-12-26,67.019997,67.190002,65.279999,66.550003,66.301460,50800 152 | 2018-12-27,65.910004,67.239998,64.870003,67.169998,66.919144,33100 153 | 2018-12-28,67.629997,68.779999,67.589996,68.139999,68.022232,47700 154 | 2018-12-31,68.199997,68.860001,67.849998,68.480003,68.361649,44200 155 | 2019-01-02,68.250000,68.339996,66.834999,67.230003,67.113808,35100 156 | 2019-01-03,67.250000,67.599998,65.550003,66.080002,65.965797,29900 157 | 2019-01-04,66.320000,69.290001,66.320000,69.290001,69.170250,48800 158 | 2019-01-07,69.610001,71.559998,69.344002,71.199997,71.076942,26500 159 | 2019-01-08,71.269997,72.230003,71.269997,71.870003,71.745789,17200 160 | 2019-01-09,71.860001,72.720001,71.230003,72.660004,72.534424,21600 161 | 2019-01-10,73.000000,73.400002,72.349998,73.029999,72.903778,15700 162 | 2019-01-11,73.260002,73.279999,72.199997,72.860001,72.734077,70700 163 | 2019-01-14,72.470001,73.419998,72.139999,73.349998,73.223228,182300 164 | 2019-01-15,74.430000,74.430000,73.239998,73.790001,73.662468,27400 165 | 2019-01-16,74.250000,74.480003,73.622002,74.239998,74.111687,18200 166 | 2019-01-17,74.599998,75.680000,74.485001,75.430000,75.299637,34700 167 | 2019-01-18,75.510002,76.769997,75.360001,76.379997,76.247993,24100 168 | 2019-01-22,75.330002,76.790001,74.370003,76.790001,76.657288,60400 169 | 2019-01-23,77.239998,77.970001,77.190002,77.739998,77.605637,35000 170 | 2019-01-24,77.940002,78.760002,77.940002,78.589996,78.454170,11100 171 | 2019-01-25,78.839996,80.720001,78.839996,80.459999,80.320938,37300 172 | 2019-01-28,80.360001,81.190002,79.834999,80.589996,80.450714,29600 173 | 2019-01-29,80.580002,81.830002,80.360001,80.769997,80.630402,25600 174 | 2019-01-30,81.139999,81.209999,80.004997,80.940002,80.800117,21300 175 | 2019-01-31,80.980003,81.949997,80.779999,81.279999,81.139526,37200 176 | 2019-02-01,81.279999,82.029999,80.980003,81.709999,81.568779,64700 177 | 2019-02-04,81.720001,82.330002,81.430000,82.190002,82.047951,49500 178 | 2019-02-05,81.889999,83.769997,81.889999,83.480003,83.335724,23100 179 | 2019-02-06,83.750000,84.760002,83.019997,83.779999,83.635201,57900 180 | 2019-02-07,83.400002,84.849998,83.000000,83.889999,83.745010,46100 181 | 2019-02-08,84.160004,84.870003,83.809998,84.709999,84.563599,57000 182 | 2019-02-11,85.059998,85.300003,84.419998,84.769997,84.623489,57500 183 | 2019-02-12,85.440002,87.440002,85.254997,87.129997,86.979408,44700 184 | 2019-02-13,87.610001,89.169998,87.610001,88.629997,88.476822,34300 185 | 2019-02-14,88.239998,88.389999,87.019997,87.839996,87.688179,28100 186 | 2019-02-15,87.910004,87.910004,87.110001,87.260002,87.109192,43200 187 | 2019-02-19,87.650002,87.650002,86.040001,86.800003,86.649986,47400 188 | 2019-02-20,86.410004,87.839996,86.220001,87.620003,87.468567,34100 189 | 2019-02-21,87.779999,87.900002,87.150002,87.580002,87.428635,23300 190 | 2019-02-22,88.029999,88.400002,87.459999,88.290001,88.137413,29600 191 | 2019-02-25,88.519997,88.930000,87.059998,87.110001,86.959450,19700 192 | 2019-02-26,87.120003,87.910004,86.720001,87.639999,87.488533,29600 193 | 2019-02-27,87.589996,87.589996,86.584999,87.199997,87.049286,18400 194 | 2019-02-28,86.949997,87.059998,86.379997,86.839996,86.689911,32800 195 | 2019-03-01,87.150002,87.150002,85.660004,86.500000,86.350502,38600 196 | 2019-03-04,86.410004,87.510002,86.160004,87.019997,86.869598,32900 197 | 2019-03-05,86.900002,88.070000,86.820000,87.940002,87.788017,23600 198 | 2019-03-06,87.489998,87.489998,86.639999,87.059998,86.909531,25500 199 | 2019-03-07,87.410004,87.410004,86.040001,86.779999,86.630020,34000 200 | 2019-03-08,86.540001,86.750000,85.199997,85.570000,85.422112,24000 201 | 2019-03-11,85.949997,86.980003,85.010002,86.739998,86.590088,24100 202 | 2019-03-12,86.889999,86.889999,85.900002,86.650002,86.500244,13500 203 | 2019-03-13,86.720001,87.099998,83.680000,84.260002,84.114372,62500 204 | 2019-03-14,84.320000,85.510002,83.959999,85.269997,85.122627,51900 205 | 2019-03-15,85.150002,85.550003,83.910004,84.400002,84.254135,34300 206 | 2019-03-18,84.879997,85.230003,83.699997,84.260002,84.114372,32700 207 | 2019-03-19,84.849998,85.059998,83.980003,83.980003,83.834862,21700 208 | 2019-03-20,83.690002,84.330002,83.220001,83.970001,83.824875,43400 209 | 2019-03-21,84.050003,85.440002,83.940002,85.370003,85.222458,26700 210 | 2019-03-22,84.910004,85.150002,84.019997,84.019997,83.874786,30500 211 | 2019-03-25,83.900002,85.269997,83.400002,85.220001,85.072716,34400 212 | 2019-03-26,85.820000,86.019997,84.849998,85.809998,85.661690,31200 213 | 2019-03-27,85.029999,86.970001,85.029999,86.790001,86.639999,28800 214 | 2019-03-28,86.800003,88.084999,86.650002,87.699997,87.699997,22400 215 | 2019-03-29,88.419998,89.669998,87.699997,89.339996,89.339996,40500 216 | 2019-04-01,89.360001,89.949997,88.199997,89.620003,89.620003,42500 217 | 2019-04-02,89.919998,89.919998,88.300003,88.720001,88.720001,27600 218 | 2019-04-03,89.320000,89.320000,88.260002,88.449997,88.449997,25100 219 | 2019-04-04,88.889999,88.889999,87.930000,88.190002,88.190002,29400 220 | 2019-04-05,88.285004,88.430000,87.629997,88.070000,88.070000,23700 221 | 2019-04-08,88.070000,88.495003,87.199997,87.739998,87.739998,18700 222 | 2019-04-09,87.930000,88.360001,87.830002,88.070000,88.070000,24700 223 | 2019-04-10,88.430000,89.660004,88.120003,89.209999,89.209999,20900 224 | 2019-04-11,89.529999,89.529999,88.139999,88.300003,88.300003,21000 225 | 2019-04-12,88.139999,89.639999,88.092003,89.589996,89.589996,18500 226 | 2019-04-15,89.129997,89.779999,89.129997,89.389999,89.389999,20700 227 | 2019-04-16,89.639999,89.879997,88.139999,88.209999,88.209999,17200 228 | 2019-04-17,88.830002,88.830002,85.410004,86.480003,86.480003,53800 229 | 2019-04-18,86.470001,87.470001,85.800003,87.050003,87.050003,17400 230 | 2019-04-22,86.589996,87.849998,86.589996,87.419998,87.419998,14500 231 | 2019-04-23,86.830002,88.110001,86.639999,88.110001,88.110001,21200 232 | 2019-04-24,83.769997,87.589996,83.769997,87.269997,87.269997,34800 233 | 2019-04-25,87.070000,87.839996,86.925003,87.669998,87.669998,18500 234 | 2019-04-26,87.650002,87.769997,86.699997,86.970001,86.970001,22500 235 | 2019-04-29,86.550003,86.669998,83.019997,86.360001,86.360001,22800 236 | 2019-04-30,87.014000,87.349998,86.410004,87.220001,87.220001,33700 237 | 2019-05-01,88.141998,88.141998,86.985001,87.129997,87.129997,43100 238 | 2019-05-02,87.180000,87.474998,86.610001,87.379997,87.379997,26600 239 | 2019-05-03,87.449997,88.120003,87.449997,87.940002,87.940002,35600 240 | 2019-05-06,86.970001,87.800003,86.970001,87.620003,87.620003,28600 241 | 2019-05-07,86.419998,86.699997,85.970001,86.599998,86.599998,29300 242 | 2019-05-08,87.010002,87.010002,85.930000,86.379997,86.379997,50800 243 | 2019-05-09,85.919998,86.150002,85.476997,85.790001,85.790001,37400 244 | 2019-05-10,86.070000,86.889999,85.510002,86.889999,86.889999,63800 245 | 2019-05-13,86.309998,86.455002,85.169998,86.040001,86.040001,24400 246 | 2019-05-14,85.800003,86.370003,85.610001,86.070000,86.070000,34400 247 | 2019-05-15,86.489998,87.680000,85.690002,86.970001,86.970001,46700 248 | 2019-05-16,87.730003,89.209999,87.540001,89.010002,89.010002,51300 249 | 2019-05-17,89.029999,89.519997,87.110001,87.790001,87.790001,29900 250 | 2019-05-20,85.930000,89.010002,85.930000,86.620003,86.620003,19000 251 | 2019-05-21,87.959999,88.010002,86.089996,86.290001,86.290001,51600 252 | 2019-05-22,86.269997,86.480003,85.260002,86.129997,86.129997,49400 253 | 2019-05-23,88.639999,93.860001,88.014999,93.500000,93.500000,115185 254 | -------------------------------------------------------------------------------- /realtime-agent/FSV.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2018-05-23,71.050003,71.910004,71.050003,71.620003,71.106422,13000 3 | 2018-05-24,71.870003,71.919998,71.300003,71.449997,70.937630,28000 4 | 2018-05-25,71.760002,71.889999,71.528000,71.879997,71.364548,11900 5 | 2018-05-29,71.510002,71.510002,70.610001,70.800003,70.292305,17400 6 | 2018-05-30,71.419998,71.419998,70.480003,70.720001,70.212875,48300 7 | 2018-05-31,70.730003,70.860001,70.300003,70.389999,69.885231,13700 8 | 2018-06-01,70.489998,70.730003,70.050003,70.430000,69.924950,17700 9 | 2018-06-04,70.500000,70.739998,70.459999,70.639999,70.133446,8400 10 | 2018-06-05,70.919998,71.489998,70.629997,70.980003,70.471008,10800 11 | 2018-06-06,71.120003,72.169998,71.120003,71.790001,71.275200,12000 12 | 2018-06-07,72.250000,72.250000,71.662003,72.120003,71.602829,14900 13 | 2018-06-08,72.349998,72.519997,71.955002,72.419998,71.900681,11200 14 | 2018-06-11,72.620003,73.610001,72.269997,73.449997,72.923286,12500 15 | 2018-06-12,73.323997,73.680000,72.949997,73.510002,72.982864,11300 16 | 2018-06-13,74.290001,74.290001,73.550003,74.160004,73.628197,36400 17 | 2018-06-14,73.919998,74.709999,73.629997,74.250000,73.717560,11100 18 | 2018-06-15,74.370003,74.470001,73.690002,73.739998,73.211212,13000 19 | 2018-06-18,73.440002,74.098999,73.080002,73.980003,73.449493,10000 20 | 2018-06-19,73.220001,73.660004,73.089996,73.309998,72.784302,13000 21 | 2018-06-20,72.930000,74.250000,72.930000,74.089996,73.558701,29200 22 | 2018-06-21,73.739998,74.349998,73.739998,74.099998,73.568634,16900 23 | 2018-06-22,73.720001,74.599998,73.720001,74.269997,73.737419,15300 24 | 2018-06-25,73.879997,74.220001,73.815002,74.029999,73.499138,13500 25 | 2018-06-26,73.540001,74.540001,73.540001,74.339996,73.806908,20500 26 | 2018-06-27,73.959999,74.389999,73.650002,73.849998,73.320427,13900 27 | 2018-06-28,74.629997,75.300003,74.379997,75.059998,74.658226,11700 28 | 2018-06-29,75.050003,76.320000,75.050003,76.040001,75.632980,25700 29 | 2018-07-02,75.000000,77.930000,75.000000,77.930000,77.512863,10500 30 | 2018-07-03,77.129997,77.849998,75.830002,76.160004,75.752335,80400 31 | 2018-07-05,76.129997,77.620003,75.959999,77.050003,76.637581,48400 32 | 2018-07-06,77.680000,77.970001,77.300003,77.559998,77.144836,22800 33 | 2018-07-09,77.550003,78.730003,77.462997,78.370003,77.950508,53800 34 | 2018-07-10,78.665001,79.269997,78.260002,78.309998,77.890823,67100 35 | 2018-07-11,78.599998,78.980003,78.110001,78.629997,78.209114,67700 36 | 2018-07-12,78.809998,80.790001,78.489998,80.680000,80.248138,74400 37 | 2018-07-13,80.570000,80.570000,78.559998,78.820000,78.398102,20300 38 | 2018-07-16,78.849998,78.849998,77.959000,78.250000,77.831154,16000 39 | 2018-07-17,78.349998,78.629997,77.800003,77.940002,77.522812,21700 40 | 2018-07-18,77.290001,78.099998,77.279999,77.940002,77.522812,15200 41 | 2018-07-19,77.870003,78.690002,77.830002,78.055000,77.637192,13500 42 | 2018-07-20,78.070000,79.209999,77.639999,78.959999,78.537346,17800 43 | 2018-07-23,78.949997,78.949997,78.044998,78.519997,78.099701,10700 44 | 2018-07-24,78.550003,78.559998,77.790001,78.480003,78.059921,21600 45 | 2018-07-25,79.190002,85.269997,79.150002,83.959999,83.510582,44800 46 | 2018-07-26,84.949997,86.050003,83.250000,85.099998,84.644478,22700 47 | 2018-07-27,85.320000,85.320000,83.010002,84.050003,83.600105,20200 48 | 2018-07-30,83.040001,83.430000,81.940002,82.269997,81.829620,20900 49 | 2018-07-31,82.459999,83.620003,82.260002,83.180000,82.734756,23700 50 | 2018-08-01,82.540001,83.739998,81.800003,82.889999,82.446312,17800 51 | 2018-08-02,82.879997,83.190002,81.900002,83.120003,82.675087,43100 52 | 2018-08-03,83.379997,83.489998,81.849998,82.190002,81.750053,16700 53 | 2018-08-06,83.800003,83.800003,82.040001,83.010002,82.565674,7200 54 | 2018-08-07,82.849998,82.849998,81.070000,81.330002,80.894661,16600 55 | 2018-08-08,80.930000,82.809998,80.930000,82.570000,82.128021,18100 56 | 2018-08-09,83.040001,83.139999,82.160004,82.209999,81.769951,18500 57 | 2018-08-10,82.199997,83.160004,81.510002,82.440002,81.998726,42100 58 | 2018-08-13,82.449997,84.389999,80.820000,81.720001,81.282578,17100 59 | 2018-08-14,81.540001,82.790001,81.440002,82.269997,81.829620,13000 60 | 2018-08-15,82.260002,82.389999,81.580002,82.139999,81.700325,16500 61 | 2018-08-16,82.199997,82.980003,82.199997,82.480003,82.038513,30500 62 | 2018-08-17,82.629997,86.440002,82.629997,85.370003,84.913040,67100 63 | 2018-08-20,86.059998,86.059998,84.620003,85.000000,84.545013,25800 64 | 2018-08-21,85.690002,86.129997,85.129997,86.040001,85.579445,16300 65 | 2018-08-22,86.029999,86.305000,85.620003,86.059998,85.599342,20500 66 | 2018-08-23,86.050003,86.224998,85.550003,85.629997,85.171638,18100 67 | 2018-08-24,86.209999,86.889999,85.750000,86.489998,86.027039,25000 68 | 2018-08-27,87.239998,87.989998,86.269997,87.720001,87.250458,31100 69 | 2018-08-28,88.139999,88.430000,87.230003,87.540001,87.071419,24500 70 | 2018-08-29,87.550003,90.205002,86.860001,87.290001,86.822762,32300 71 | 2018-08-30,87.169998,87.309998,86.169998,86.430000,85.967361,15100 72 | 2018-08-31,86.199997,86.199997,85.250000,85.860001,85.400414,23600 73 | 2018-09-04,86.089996,86.089996,83.879997,85.750000,85.291008,28200 74 | 2018-09-05,85.120003,86.010002,85.120003,85.680000,85.221382,20600 75 | 2018-09-06,86.510002,87.190002,85.709999,87.190002,86.723305,17500 76 | 2018-09-07,86.610001,87.540001,86.430000,86.690002,86.225975,7300 77 | 2018-09-10,87.059998,87.565002,86.674004,87.279999,86.812813,22700 78 | 2018-09-11,87.290001,87.440002,85.440002,85.940002,85.479988,18600 79 | 2018-09-12,86.860001,86.860001,85.680000,86.250000,85.788330,24400 80 | 2018-09-13,86.570000,86.739998,85.279999,85.570000,85.111969,14600 81 | 2018-09-14,85.199997,86.070000,85.183998,85.400002,84.942871,17800 82 | 2018-09-17,84.599998,85.769997,84.580002,85.430000,84.972717,9100 83 | 2018-09-18,85.699997,86.620003,85.570000,86.169998,85.708755,21900 84 | 2018-09-19,86.430000,86.430000,84.739998,84.790001,84.336143,17400 85 | 2018-09-20,85.180000,85.910004,84.860001,85.139999,84.684265,10900 86 | 2018-09-21,85.379997,85.379997,84.339996,84.889999,84.435608,16500 87 | 2018-09-24,84.860001,85.199997,84.629997,84.690002,84.236679,19500 88 | 2018-09-25,84.750000,85.000000,84.538002,84.900002,84.445549,32800 89 | 2018-09-26,84.820000,84.970001,82.639999,83.120003,82.675087,25900 90 | 2018-09-27,83.110001,83.698997,82.699997,83.589996,83.277817,21600 91 | 2018-09-28,83.820000,85.260002,83.820000,84.660004,84.343834,38200 92 | 2018-10-01,85.199997,86.080002,83.709999,84.150002,83.835732,20700 93 | 2018-10-02,84.110001,84.120003,82.855003,83.139999,82.829498,15000 94 | 2018-10-03,83.150002,83.550003,82.580002,83.000000,82.690025,15200 95 | 2018-10-04,83.454002,83.454002,82.010002,82.769997,82.460884,23900 96 | 2018-10-05,82.599998,83.250000,82.010002,82.470001,82.162010,12200 97 | 2018-10-08,82.139999,82.139999,80.879997,80.879997,80.577942,15100 98 | 2018-10-09,80.669998,81.720001,80.620003,80.839996,80.538086,56000 99 | 2018-10-10,80.849998,80.849998,78.449997,78.449997,78.157021,31100 100 | 2018-10-11,78.430000,79.389999,78.184998,78.620003,78.326385,21600 101 | 2018-10-12,79.449997,79.860001,78.315002,78.680000,78.386162,16300 102 | 2018-10-15,78.639999,79.089996,78.000000,78.320000,78.027504,20300 103 | 2018-10-16,79.180000,80.230003,79.000000,79.830002,79.531868,88500 104 | 2018-10-17,79.639999,80.080002,79.135002,79.589996,79.292755,98200 105 | 2018-10-18,78.980003,80.349998,78.980003,79.629997,79.332603,32900 106 | 2018-10-19,80.290001,81.949997,80.269997,81.430000,81.125893,23300 107 | 2018-10-22,81.940002,82.510002,81.370003,81.559998,81.255402,27400 108 | 2018-10-23,81.080002,81.080002,78.089996,78.470001,78.176941,24100 109 | 2018-10-24,77.720001,78.739998,74.750000,75.820000,75.536835,78400 110 | 2018-10-25,76.540001,76.540001,73.989998,74.440002,74.161995,30400 111 | 2018-10-26,73.279999,73.639999,72.059998,72.330002,72.059875,33400 112 | 2018-10-29,72.320000,72.779999,70.970001,71.190002,70.924133,31700 113 | 2018-10-30,70.750000,71.669998,70.750000,71.500000,71.232971,29100 114 | 2018-10-31,72.489998,74.010002,72.099998,73.400002,73.125885,91300 115 | 2018-11-01,74.199997,75.339996,72.790001,75.010002,74.729866,133600 116 | 2018-11-02,75.500000,75.760002,74.720001,75.339996,75.058632,138300 117 | 2018-11-05,75.330002,75.660004,73.900002,74.300003,74.022522,47400 118 | 2018-11-06,74.389999,74.889999,73.949997,74.699997,74.421021,22800 119 | 2018-11-07,75.169998,75.360001,74.540001,74.970001,74.690018,38900 120 | 2018-11-08,75.540001,75.570000,74.949997,75.260002,74.978935,11300 121 | 2018-11-09,75.239998,75.239998,73.894997,74.500000,74.221764,17000 122 | 2018-11-12,74.455002,74.629997,73.964996,74.349998,74.072327,81200 123 | 2018-11-13,74.339996,75.290001,73.760002,74.320000,74.042442,278800 124 | 2018-11-14,74.360001,74.900002,74.360001,74.540001,74.261620,30100 125 | 2018-11-15,74.274002,74.300003,72.379997,72.559998,72.289017,72200 126 | 2018-11-16,72.430000,73.410004,72.040001,73.290001,73.016296,48300 127 | 2018-11-19,73.589996,73.650002,72.849998,73.250000,72.976440,67000 128 | 2018-11-20,72.209999,73.190002,71.910004,72.790001,72.518158,75900 129 | 2018-11-21,72.800003,73.970001,72.419998,73.900002,73.624008,102500 130 | 2018-11-23,73.440002,73.720001,72.000000,73.160004,72.886780,14100 131 | 2018-11-26,73.209999,74.660004,73.209999,74.199997,73.922882,33800 132 | 2018-11-27,74.040001,74.290001,73.610001,74.070000,73.793373,35100 133 | 2018-11-28,74.080002,74.650002,73.709999,74.410004,74.132111,27500 134 | 2018-11-29,74.690002,75.385002,73.860001,74.870003,74.590393,28600 135 | 2018-11-30,74.879997,75.849998,74.669998,75.639999,75.357513,24900 136 | 2018-12-03,76.860001,77.820000,75.639999,77.650002,77.360008,34700 137 | 2018-12-04,77.639999,78.279999,75.764999,76.269997,75.985153,69500 138 | 2018-12-06,75.809998,75.930000,73.790001,75.930000,75.646423,49100 139 | 2018-12-07,75.919998,76.650002,74.209999,74.820000,74.540573,21500 140 | 2018-12-10,74.970001,74.989998,72.800003,73.089996,72.817032,28800 141 | 2018-12-11,73.459999,73.480003,72.599998,72.650002,72.378685,20600 142 | 2018-12-12,73.519997,73.760002,72.800003,72.919998,72.647667,18200 143 | 2018-12-13,72.540001,72.919998,71.529999,71.639999,71.372452,19200 144 | 2018-12-14,71.419998,71.419998,69.870003,70.550003,70.286522,37900 145 | 2018-12-17,69.989998,70.139999,66.930000,67.139999,66.889259,45600 146 | 2018-12-18,67.489998,69.160004,67.400002,68.440002,68.184402,78500 147 | 2018-12-19,68.430000,70.050003,68.080002,68.320000,68.064850,42600 148 | 2018-12-20,68.639999,68.639999,65.339996,65.769997,65.524368,40600 149 | 2018-12-21,65.730003,67.199997,65.029999,65.959999,65.713661,78100 150 | 2018-12-24,65.775002,66.610001,65.529999,66.410004,66.161987,39200 151 | 2018-12-26,67.019997,67.190002,65.279999,66.550003,66.301460,50800 152 | 2018-12-27,65.910004,67.239998,64.870003,67.169998,66.919144,33100 153 | 2018-12-28,67.629997,68.779999,67.589996,68.139999,68.022232,47700 154 | 2018-12-31,68.199997,68.860001,67.849998,68.480003,68.361649,44200 155 | 2019-01-02,68.250000,68.339996,66.834999,67.230003,67.113808,35100 156 | 2019-01-03,67.250000,67.599998,65.550003,66.080002,65.965797,29900 157 | 2019-01-04,66.320000,69.290001,66.320000,69.290001,69.170250,48800 158 | 2019-01-07,69.610001,71.559998,69.344002,71.199997,71.076942,26500 159 | 2019-01-08,71.269997,72.230003,71.269997,71.870003,71.745789,17200 160 | 2019-01-09,71.860001,72.720001,71.230003,72.660004,72.534424,21600 161 | 2019-01-10,73.000000,73.400002,72.349998,73.029999,72.903778,15700 162 | 2019-01-11,73.260002,73.279999,72.199997,72.860001,72.734077,70700 163 | 2019-01-14,72.470001,73.419998,72.139999,73.349998,73.223228,182300 164 | 2019-01-15,74.430000,74.430000,73.239998,73.790001,73.662468,27400 165 | 2019-01-16,74.250000,74.480003,73.622002,74.239998,74.111687,18200 166 | 2019-01-17,74.599998,75.680000,74.485001,75.430000,75.299637,34700 167 | 2019-01-18,75.510002,76.769997,75.360001,76.379997,76.247993,24100 168 | 2019-01-22,75.330002,76.790001,74.370003,76.790001,76.657288,60400 169 | 2019-01-23,77.239998,77.970001,77.190002,77.739998,77.605637,35000 170 | 2019-01-24,77.940002,78.760002,77.940002,78.589996,78.454170,11100 171 | 2019-01-25,78.839996,80.720001,78.839996,80.459999,80.320938,37300 172 | 2019-01-28,80.360001,81.190002,79.834999,80.589996,80.450714,29600 173 | 2019-01-29,80.580002,81.830002,80.360001,80.769997,80.630402,25600 174 | 2019-01-30,81.139999,81.209999,80.004997,80.940002,80.800117,21300 175 | 2019-01-31,80.980003,81.949997,80.779999,81.279999,81.139526,37200 176 | 2019-02-01,81.279999,82.029999,80.980003,81.709999,81.568779,64700 177 | 2019-02-04,81.720001,82.330002,81.430000,82.190002,82.047951,49500 178 | 2019-02-05,81.889999,83.769997,81.889999,83.480003,83.335724,23100 179 | 2019-02-06,83.750000,84.760002,83.019997,83.779999,83.635201,57900 180 | 2019-02-07,83.400002,84.849998,83.000000,83.889999,83.745010,46100 181 | 2019-02-08,84.160004,84.870003,83.809998,84.709999,84.563599,57000 182 | 2019-02-11,85.059998,85.300003,84.419998,84.769997,84.623489,57500 183 | 2019-02-12,85.440002,87.440002,85.254997,87.129997,86.979408,44700 184 | 2019-02-13,87.610001,89.169998,87.610001,88.629997,88.476822,34300 185 | 2019-02-14,88.239998,88.389999,87.019997,87.839996,87.688179,28100 186 | 2019-02-15,87.910004,87.910004,87.110001,87.260002,87.109192,43200 187 | 2019-02-19,87.650002,87.650002,86.040001,86.800003,86.649986,47400 188 | 2019-02-20,86.410004,87.839996,86.220001,87.620003,87.468567,34100 189 | 2019-02-21,87.779999,87.900002,87.150002,87.580002,87.428635,23300 190 | 2019-02-22,88.029999,88.400002,87.459999,88.290001,88.137413,29600 191 | 2019-02-25,88.519997,88.930000,87.059998,87.110001,86.959450,19700 192 | 2019-02-26,87.120003,87.910004,86.720001,87.639999,87.488533,29600 193 | 2019-02-27,87.589996,87.589996,86.584999,87.199997,87.049286,18400 194 | 2019-02-28,86.949997,87.059998,86.379997,86.839996,86.689911,32800 195 | 2019-03-01,87.150002,87.150002,85.660004,86.500000,86.350502,38600 196 | 2019-03-04,86.410004,87.510002,86.160004,87.019997,86.869598,32900 197 | 2019-03-05,86.900002,88.070000,86.820000,87.940002,87.788017,23600 198 | 2019-03-06,87.489998,87.489998,86.639999,87.059998,86.909531,25500 199 | 2019-03-07,87.410004,87.410004,86.040001,86.779999,86.630020,34000 200 | 2019-03-08,86.540001,86.750000,85.199997,85.570000,85.422112,24000 201 | 2019-03-11,85.949997,86.980003,85.010002,86.739998,86.590088,24100 202 | 2019-03-12,86.889999,86.889999,85.900002,86.650002,86.500244,13500 203 | 2019-03-13,86.720001,87.099998,83.680000,84.260002,84.114372,62500 204 | 2019-03-14,84.320000,85.510002,83.959999,85.269997,85.122627,51900 205 | 2019-03-15,85.150002,85.550003,83.910004,84.400002,84.254135,34300 206 | 2019-03-18,84.879997,85.230003,83.699997,84.260002,84.114372,32700 207 | 2019-03-19,84.849998,85.059998,83.980003,83.980003,83.834862,21700 208 | 2019-03-20,83.690002,84.330002,83.220001,83.970001,83.824875,43400 209 | 2019-03-21,84.050003,85.440002,83.940002,85.370003,85.222458,26700 210 | 2019-03-22,84.910004,85.150002,84.019997,84.019997,83.874786,30500 211 | 2019-03-25,83.900002,85.269997,83.400002,85.220001,85.072716,34400 212 | 2019-03-26,85.820000,86.019997,84.849998,85.809998,85.661690,31200 213 | 2019-03-27,85.029999,86.970001,85.029999,86.790001,86.639999,28800 214 | 2019-03-28,86.800003,88.084999,86.650002,87.699997,87.699997,22400 215 | 2019-03-29,88.419998,89.669998,87.699997,89.339996,89.339996,40500 216 | 2019-04-01,89.360001,89.949997,88.199997,89.620003,89.620003,42500 217 | 2019-04-02,89.919998,89.919998,88.300003,88.720001,88.720001,27600 218 | 2019-04-03,89.320000,89.320000,88.260002,88.449997,88.449997,25100 219 | 2019-04-04,88.889999,88.889999,87.930000,88.190002,88.190002,29400 220 | 2019-04-05,88.285004,88.430000,87.629997,88.070000,88.070000,23700 221 | 2019-04-08,88.070000,88.495003,87.199997,87.739998,87.739998,18700 222 | 2019-04-09,87.930000,88.360001,87.830002,88.070000,88.070000,24700 223 | 2019-04-10,88.430000,89.660004,88.120003,89.209999,89.209999,20900 224 | 2019-04-11,89.529999,89.529999,88.139999,88.300003,88.300003,21000 225 | 2019-04-12,88.139999,89.639999,88.092003,89.589996,89.589996,18500 226 | 2019-04-15,89.129997,89.779999,89.129997,89.389999,89.389999,20700 227 | 2019-04-16,89.639999,89.879997,88.139999,88.209999,88.209999,17200 228 | 2019-04-17,88.830002,88.830002,85.410004,86.480003,86.480003,53800 229 | 2019-04-18,86.470001,87.470001,85.800003,87.050003,87.050003,17400 230 | 2019-04-22,86.589996,87.849998,86.589996,87.419998,87.419998,14500 231 | 2019-04-23,86.830002,88.110001,86.639999,88.110001,88.110001,21200 232 | 2019-04-24,83.769997,87.589996,83.769997,87.269997,87.269997,34800 233 | 2019-04-25,87.070000,87.839996,86.925003,87.669998,87.669998,18500 234 | 2019-04-26,87.650002,87.769997,86.699997,86.970001,86.970001,22500 235 | 2019-04-29,86.550003,86.669998,83.019997,86.360001,86.360001,22800 236 | 2019-04-30,87.014000,87.349998,86.410004,87.220001,87.220001,33700 237 | 2019-05-01,88.141998,88.141998,86.985001,87.129997,87.129997,43100 238 | 2019-05-02,87.180000,87.474998,86.610001,87.379997,87.379997,26600 239 | 2019-05-03,87.449997,88.120003,87.449997,87.940002,87.940002,35600 240 | 2019-05-06,86.970001,87.800003,86.970001,87.620003,87.620003,28600 241 | 2019-05-07,86.419998,86.699997,85.970001,86.599998,86.599998,29300 242 | 2019-05-08,87.010002,87.010002,85.930000,86.379997,86.379997,50800 243 | 2019-05-09,85.919998,86.150002,85.476997,85.790001,85.790001,37400 244 | 2019-05-10,86.070000,86.889999,85.510002,86.889999,86.889999,63800 245 | 2019-05-13,86.309998,86.455002,85.169998,86.040001,86.040001,24400 246 | 2019-05-14,85.800003,86.370003,85.610001,86.070000,86.070000,34400 247 | 2019-05-15,86.489998,87.680000,85.690002,86.970001,86.970001,46700 248 | 2019-05-16,87.730003,89.209999,87.540001,89.010002,89.010002,51300 249 | 2019-05-17,89.029999,89.519997,87.110001,87.790001,87.790001,29900 250 | 2019-05-20,85.930000,89.010002,85.930000,86.620003,86.620003,19000 251 | 2019-05-21,87.959999,88.010002,86.089996,86.290001,86.290001,51600 252 | 2019-05-22,86.269997,86.480003,85.260002,86.129997,86.129997,49400 253 | 2019-05-23,88.639999,93.860001,88.014999,93.500000,93.500000,115185 254 | -------------------------------------------------------------------------------- /dataset/INFY.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Adj Close,Volume 2 | 2018-07-13,9.560000,9.815000,9.550000,9.710000,9.423450,27224000 3 | 2018-07-16,9.865000,9.885000,9.770000,9.800000,9.510794,14771800 4 | 2018-07-17,9.785000,9.970000,9.760000,9.950000,9.656367,12135400 5 | 2018-07-18,9.880000,9.910000,9.830000,9.840000,9.549613,5833800 6 | 2018-07-19,9.720000,9.905000,9.720000,9.855000,9.564170,14995000 7 | 2018-07-20,9.950000,10.075000,9.945000,10.005000,9.709743,10394600 8 | 2018-07-23,10.025000,10.090000,9.995000,10.075000,9.777678,6873400 9 | 2018-07-24,10.175000,10.210000,10.130000,10.195000,9.894136,8553200 10 | 2018-07-25,10.220000,10.340000,10.205000,10.290000,9.986332,7539200 11 | 2018-07-26,10.255000,10.300000,10.220000,10.270000,9.966924,9587400 12 | 2018-07-27,10.300000,10.315000,10.115000,10.170000,9.869875,8674800 13 | 2018-07-30,10.100000,10.150000,9.940000,9.970000,9.675777,14123200 14 | 2018-07-31,10.055000,10.105000,10.035000,10.090000,9.792234,16554000 15 | 2018-08-01,10.125000,10.180000,10.100000,10.175000,9.874727,9094000 16 | 2018-08-02,10.090000,10.220000,10.060000,10.190000,9.889283,14119600 17 | 2018-08-03,10.175000,10.275000,10.130000,10.270000,9.966924,8424400 18 | 2018-08-06,10.215000,10.305000,10.160000,10.295000,9.991185,6577600 19 | 2018-08-07,10.325000,10.330000,10.150000,10.300000,9.996037,9157800 20 | 2018-08-08,10.300000,10.430000,10.265000,10.375000,10.068825,7491200 21 | 2018-08-09,10.425000,10.490000,10.410000,10.450000,10.141611,5629600 22 | 2018-08-10,10.355000,10.420000,10.335000,10.400000,10.093086,4435400 23 | 2018-08-13,10.435000,10.475000,10.395000,10.410000,10.102792,4827600 24 | 2018-08-14,10.405000,10.475000,10.385000,10.450000,10.141611,5472800 25 | 2018-08-15,10.390000,10.450000,10.300000,10.435000,10.127054,6000200 26 | 2018-08-16,10.500000,10.520000,10.455000,10.495000,10.185283,6288200 27 | 2018-08-17,10.490000,10.570000,10.465000,10.540000,10.228956,7209600 28 | 2018-08-20,10.250000,10.390000,10.145000,10.250000,9.947514,12304800 29 | 2018-08-21,10.295000,10.375000,10.225000,10.245000,9.942661,8231200 30 | 2018-08-22,10.245000,10.285000,10.205000,10.250000,9.947514,10869000 31 | 2018-08-23,10.300000,10.365000,10.180000,10.190000,9.889283,11189200 32 | 2018-08-24,10.215000,10.215000,10.090000,10.150000,9.850465,7687000 33 | 2018-08-27,10.325000,10.390000,10.260000,10.270000,9.966924,7388600 34 | 2018-08-28,10.350000,10.355000,10.305000,10.325000,10.020301,7254000 35 | 2018-08-29,10.220000,10.265000,10.160000,10.175000,9.874727,12943200 36 | 2018-08-30,10.180000,10.255000,10.135000,10.230000,9.928103,9159000 37 | 2018-08-31,10.310000,10.400000,10.300000,10.385000,10.078529,6992200 38 | 2018-09-04,10.430000,10.460000,10.280000,10.380000,10.073677,12184400 39 | 2018-09-05,10.190000,10.380000,10.170000,10.355000,10.049415,12774400 40 | 2018-09-06,10.295000,10.405000,10.285000,10.400000,10.093086,7225000 41 | 2018-09-07,10.390000,10.535000,10.365000,10.425000,10.117350,10373600 42 | 2018-09-10,10.380000,10.480000,10.300000,10.350000,10.044563,8940600 43 | 2018-09-11,10.360000,10.555000,10.350000,10.485000,10.175577,8671800 44 | 2018-09-12,10.570000,10.650000,10.530000,10.550000,10.238660,4392500 45 | 2018-09-13,10.600000,10.640000,10.470000,10.610000,10.296889,9522300 46 | 2018-09-14,10.520000,10.540000,10.270000,10.320000,10.015448,10702000 47 | 2018-09-17,10.210000,10.290000,10.200000,10.250000,9.947514,7260000 48 | 2018-09-18,10.180000,10.180000,10.080000,10.140000,9.840760,6657600 49 | 2018-09-19,10.200000,10.230000,9.990000,10.010000,9.714596,11042600 50 | 2018-09-20,10.080000,10.100000,9.970000,10.070000,9.772825,9811500 51 | 2018-09-21,10.040000,10.040000,9.890000,9.930000,9.636957,7935600 52 | 2018-09-24,10.040000,10.070000,9.930000,9.950000,9.656367,12798900 53 | 2018-09-25,10.060000,10.190000,10.030000,10.150000,9.850465,10763500 54 | 2018-09-26,10.060000,10.200000,10.030000,10.060000,9.763121,6388300 55 | 2018-09-27,10.100000,10.200000,10.070000,10.100000,9.801940,8822100 56 | 2018-09-28,10.220000,10.250000,10.120000,10.170000,9.869875,9329800 57 | 2018-10-01,10.340000,10.390000,10.300000,10.370000,10.063972,7440100 58 | 2018-10-02,10.320000,10.320000,10.200000,10.270000,9.966924,9053800 59 | 2018-10-03,10.120000,10.150000,10.010000,10.040000,9.743711,10073600 60 | 2018-10-04,9.810000,10.020000,9.800000,10.000000,9.704891,14905600 61 | 2018-10-05,10.020000,10.190000,10.010000,10.170000,9.869875,8296800 62 | 2018-10-08,9.970000,10.070000,9.920000,10.030000,9.734005,9091600 63 | 2018-10-09,9.970000,10.040000,9.930000,10.020000,9.724301,8825600 64 | 2018-10-10,9.810000,9.840000,9.630000,9.740000,9.452564,23251500 65 | 2018-10-11,9.530000,9.680000,9.460000,9.520000,9.239058,18729300 66 | 2018-10-12,9.650000,9.760000,9.570000,9.740000,9.452564,11524500 67 | 2018-10-15,9.850000,9.960000,9.790000,9.910000,9.617547,17032800 68 | 2018-10-16,9.950000,10.520000,9.910000,10.220000,9.918399,27500700 69 | 2018-10-17,10.060000,10.060000,9.740000,9.800000,9.510794,20694700 70 | 2018-10-18,9.780000,9.780000,9.350000,9.540000,9.258466,21337000 71 | 2018-10-19,9.600000,9.760000,9.540000,9.580000,9.297286,8651900 72 | 2018-10-22,9.570000,9.580000,9.400000,9.480000,9.200236,9586300 73 | 2018-10-23,9.240000,9.420000,9.220000,9.400000,9.122598,10275200 74 | 2018-10-24,9.300000,9.370000,9.050000,9.060000,8.792632,11702500 75 | 2018-10-25,9.080000,9.200000,9.050000,9.110000,8.934843,9126200 76 | 2018-10-26,8.990000,9.050000,8.850000,9.020000,8.846575,8647400 77 | 2018-10-29,9.080000,9.100000,8.880000,8.970000,8.797536,9618300 78 | 2018-10-30,9.160000,9.320000,9.100000,9.190000,9.013305,13429500 79 | 2018-10-31,9.450000,9.540000,9.410000,9.470000,9.287922,9089200 80 | 2018-11-01,9.390000,9.400000,9.210000,9.300000,9.121191,12112500 81 | 2018-11-02,9.340000,9.410000,9.230000,9.250000,9.072152,8302600 82 | 2018-11-05,9.290000,9.470000,9.290000,9.400000,9.219268,9240100 83 | 2018-11-06,9.440000,9.550000,9.390000,9.480000,9.297729,6901300 84 | 2018-11-07,9.620000,9.690000,9.580000,9.610000,9.425230,6291500 85 | 2018-11-08,9.610000,9.650000,9.460000,9.510000,9.327153,5057100 86 | 2018-11-09,9.410000,9.500000,9.370000,9.490000,9.307537,5318600 87 | 2018-11-12,9.420000,9.470000,9.270000,9.340000,9.160421,7691300 88 | 2018-11-13,9.370000,9.460000,9.330000,9.400000,9.219268,5937800 89 | 2018-11-14,9.410000,9.440000,9.160000,9.250000,9.072152,5406400 90 | 2018-11-15,9.270000,9.370000,9.160000,9.330000,9.150614,7020900 91 | 2018-11-16,9.280000,9.370000,9.250000,9.330000,9.150614,4709700 92 | 2018-11-19,9.330000,9.330000,9.210000,9.290000,9.111383,6507000 93 | 2018-11-20,9.180000,9.190000,9.050000,9.090000,8.915228,7108500 94 | 2018-11-21,8.990000,9.100000,8.950000,9.070000,8.895612,7539300 95 | 2018-11-23,9.050000,9.160000,9.050000,9.090000,8.915228,3158400 96 | 2018-11-26,9.070000,9.210000,9.060000,9.180000,9.003497,6051900 97 | 2018-11-27,9.250000,9.310000,9.190000,9.270000,9.091768,5458600 98 | 2018-11-28,9.630000,9.890000,9.560000,9.860000,9.670423,13928900 99 | 2018-11-29,9.790000,9.800000,9.660000,9.680000,9.493885,12415800 100 | 2018-11-30,9.800000,9.860000,9.750000,9.860000,9.670423,10463200 101 | 2018-12-03,9.910000,9.940000,9.860000,9.900000,9.709654,13191200 102 | 2018-12-04,9.940000,10.050000,9.830000,9.850000,9.660616,9518900 103 | 2018-12-06,9.770000,9.860000,9.710000,9.830000,9.641000,17177400 104 | 2018-12-07,9.830000,9.970000,9.650000,9.690000,9.503692,11353200 105 | 2018-12-10,9.550000,9.590000,9.430000,9.570000,9.386000,7731000 106 | 2018-12-11,9.650000,9.770000,9.620000,9.690000,9.503692,7952700 107 | 2018-12-12,9.770000,9.820000,9.660000,9.660000,9.474269,5453300 108 | 2018-12-13,9.930000,9.980000,9.850000,9.870000,9.680231,7971700 109 | 2018-12-14,9.990000,10.010000,9.870000,9.890000,9.699846,7799600 110 | 2018-12-17,9.820000,9.830000,9.540000,9.600000,9.415423,10520400 111 | 2018-12-18,9.680000,9.720000,9.500000,9.540000,9.356576,9742500 112 | 2018-12-19,9.490000,9.580000,9.380000,9.430000,9.248692,8175400 113 | 2018-12-20,9.510000,9.540000,9.140000,9.280000,9.101575,23548800 114 | 2018-12-21,9.210000,9.310000,9.100000,9.100000,8.925036,15286200 115 | 2018-12-24,9.190000,9.240000,9.070000,9.080000,8.905420,8590700 116 | 2018-12-26,9.150000,9.380000,9.120000,9.380000,9.199653,9004200 117 | 2018-12-27,9.300000,9.450000,9.280000,9.450000,9.268306,9856500 118 | 2018-12-28,9.480000,9.500000,9.380000,9.430000,9.248692,6818500 119 | 2018-12-31,9.470000,9.530000,9.390000,9.520000,9.336961,7229400 120 | 2019-01-02,9.500000,9.730000,9.470000,9.610000,9.425230,9818900 121 | 2019-01-03,9.550000,9.590000,9.470000,9.470000,9.287922,9404900 122 | 2019-01-04,9.520000,9.720000,9.500000,9.630000,9.444846,7119000 123 | 2019-01-07,9.700000,9.810000,9.660000,9.710000,9.523308,7732700 124 | 2019-01-08,9.820000,9.850000,9.720000,9.750000,9.562538,9391600 125 | 2019-01-09,9.760000,9.890000,9.740000,9.870000,9.680231,9634300 126 | 2019-01-10,9.780000,9.890000,9.700000,9.880000,9.690039,13956500 127 | 2019-01-11,10.180000,10.680000,10.120000,10.410000,10.209848,40526400 128 | 2019-01-14,10.180000,10.410000,10.130000,10.370000,10.170618,34162200 129 | 2019-01-15,10.570000,10.580000,10.460000,10.490000,10.288310,12153400 130 | 2019-01-16,10.570000,10.640000,10.550000,10.610000,10.406003,12048400 131 | 2019-01-17,10.540000,10.630000,10.500000,10.580000,10.376580,9581000 132 | 2019-01-18,10.600000,10.690000,10.580000,10.670000,10.464850,10168700 133 | 2019-01-22,10.640000,10.680000,10.470000,10.530000,10.327541,10437700 134 | 2019-01-23,10.560000,10.560000,10.430000,10.530000,10.327541,8108100 135 | 2019-01-24,10.530000,10.550000,10.430000,10.430000,10.285139,6627700 136 | 2019-01-25,10.510000,10.580000,10.410000,10.550000,10.403472,8839100 137 | 2019-01-28,10.490000,10.570000,10.440000,10.520000,10.373889,5192200 138 | 2019-01-29,10.490000,10.530000,10.420000,10.480000,10.334444,8271100 139 | 2019-01-30,10.460000,10.630000,10.420000,10.590000,10.442917,7026000 140 | 2019-01-31,10.680000,10.820000,10.680000,10.800000,10.650001,10354900 141 | 2019-02-01,10.850000,10.930000,10.810000,10.900000,10.748610,6651300 142 | 2019-02-04,10.830000,10.880000,10.790000,10.870000,10.719028,7449000 143 | 2019-02-05,10.850000,10.920000,10.830000,10.840000,10.689445,6926300 144 | 2019-02-06,10.910000,10.940000,10.850000,10.900000,10.748610,5478400 145 | 2019-02-07,10.860000,10.930000,10.800000,10.850000,10.699306,7116200 146 | 2019-02-08,10.830000,10.890000,10.810000,10.860000,10.709167,4103300 147 | 2019-02-11,10.860000,10.890000,10.790000,10.820000,10.669722,5929600 148 | 2019-02-12,10.850000,10.860000,10.760000,10.770000,10.620417,6300600 149 | 2019-02-13,10.850000,10.870000,10.770000,10.800000,10.650001,9532300 150 | 2019-02-14,10.650000,10.760000,10.620000,10.760000,10.610556,8443400 151 | 2019-02-15,10.680000,10.780000,10.640000,10.760000,10.610556,9269100 152 | 2019-02-19,10.470000,10.570000,10.380000,10.550000,10.403472,13443300 153 | 2019-02-20,10.620000,10.730000,10.620000,10.700000,10.551389,6693600 154 | 2019-02-21,10.600000,10.620000,10.490000,10.550000,10.403472,6913200 155 | 2019-02-22,10.560000,10.680000,10.550000,10.630000,10.482361,4644600 156 | 2019-02-25,10.830000,10.920000,10.780000,10.810000,10.659862,7781200 157 | 2019-02-26,10.700000,10.760000,10.620000,10.730000,10.580972,6343700 158 | 2019-02-27,10.610000,10.730000,10.570000,10.700000,10.551389,6812900 159 | 2019-02-28,10.690000,10.770000,10.650000,10.720000,10.571112,6815000 160 | 2019-03-01,10.790000,10.870000,10.740000,10.840000,10.689445,8012100 161 | 2019-03-04,10.850000,10.870000,10.660000,10.720000,10.571112,5650900 162 | 2019-03-05,10.720000,10.800000,10.650000,10.770000,10.620417,5576000 163 | 2019-03-06,10.700000,10.750000,10.680000,10.710000,10.561250,6026600 164 | 2019-03-07,10.650000,10.710000,10.480000,10.490000,10.344305,8304200 165 | 2019-03-08,10.410000,10.480000,10.360000,10.470000,10.324583,6145300 166 | 2019-03-11,10.480000,10.570000,10.460000,10.550000,10.403472,5497300 167 | 2019-03-12,10.530000,10.550000,10.460000,10.520000,10.373889,9129600 168 | 2019-03-13,10.530000,10.600000,10.480000,10.550000,10.403472,10809900 169 | 2019-03-14,10.520000,10.610000,10.480000,10.600000,10.452778,5964500 170 | 2019-03-15,10.690000,10.770000,10.690000,10.700000,10.551389,7108200 171 | 2019-03-18,10.700000,10.740000,10.680000,10.720000,10.571112,5828700 172 | 2019-03-19,10.800000,10.910000,10.790000,10.900000,10.748610,7204100 173 | 2019-03-20,10.970000,11.040000,10.880000,10.940000,10.788055,7616300 174 | 2019-03-21,10.940000,11.080000,10.940000,11.060000,10.906389,5108000 175 | 2019-03-22,11.050000,11.120000,10.860000,10.880000,10.728889,8525300 176 | 2019-03-25,10.860000,10.880000,10.770000,10.820000,10.669722,7322400 177 | 2019-03-26,10.860000,10.880000,10.770000,10.820000,10.669722,4427200 178 | 2019-03-27,10.790000,10.830000,10.670000,10.730000,10.580972,5644900 179 | 2019-03-28,10.910000,10.940000,10.830000,10.880000,10.728889,5429900 180 | 2019-03-29,10.930000,11.030000,10.920000,10.930000,10.778194,5862300 181 | 2019-04-01,11.070000,11.160000,11.030000,11.090000,10.935972,5765400 182 | 2019-04-02,11.160000,11.260000,11.100000,11.180000,11.024722,7661600 183 | 2019-04-03,11.200000,11.280000,11.160000,11.200000,11.044444,7516300 184 | 2019-04-04,11.090000,11.150000,11.000000,11.070000,10.916249,5658700 185 | 2019-04-05,11.170000,11.360000,11.150000,11.320000,11.162777,9160300 186 | 2019-04-08,11.280000,11.380000,11.270000,11.310000,11.152917,4759200 187 | 2019-04-09,11.230000,11.260000,11.140000,11.150000,10.995138,15865500 188 | 2019-04-10,11.120000,11.170000,11.040000,11.080000,10.926111,15151400 189 | 2019-04-11,11.050000,11.070000,10.900000,10.970000,10.817639,19697600 190 | 2019-04-12,10.600000,10.710000,10.450000,10.550000,10.403472,27590500 191 | 2019-04-15,10.610000,10.610000,10.500000,10.570000,10.423194,15949200 192 | 2019-04-16,10.560000,10.570000,10.360000,10.370000,10.225972,21431800 193 | 2019-04-17,10.420000,10.460000,10.370000,10.410000,10.265416,10317700 194 | 2019-04-18,10.450000,10.490000,10.340000,10.390000,10.245695,18307000 195 | 2019-04-22,10.440000,10.470000,10.390000,10.450000,10.304861,7392500 196 | 2019-04-23,10.480000,10.640000,10.480000,10.530000,10.383750,13314800 197 | 2019-04-24,10.620000,10.700000,10.560000,10.580000,10.433056,12134700 198 | 2019-04-25,10.570000,10.570000,10.400000,10.520000,10.373889,7030200 199 | 2019-04-26,10.640000,10.680000,10.560000,10.650000,10.502083,5366900 200 | 2019-04-29,10.690000,10.780000,10.660000,10.750000,10.600695,6956900 201 | 2019-04-30,10.820000,10.880000,10.750000,10.760000,10.610556,8432300 202 | 2019-05-01,10.810000,10.880000,10.760000,10.770000,10.620417,9212300 203 | 2019-05-02,10.640000,10.720000,10.470000,10.570000,10.423194,12516500 204 | 2019-05-03,10.560000,10.560000,10.070000,10.330000,10.186527,30580400 205 | 2019-05-06,10.310000,10.520000,10.310000,10.450000,10.304861,13121800 206 | 2019-05-07,10.440000,10.460000,10.290000,10.340000,10.196389,13262100 207 | 2019-05-08,10.420000,10.430000,10.260000,10.390000,10.245695,11854500 208 | 2019-05-09,10.340000,10.360000,10.190000,10.200000,10.058333,18123600 209 | 2019-05-10,10.230000,10.270000,10.110000,10.260000,10.117500,19016300 210 | 2019-05-13,10.170000,10.180000,10.040000,10.110000,9.969583,13309000 211 | 2019-05-14,10.150000,10.290000,10.130000,10.210000,10.068194,5885600 212 | 2019-05-15,10.230000,10.390000,10.190000,10.390000,10.245695,11611400 213 | 2019-05-16,10.480000,10.560000,10.470000,10.510000,10.364028,8502800 214 | 2019-05-17,10.400000,10.440000,10.150000,10.170000,10.028750,12427600 215 | 2019-05-20,10.310000,10.360000,10.150000,10.200000,10.058333,17155700 216 | 2019-05-21,10.200000,10.210000,10.120000,10.180000,10.038611,13841200 217 | 2019-05-22,10.190000,10.320000,10.180000,10.220000,10.078055,8639200 218 | 2019-05-23,10.080000,10.200000,10.010000,10.160000,10.018888,6115600 219 | 2019-05-24,10.270000,10.350000,10.230000,10.230000,10.087916,10594200 220 | 2019-05-28,10.400000,10.450000,10.300000,10.300000,10.156944,13101000 221 | 2019-05-29,10.330000,10.340000,10.230000,10.270000,10.127361,9885000 222 | 2019-05-30,10.380000,10.600000,10.370000,10.570000,10.423194,9560600 223 | 2019-05-31,10.500000,10.530000,10.410000,10.470000,10.324583,8501000 224 | 2019-06-03,10.560000,10.630000,10.410000,10.450000,10.304861,16517600 225 | 2019-06-04,10.500000,10.600000,10.420000,10.580000,10.433056,8956200 226 | 2019-06-05,10.560000,10.570000,10.430000,10.440000,10.294999,7705300 227 | 2019-06-06,10.460000,10.580000,10.460000,10.530000,10.383750,5068500 228 | 2019-06-07,10.520000,10.680000,10.520000,10.630000,10.482361,4587400 229 | 2019-06-10,10.760000,10.810000,10.730000,10.780000,10.630278,6059100 230 | 2019-06-11,10.840000,10.850000,10.720000,10.840000,10.689445,6582600 231 | 2019-06-12,10.820000,10.900000,10.770000,10.800000,10.650001,7234800 232 | 2019-06-13,10.630000,10.700000,10.540000,10.620000,10.620000,11253600 233 | 2019-06-14,10.590000,10.670000,10.570000,10.600000,10.600000,4910900 234 | 2019-06-17,10.520000,10.650000,10.470000,10.600000,10.600000,5351000 235 | 2019-06-18,10.790000,10.830000,10.740000,10.750000,10.750000,9545700 236 | 2019-06-19,10.780000,10.800000,10.590000,10.600000,10.600000,17172400 237 | 2019-06-20,10.790000,10.800000,10.680000,10.770000,10.770000,14996300 238 | 2019-06-21,10.720000,10.790000,10.680000,10.720000,10.720000,8959000 239 | 2019-06-24,10.720000,10.770000,10.650000,10.680000,10.680000,6824800 240 | 2019-06-25,10.700000,10.700000,10.610000,10.650000,10.650000,8018600 241 | 2019-06-26,10.660000,10.680000,10.600000,10.660000,10.660000,4425400 242 | 2019-06-27,10.590000,10.670000,10.520000,10.620000,10.620000,7636900 243 | 2019-06-28,10.640000,10.710000,10.630000,10.700000,10.700000,6315300 244 | 2019-07-01,10.700000,10.700000,10.620000,10.700000,10.700000,8902200 245 | 2019-07-02,10.730000,10.790000,10.720000,10.760000,10.760000,7007200 246 | 2019-07-03,10.690000,10.770000,10.670000,10.740000,10.740000,6879500 247 | 2019-07-05,10.570000,10.700000,10.540000,10.690000,10.690000,18833300 248 | 2019-07-08,10.600000,10.620000,10.550000,10.560000,10.560000,13564300 249 | 2019-07-09,10.540000,10.550000,10.370000,10.420000,10.420000,23515700 250 | 2019-07-10,10.550000,10.610000,10.440000,10.480000,10.480000,14954300 251 | 2019-07-11,10.570000,10.720000,10.530000,10.720000,10.720000,15798500 252 | 2019-07-12,11.340000,11.560000,11.270000,11.400000,11.400000,41385700 253 | -------------------------------------------------------------------------------- /stock-forecasting-js/js/papaparse.min.js: -------------------------------------------------------------------------------- 1 | /*@license 2 | Papa Parse 3 | v4.5.0 4 | https://github.com/mholt/PapaParse 5 | License: MIT 6 | */ 7 | !function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&"undefined"!=typeof exports?module.exports=t():e.Papa=t()}(this,function(){"use strict";var s,e,f="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==f?f:{},r=!f.document&&!!f.postMessage,o=r&&/(\?|&)papaworker(=|&|$)/.test(f.location.search),a=!1,h={},u=0,v={parse:function(e,t){var i=(t=t||{}).dynamicTyping||!1;M(i)&&(t.dynamicTypingFunction=i,i={});if(t.dynamicTyping=i,t.transform=!!M(t.transform)&&t.transform,t.worker&&v.WORKERS_SUPPORTED){var n=function(){if(!v.WORKERS_SUPPORTED)return!1;if(!a&&null===v.SCRIPT_PATH)throw new Error("Script path cannot be determined automatically when Papa Parse is loaded asynchronously. You need to set Papa.SCRIPT_PATH manually.");var e=v.SCRIPT_PATH||s;e+=(-1!==e.indexOf("?")?"&":"?")+"papaworker";var t=new f.Worker(e);return t.onmessage=y,t.id=u++,h[t.id]=t}();return n.userStep=t.step,n.userChunk=t.chunk,n.userComplete=t.complete,n.userError=t.error,t.step=M(t.step),t.chunk=M(t.chunk),t.complete=M(t.complete),t.error=M(t.error),delete t.worker,void n.postMessage({input:e,config:t,workerId:n.id})}var r=null;{if(e===v.NODE_STREAM_INPUT)return(r=new g(t)).getStream();"string"==typeof e?r=t.download?new l(t):new _(t):!0===e.readable&&M(e.read)&&M(e.on)?r=new m(t):(f.File&&e instanceof File||e instanceof Object)&&(r=new p(t))}return r.stream(e)},unparse:function(e,t){var n=!1,f=!0,d=",",c="\r\n",r='"';!function(){if("object"!=typeof t)return;"string"==typeof t.delimiter&&1===t.delimiter.length&&-1===v.BAD_DELIMITERS.indexOf(t.delimiter)&&(d=t.delimiter);("boolean"==typeof t.quotes||t.quotes instanceof Array)&&(n=t.quotes);"string"==typeof t.newline&&(c=t.newline);"string"==typeof t.quoteChar&&(r=t.quoteChar);"boolean"==typeof t.header&&(f=t.header)}();var s=new RegExp(r,"g");"string"==typeof e&&(e=JSON.parse(e));if(e instanceof Array){if(!e.length||e[0]instanceof Array)return a(null,e);if("object"==typeof e[0])return a(i(e[0]),e)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),e.data instanceof Array&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=e.data[0]instanceof Array?e.fields:i(e.data[0])),e.data[0]instanceof Array||"object"==typeof e.data[0]||(e.data=[e.data])),a(e.fields||[],e.data||[]);throw"exception: Unable to serialize unrecognized input";function i(e){if("object"!=typeof e)return[];var t=[];for(var i in e)t.push(i);return t}function a(e,t){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var n=e instanceof Array&&0=this._config.preview;if(o)f.postMessage({results:r,workerId:v.WORKER_ID,finished:a});else if(M(this._config.chunk)&&!t){if(this._config.chunk(r,this._handle),this._handle.paused()||this._handle.aborted())return;r=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(r.data),this._completeResults.errors=this._completeResults.errors.concat(r.errors),this._completeResults.meta=r.meta),this._completed||!a||!M(this._config.complete)||r&&r.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||r&&r.meta.paused||this._nextChunk(),r}},this._sendError=function(e){M(this._config.error)?this._config.error(e):o&&this._config.error&&f.postMessage({workerId:v.WORKER_ID,error:e,finished:!1})}}function l(e){var n;(e=e||{}).chunkSize||(e.chunkSize=v.RemoteChunkSize),c.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),r||(n.onload=E(this._chunkLoaded,this),n.onerror=E(this._chunkError,this)),n.open("GET",this._input,!r),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var t in e)n.setRequestHeader(t,e[t])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;n.setRequestHeader("Range","bytes="+this._start+"-"+i),n.setRequestHeader("If-None-Match","webkit-no-cache")}try{n.send()}catch(e){this._chunkError(e.message)}r&&0===n.status?this._chunkError():this._start+=this._config.chunkSize}},this._chunkLoaded=function(){4===n.readyState&&(n.status<200||400<=n.status?this._chunkError():(this._finished=!this._config.chunkSize||this._start>function(e){var t=e.getResponseHeader("Content-Range");if(null===t)return-1;return parseInt(t.substr(t.lastIndexOf("/")+1))}(n),this.parseChunk(n.responseText)))},this._chunkError=function(e){var t=n.statusText||e;this._sendError(new Error(t))}}function p(e){var n,r;(e=e||{}).chunkSize||(e.chunkSize=v.LocalChunkSize),c.call(this,e);var s="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,s?((n=new FileReader).onload=E(this._chunkLoaded,this),n.onerror=E(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(n.error)}}function _(e){var i;c.call(this,e=e||{}),this.stream=function(e){return i=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,t=e?i.substr(0,e):i;return i=e?i.substr(e):"",this._finished=!i,this.parseChunk(t)}}}function m(e){c.call(this,e=e||{});var t=[],i=!0,n=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=!0},this._streamData=E(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=E(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=E(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=E(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function g(e){var t=require("stream").Duplex,i=w(e),n=!0,r=!1,s=[],a=null;this._onCsvData=function(e){for(var t=e.data,i=0;im.preview?a.abort():c(d,t)}}}function l(){if(d&&o&&(g("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+v.DefaultDelimiter+"'"),o=!1),m.skipEmptyLines)for(var e=0;e=f.length?"__parsed_extra":f[t]),m.transform&&(r=m.transform(r,n)),r=_(n,r),"__parsed_extra"===n?(i[n]=i[n]||[],i[n].push(r)):i[n]=r}d.data[e]=i,m.header&&(t>f.length?g("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+t,h+e):t=t.length/2?"\r\n":"\r"}(e)),o=!1,m.delimiter)M(m.delimiter)&&(m.delimiter=m.delimiter(e),d.meta.delimiter=m.delimiter);else{var n=function(e,t,i,n){for(var r,s,a,o=[",","\t","|",";",v.RECORD_SEP,v.UNIT_SEP],h=0;h=D)return E(!0)}else for(p=L,L++;;){if(-1===(p=n.indexOf(S,p+1)))return i||u.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:h.length,index:L}),b();if(p===r-1)return b(n.substring(L,p).replace(g,S));if(S!==A||n[p+1]!==A){if(S===A||0===p||n[p-1]!==A){var v=C(_);if(n[p+1+v]===x){f.push(n.substring(L,p).replace(g,S)),L=p+1+v+e,_=n.indexOf(x,L),m=n.indexOf(T,L);break}var k=C(m);if(n.substr(p+1+k,s)===T){if(f.push(n.substring(L,p).replace(g,S)),w(p+1+k+s),_=n.indexOf(x,L),o&&(R(),F))return E();if(D&&h.length>=D)return E(!0);break}u.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:h.length,index:L}),p++}}else p++}return b();function y(e){h.push(e),d=L}function C(e){var t=0;if(-1!==e){var i=n.substring(p+1,e);i&&""===i.trim()&&(t=i.length)}return t}function b(e){return i||(void 0===e&&(e=n.substr(L)),f.push(e),L=r,y(f),o&&R()),E()}function w(e){L=e,y(f),f=[],m=n.indexOf(T,L)}function E(e){return{data:h,errors:u,meta:{delimiter:x,linebreak:T,aborted:F,truncated:!!e,cursor:d+(t||0)}}}function R(){I(E()),h=[],u=[]}},this.abort=function(){F=!0},this.getCharIndex=function(){return L}}function y(e){var t=e.data,i=h[t.workerId],n=!1;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var r={abort:function(){n=!0,C(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(M(i.userStep)){for(var s=0;s