https://github.com/Leci37/stocks-prediction-Machine-learning-RealTime-TensorFlow
설치
requirements.tx 에서 tensorflow 를 막고 설치했다.
1 | pip install -r requirements.txt |
CUDa 확인
1 | nvidia-smi |
CUDA 를 지원하도록 tensorflow 를 설치한다.
1 | pip install tensorflow[and-cuda] |
주의: keras 를 별도로 설치하지 않도록 한다. 2023말 keras3.x 출시로 2.x 버전과 API가 다를 수 있다.tensorflow 설치시 tf.keras 2.15버전이 설치된다.
GPU 설정을 확인합니다.
1 | python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" |
구성
Readme_setup_installation.md 을 읽으며 진행.
_KEYS_DICT.py : 13줄 Symbol 추가
- 기본 [“UBER”, “PYPL”]
GPU
- 62줄 GPU 사용 여부
- 63줄 PER_PROCESS_GPU_MEMORY_FRACTION 값으로 GPU 메모리 자원 비율 지정
1_Get_technical_indicators.py수행시 다음 에러 대처 방법 수행 필요:Readme_setup_installation.md1
AttributeError: 'Series' object has no attribute 'append'. Did you mean: '_append'?
_Model_creation_models_for_a_stock.py- 6줄의
from keras.backend import set_session를 막는다.
- 6줄의
기초데이터
By default (recommendation) the stock list will be used: “@CHILL”: [“UBER”, “PYPL”]
Run
0_API_alphavantage_get_old_history.pyOptional.- File generate example: d_price/RAW_alpha/alpha_UBER_15min_20230414__20230317.csv
- Run BETTER get alpaca API key and 0_API_alpaca_historical.py
Run
1_Get_technical_indicators.pyFiles generate example:- d_price/PYPL_PLAIN_stock_history_MONTH_3_AD.csv
- plots_relations/best_selection_PYPL_both.json
Run
3_Model_creation_models_for_a_stock.pyFiles generate example models TF .h5:- Models/TF_multi/TFm_UBER_neg_vgood16_mult_lstm.h5 ,
- Models/TF_multi/UBER_neg_vgood16__per_score.csv
- Models/TF_multi/Scalers/UBER_neg_good9_.scal
Run
4_Model_creation_scoring_multi.pyOptional, evaluation the models predictions File generate:- Models/TF_multi/_SCORE_ALL_multi_all.csv