crypto-trader-analysis 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. crypto_trader_analysis-0.1.2/MANIFEST.in +1 -0
  2. crypto_trader_analysis-0.1.2/PKG-INFO +143 -0
  3. crypto_trader_analysis-0.1.2/README.md +104 -0
  4. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/PKG-INFO +143 -0
  5. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/SOURCES.txt +85 -0
  6. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/dependency_links.txt +1 -0
  7. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/entry_points.txt +3 -0
  8. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/requires.txt +21 -0
  9. crypto_trader_analysis-0.1.2/crypto_trader_analysis.egg-info/top_level.txt +1 -0
  10. crypto_trader_analysis-0.1.2/pyproject.toml +77 -0
  11. crypto_trader_analysis-0.1.2/setup.cfg +4 -0
  12. crypto_trader_analysis-0.1.2/src/__init__.py +0 -0
  13. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/__init__.py +2 -0
  14. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/api/__init__.py +0 -0
  15. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/api/asgi.py +16 -0
  16. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/api/settings.py +139 -0
  17. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/api/urls.py +23 -0
  18. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/api/wsgi.py +16 -0
  19. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/__init__.py +0 -0
  20. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/__init__.py +0 -0
  21. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/__init__.py +0 -0
  22. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/__init__.py +0 -0
  23. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/__init__.py +0 -0
  24. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/base_model.py +50 -0
  25. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/complex_lstm_model.py +123 -0
  26. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/__init__.py +0 -0
  27. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/complex_multi_layer_lstm_model.py +146 -0
  28. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/multi_layer_base_model.py +18 -0
  29. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/multi_layer_lstm_model.py +133 -0
  30. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/lstm/lstm_model.py +112 -0
  31. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/model_retriever.py +143 -0
  32. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/ai/model_type.py +53 -0
  33. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/currency_json_generator.py +60 -0
  34. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/data/__init__.py +0 -0
  35. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/data/preprocessor.py +352 -0
  36. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/database/__init__.py +0 -0
  37. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/database/database.py +282 -0
  38. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/database/query_load.py +6 -0
  39. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/database/query_type.py +7 -0
  40. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/prediction/__init__.py +0 -0
  41. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/prediction/prediction.py +31 -0
  42. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/prediction/predictions.py +165 -0
  43. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/__init__.py +0 -0
  44. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/correlations/__init__.py +0 -0
  45. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/correlations/colrelations_analyzer.py +81 -0
  46. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/multi_layer_training_model.py +23 -0
  47. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/multi_layer_training_model_builder.py +29 -0
  48. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/specs/__init__.py +0 -0
  49. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/specs/batch_size_evaluations.py +8 -0
  50. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/specs/dataset_size.py +13 -0
  51. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/specs/epoch_focus.py +14 -0
  52. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/specs/sequence_length_sentiment.py +26 -0
  53. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/train_model.py +446 -0
  54. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/training_model.py +23 -0
  55. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/training_model_builder.py +61 -0
  56. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/training_session.py +378 -0
  57. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/learning/models/training/training_type.py +170 -0
  58. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/__init__.py +0 -0
  59. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/__init__.py +0 -0
  60. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/__init__.py +0 -0
  61. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/crypto_regex.py +22 -0
  62. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/parse_sentiment.py +89 -0
  63. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/sentiment/__init__.py +0 -0
  64. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_analyzer.py +12 -0
  65. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_label.py +7 -0
  66. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_model.py +134 -0
  67. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_result.py +28 -0
  68. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/article/__init__.py +0 -0
  69. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/article/article.py +23 -0
  70. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/article/scored_article.py +51 -0
  71. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/fetch_articles.py +166 -0
  72. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/sources/__init__.py +0 -0
  73. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/sources/author_regex.py +214 -0
  74. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/sources/news_source.py +8 -0
  75. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/sources/news_sources.json +25 -0
  76. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/models/sources/news_sources.py +36 -0
  77. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/__init__.py +0 -0
  78. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/__init__.py +0 -0
  79. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/sentiment_harvest_view.py +31 -0
  80. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/targeted/__init__.py +0 -0
  81. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/targeted/date_targeted_sentiment_harvest_view.py +31 -0
  82. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/targeted/urls.py +8 -0
  83. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/sentiment/urls.py +9 -0
  84. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/apps/news/views/urls.py +5 -0
  85. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/gpu/__init__.py +0 -0
  86. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/gpu/run_gpu_one.py +44 -0
  87. crypto_trader_analysis-0.1.2/src/crypto_trader_analysis/gpu/run_gpu_zero.py +39 -0
@@ -0,0 +1 @@
1
+ recursive-include src/crypto_trader_analysis *.json
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: crypto-trader-analysis
3
+ Version: 0.1.2
4
+ Summary: Analysis and ML components for the Crypto Trader platform (news sentiment, training, utilities).
5
+ Author-email: Oliver Lear Sigwarth <sigwarthsoftware@gmail.com>
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Homepage, https://github.com/theoliverlear/Crypto-Trader
8
+ Project-URL: Repository, https://github.com/theoliverlear/Crypto-Trader
9
+ Project-URL: Issues, https://github.com/theoliverlear/Crypto-Trader/issues
10
+ Keywords: crypto,trading,machine-learning,tensorflow,django,analysis,sentiment
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Office/Business :: Financial :: Investment
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Operating System :: OS Independent
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: attrs>=23.0.0
23
+ Requires-Dist: requests>=2.31.0
24
+ Requires-Dist: beautifulsoup4>=4.12.0
25
+ Provides-Extra: web
26
+ Requires-Dist: Django>=5.1; extra == "web"
27
+ Provides-Extra: data
28
+ Requires-Dist: numpy>=1.23; extra == "data"
29
+ Requires-Dist: pandas>=2.0; extra == "data"
30
+ Provides-Extra: ml
31
+ Requires-Dist: numpy>=1.23; extra == "ml"
32
+ Requires-Dist: pandas>=2.0; extra == "ml"
33
+ Requires-Dist: tensorflow>=2.14; extra == "ml"
34
+ Provides-Extra: all
35
+ Requires-Dist: Django>=5.1; extra == "all"
36
+ Requires-Dist: numpy>=1.23; extra == "all"
37
+ Requires-Dist: pandas>=2.0; extra == "all"
38
+ Requires-Dist: tensorflow>=2.14; extra == "all"
39
+
40
+ # Crypto Trader — Analysis Module
41
+ ## Machine learning and market analytics engine
42
+
43
+ ---
44
+
45
+ The Analysis module powers Crypto Trader’s price prediction and model
46
+ training. It ingests market data from PostgreSQL, engineers features, trains
47
+ LSTM‑based models (including multi‑layer variants), generates predictions, and
48
+ reports results back to the platform.
49
+
50
+ Important: Past results and backtests do not guarantee future performance.
51
+ Always start in paper mode. Liability is your own.
52
+
53
+ ## ⭐️ What this module is
54
+ - A Python analytics service used by Crypto Trader’s core platform.
55
+ - Strategic ML engine: LSTM, complex LSTM, and multi‑layer LSTM variants.
56
+ - Feature engineering pipeline with robust scaling and time‑windowed sequences.
57
+ - Training, prediction, and reporting utilities that integrate with the Django
58
+ API.
59
+
60
+ ## 🧭 Key capabilities
61
+ - Data access
62
+ - Pulls market snapshots from PostgreSQL via SQLAlchemy; bulk `COPY` for
63
+ speed.
64
+ - Supports multiple query modes: `current_price`, `historical`,
65
+ `historical_spaced`.
66
+ - Feature engineering
67
+ - Sliding time windows (configurable `sequence_length`).
68
+ - Engineered channels: past trends, key timestamps, correlation with target
69
+ returns.
70
+ - Multi‑scale preprocessing for multi‑layer models (short/medium/long
71
+ horizons).
72
+ - Models and training
73
+ - LSTM models with Keras/TensorFlow; early stopping, LR scheduling,
74
+ checkpoints.
75
+ - Multi‑layer models combine short, medium, and long sequences.
76
+ - GPU execution when available; CPU fallback supported.
77
+ - Predictions and reporting
78
+ - Generates next‑step price predictions for a target currency.
79
+ - Posts predictions and training session summaries to the platform API.
80
+ - TensorBoard logs for model inspection.
81
+
82
+ ## 🔗 How it fits into Crypto Trader
83
+ - Input: Market snapshot data from the platform database (PostgreSQL).
84
+ - Output: Trained model artifacts under `models/...`, predicted prices,
85
+ metrics.
86
+ - Integration: Sends structured payloads to the Django API.
87
+
88
+ ## 🧰 Operation
89
+ This module is operated by project owners alongside the Django API and two
90
+ GPUs for training.
91
+
92
+ - Environment and data
93
+ - Database: PostgreSQL
94
+ - Market snapshots table must be populated; `currencies.json` is used for
95
+ price column discovery.
96
+ - GPU setup
97
+ - Two‑GPU operation is supported. Utilities in the codebase and the scripts
98
+ under `gpu/` demonstrate splitting currency workloads across devices.
99
+ - Example GPU launcher scripts live under `gpu/` (e.g.,
100
+ `gpu/run_gpu_zero.py`).
101
+ - Common operator actions
102
+ - Train a single‑currency LSTM model
103
+ - Entry: `src/apps/learning/models/training/training_session.py`
104
+ - Train a multi‑layer model (short/medium/long sequences)
105
+ - Entry: `src/apps/learning/models/training/training_session.py`
106
+ - Make a one‑off prediction for a currency
107
+ - Entry: `src/apps/learning/models/training/training_session.py`
108
+ - Prediction and reporting lifecycle
109
+ - Entry: `src/apps/learning/models/training/training_session.py`
110
+ - Note: `TrainingSession.train()` will compute a prediction after training
111
+ and report it via the platform integration.
112
+ - Standalone utilities for sending predictions also exist under
113
+ `apps/learning/models/prediction/predictions.py` if needed.
114
+ - Run a GPU‑oriented launcher
115
+ - Scripts under `gpu/` (e.g., `gpu/run_gpu_zero.py`,
116
+ `gpu/run_gpu_one.py`).
117
+
118
+ Notes:
119
+ - Training hyperparameters can be chosen via `TrainingType`
120
+ (`src/apps/learning/models/training/training_type.py`) or by building a
121
+ `TrainingModel`.
122
+ - Multi‑layer models live under `src/apps/learning/models/ai/lstm/layered/...`.
123
+
124
+ ## 🔒 Safety, privacy, and control
125
+ - This module does not manage exchange API keys directly; it trains/predicts
126
+ from database data.
127
+ - Start with small datasets and paper trading.
128
+ - Guardrails (e.g., position sizing, stop loss) are enforced by the trading
129
+ engine, not this module.
130
+
131
+ ## 🛠️ Technology in this module
132
+ - Python 3
133
+ - TensorFlow + Keras
134
+ - NumPy, Pandas, scikit‑learn
135
+ - SQLAlchemy (COPY to CSV optimization)
136
+ - Requests (HTTP)
137
+ - `attrs` / `typing_extensions`
138
+
139
+ ## ❓ Questions or help
140
+ Email Oliver Lear Sigwarth (@theoliverlear): sigwarthsoftware@gmail.com
141
+
142
+ ## 📄 License
143
+ See `LICENSE.md` in the repository root.
@@ -0,0 +1,104 @@
1
+ # Crypto Trader — Analysis Module
2
+ ## Machine learning and market analytics engine
3
+
4
+ ---
5
+
6
+ The Analysis module powers Crypto Trader’s price prediction and model
7
+ training. It ingests market data from PostgreSQL, engineers features, trains
8
+ LSTM‑based models (including multi‑layer variants), generates predictions, and
9
+ reports results back to the platform.
10
+
11
+ Important: Past results and backtests do not guarantee future performance.
12
+ Always start in paper mode. Liability is your own.
13
+
14
+ ## ⭐️ What this module is
15
+ - A Python analytics service used by Crypto Trader’s core platform.
16
+ - Strategic ML engine: LSTM, complex LSTM, and multi‑layer LSTM variants.
17
+ - Feature engineering pipeline with robust scaling and time‑windowed sequences.
18
+ - Training, prediction, and reporting utilities that integrate with the Django
19
+ API.
20
+
21
+ ## 🧭 Key capabilities
22
+ - Data access
23
+ - Pulls market snapshots from PostgreSQL via SQLAlchemy; bulk `COPY` for
24
+ speed.
25
+ - Supports multiple query modes: `current_price`, `historical`,
26
+ `historical_spaced`.
27
+ - Feature engineering
28
+ - Sliding time windows (configurable `sequence_length`).
29
+ - Engineered channels: past trends, key timestamps, correlation with target
30
+ returns.
31
+ - Multi‑scale preprocessing for multi‑layer models (short/medium/long
32
+ horizons).
33
+ - Models and training
34
+ - LSTM models with Keras/TensorFlow; early stopping, LR scheduling,
35
+ checkpoints.
36
+ - Multi‑layer models combine short, medium, and long sequences.
37
+ - GPU execution when available; CPU fallback supported.
38
+ - Predictions and reporting
39
+ - Generates next‑step price predictions for a target currency.
40
+ - Posts predictions and training session summaries to the platform API.
41
+ - TensorBoard logs for model inspection.
42
+
43
+ ## 🔗 How it fits into Crypto Trader
44
+ - Input: Market snapshot data from the platform database (PostgreSQL).
45
+ - Output: Trained model artifacts under `models/...`, predicted prices,
46
+ metrics.
47
+ - Integration: Sends structured payloads to the Django API.
48
+
49
+ ## 🧰 Operation
50
+ This module is operated by project owners alongside the Django API and two
51
+ GPUs for training.
52
+
53
+ - Environment and data
54
+ - Database: PostgreSQL
55
+ - Market snapshots table must be populated; `currencies.json` is used for
56
+ price column discovery.
57
+ - GPU setup
58
+ - Two‑GPU operation is supported. Utilities in the codebase and the scripts
59
+ under `gpu/` demonstrate splitting currency workloads across devices.
60
+ - Example GPU launcher scripts live under `gpu/` (e.g.,
61
+ `gpu/run_gpu_zero.py`).
62
+ - Common operator actions
63
+ - Train a single‑currency LSTM model
64
+ - Entry: `src/apps/learning/models/training/training_session.py`
65
+ - Train a multi‑layer model (short/medium/long sequences)
66
+ - Entry: `src/apps/learning/models/training/training_session.py`
67
+ - Make a one‑off prediction for a currency
68
+ - Entry: `src/apps/learning/models/training/training_session.py`
69
+ - Prediction and reporting lifecycle
70
+ - Entry: `src/apps/learning/models/training/training_session.py`
71
+ - Note: `TrainingSession.train()` will compute a prediction after training
72
+ and report it via the platform integration.
73
+ - Standalone utilities for sending predictions also exist under
74
+ `apps/learning/models/prediction/predictions.py` if needed.
75
+ - Run a GPU‑oriented launcher
76
+ - Scripts under `gpu/` (e.g., `gpu/run_gpu_zero.py`,
77
+ `gpu/run_gpu_one.py`).
78
+
79
+ Notes:
80
+ - Training hyperparameters can be chosen via `TrainingType`
81
+ (`src/apps/learning/models/training/training_type.py`) or by building a
82
+ `TrainingModel`.
83
+ - Multi‑layer models live under `src/apps/learning/models/ai/lstm/layered/...`.
84
+
85
+ ## 🔒 Safety, privacy, and control
86
+ - This module does not manage exchange API keys directly; it trains/predicts
87
+ from database data.
88
+ - Start with small datasets and paper trading.
89
+ - Guardrails (e.g., position sizing, stop loss) are enforced by the trading
90
+ engine, not this module.
91
+
92
+ ## 🛠️ Technology in this module
93
+ - Python 3
94
+ - TensorFlow + Keras
95
+ - NumPy, Pandas, scikit‑learn
96
+ - SQLAlchemy (COPY to CSV optimization)
97
+ - Requests (HTTP)
98
+ - `attrs` / `typing_extensions`
99
+
100
+ ## ❓ Questions or help
101
+ Email Oliver Lear Sigwarth (@theoliverlear): sigwarthsoftware@gmail.com
102
+
103
+ ## 📄 License
104
+ See `LICENSE.md` in the repository root.
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: crypto-trader-analysis
3
+ Version: 0.1.2
4
+ Summary: Analysis and ML components for the Crypto Trader platform (news sentiment, training, utilities).
5
+ Author-email: Oliver Lear Sigwarth <sigwarthsoftware@gmail.com>
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Homepage, https://github.com/theoliverlear/Crypto-Trader
8
+ Project-URL: Repository, https://github.com/theoliverlear/Crypto-Trader
9
+ Project-URL: Issues, https://github.com/theoliverlear/Crypto-Trader/issues
10
+ Keywords: crypto,trading,machine-learning,tensorflow,django,analysis,sentiment
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Office/Business :: Financial :: Investment
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Operating System :: OS Independent
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: attrs>=23.0.0
23
+ Requires-Dist: requests>=2.31.0
24
+ Requires-Dist: beautifulsoup4>=4.12.0
25
+ Provides-Extra: web
26
+ Requires-Dist: Django>=5.1; extra == "web"
27
+ Provides-Extra: data
28
+ Requires-Dist: numpy>=1.23; extra == "data"
29
+ Requires-Dist: pandas>=2.0; extra == "data"
30
+ Provides-Extra: ml
31
+ Requires-Dist: numpy>=1.23; extra == "ml"
32
+ Requires-Dist: pandas>=2.0; extra == "ml"
33
+ Requires-Dist: tensorflow>=2.14; extra == "ml"
34
+ Provides-Extra: all
35
+ Requires-Dist: Django>=5.1; extra == "all"
36
+ Requires-Dist: numpy>=1.23; extra == "all"
37
+ Requires-Dist: pandas>=2.0; extra == "all"
38
+ Requires-Dist: tensorflow>=2.14; extra == "all"
39
+
40
+ # Crypto Trader — Analysis Module
41
+ ## Machine learning and market analytics engine
42
+
43
+ ---
44
+
45
+ The Analysis module powers Crypto Trader’s price prediction and model
46
+ training. It ingests market data from PostgreSQL, engineers features, trains
47
+ LSTM‑based models (including multi‑layer variants), generates predictions, and
48
+ reports results back to the platform.
49
+
50
+ Important: Past results and backtests do not guarantee future performance.
51
+ Always start in paper mode. Liability is your own.
52
+
53
+ ## ⭐️ What this module is
54
+ - A Python analytics service used by Crypto Trader’s core platform.
55
+ - Strategic ML engine: LSTM, complex LSTM, and multi‑layer LSTM variants.
56
+ - Feature engineering pipeline with robust scaling and time‑windowed sequences.
57
+ - Training, prediction, and reporting utilities that integrate with the Django
58
+ API.
59
+
60
+ ## 🧭 Key capabilities
61
+ - Data access
62
+ - Pulls market snapshots from PostgreSQL via SQLAlchemy; bulk `COPY` for
63
+ speed.
64
+ - Supports multiple query modes: `current_price`, `historical`,
65
+ `historical_spaced`.
66
+ - Feature engineering
67
+ - Sliding time windows (configurable `sequence_length`).
68
+ - Engineered channels: past trends, key timestamps, correlation with target
69
+ returns.
70
+ - Multi‑scale preprocessing for multi‑layer models (short/medium/long
71
+ horizons).
72
+ - Models and training
73
+ - LSTM models with Keras/TensorFlow; early stopping, LR scheduling,
74
+ checkpoints.
75
+ - Multi‑layer models combine short, medium, and long sequences.
76
+ - GPU execution when available; CPU fallback supported.
77
+ - Predictions and reporting
78
+ - Generates next‑step price predictions for a target currency.
79
+ - Posts predictions and training session summaries to the platform API.
80
+ - TensorBoard logs for model inspection.
81
+
82
+ ## 🔗 How it fits into Crypto Trader
83
+ - Input: Market snapshot data from the platform database (PostgreSQL).
84
+ - Output: Trained model artifacts under `models/...`, predicted prices,
85
+ metrics.
86
+ - Integration: Sends structured payloads to the Django API.
87
+
88
+ ## 🧰 Operation
89
+ This module is operated by project owners alongside the Django API and two
90
+ GPUs for training.
91
+
92
+ - Environment and data
93
+ - Database: PostgreSQL
94
+ - Market snapshots table must be populated; `currencies.json` is used for
95
+ price column discovery.
96
+ - GPU setup
97
+ - Two‑GPU operation is supported. Utilities in the codebase and the scripts
98
+ under `gpu/` demonstrate splitting currency workloads across devices.
99
+ - Example GPU launcher scripts live under `gpu/` (e.g.,
100
+ `gpu/run_gpu_zero.py`).
101
+ - Common operator actions
102
+ - Train a single‑currency LSTM model
103
+ - Entry: `src/apps/learning/models/training/training_session.py`
104
+ - Train a multi‑layer model (short/medium/long sequences)
105
+ - Entry: `src/apps/learning/models/training/training_session.py`
106
+ - Make a one‑off prediction for a currency
107
+ - Entry: `src/apps/learning/models/training/training_session.py`
108
+ - Prediction and reporting lifecycle
109
+ - Entry: `src/apps/learning/models/training/training_session.py`
110
+ - Note: `TrainingSession.train()` will compute a prediction after training
111
+ and report it via the platform integration.
112
+ - Standalone utilities for sending predictions also exist under
113
+ `apps/learning/models/prediction/predictions.py` if needed.
114
+ - Run a GPU‑oriented launcher
115
+ - Scripts under `gpu/` (e.g., `gpu/run_gpu_zero.py`,
116
+ `gpu/run_gpu_one.py`).
117
+
118
+ Notes:
119
+ - Training hyperparameters can be chosen via `TrainingType`
120
+ (`src/apps/learning/models/training/training_type.py`) or by building a
121
+ `TrainingModel`.
122
+ - Multi‑layer models live under `src/apps/learning/models/ai/lstm/layered/...`.
123
+
124
+ ## 🔒 Safety, privacy, and control
125
+ - This module does not manage exchange API keys directly; it trains/predicts
126
+ from database data.
127
+ - Start with small datasets and paper trading.
128
+ - Guardrails (e.g., position sizing, stop loss) are enforced by the trading
129
+ engine, not this module.
130
+
131
+ ## 🛠️ Technology in this module
132
+ - Python 3
133
+ - TensorFlow + Keras
134
+ - NumPy, Pandas, scikit‑learn
135
+ - SQLAlchemy (COPY to CSV optimization)
136
+ - Requests (HTTP)
137
+ - `attrs` / `typing_extensions`
138
+
139
+ ## ❓ Questions or help
140
+ Email Oliver Lear Sigwarth (@theoliverlear): sigwarthsoftware@gmail.com
141
+
142
+ ## 📄 License
143
+ See `LICENSE.md` in the repository root.
@@ -0,0 +1,85 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ crypto_trader_analysis.egg-info/PKG-INFO
5
+ crypto_trader_analysis.egg-info/SOURCES.txt
6
+ crypto_trader_analysis.egg-info/dependency_links.txt
7
+ crypto_trader_analysis.egg-info/entry_points.txt
8
+ crypto_trader_analysis.egg-info/requires.txt
9
+ crypto_trader_analysis.egg-info/top_level.txt
10
+ src/__init__.py
11
+ src/crypto_trader_analysis/__init__.py
12
+ src/crypto_trader_analysis/api/__init__.py
13
+ src/crypto_trader_analysis/api/asgi.py
14
+ src/crypto_trader_analysis/api/settings.py
15
+ src/crypto_trader_analysis/api/urls.py
16
+ src/crypto_trader_analysis/api/wsgi.py
17
+ src/crypto_trader_analysis/apps/__init__.py
18
+ src/crypto_trader_analysis/apps/learning/__init__.py
19
+ src/crypto_trader_analysis/apps/learning/models/__init__.py
20
+ src/crypto_trader_analysis/apps/learning/models/currency_json_generator.py
21
+ src/crypto_trader_analysis/apps/learning/models/ai/__init__.py
22
+ src/crypto_trader_analysis/apps/learning/models/ai/model_retriever.py
23
+ src/crypto_trader_analysis/apps/learning/models/ai/model_type.py
24
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/__init__.py
25
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/base_model.py
26
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/complex_lstm_model.py
27
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/lstm_model.py
28
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/__init__.py
29
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/complex_multi_layer_lstm_model.py
30
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/multi_layer_base_model.py
31
+ src/crypto_trader_analysis/apps/learning/models/ai/lstm/layered/multi_layer_lstm_model.py
32
+ src/crypto_trader_analysis/apps/learning/models/data/__init__.py
33
+ src/crypto_trader_analysis/apps/learning/models/data/preprocessor.py
34
+ src/crypto_trader_analysis/apps/learning/models/database/__init__.py
35
+ src/crypto_trader_analysis/apps/learning/models/database/database.py
36
+ src/crypto_trader_analysis/apps/learning/models/database/query_load.py
37
+ src/crypto_trader_analysis/apps/learning/models/database/query_type.py
38
+ src/crypto_trader_analysis/apps/learning/models/prediction/__init__.py
39
+ src/crypto_trader_analysis/apps/learning/models/prediction/prediction.py
40
+ src/crypto_trader_analysis/apps/learning/models/prediction/predictions.py
41
+ src/crypto_trader_analysis/apps/learning/models/training/__init__.py
42
+ src/crypto_trader_analysis/apps/learning/models/training/multi_layer_training_model.py
43
+ src/crypto_trader_analysis/apps/learning/models/training/multi_layer_training_model_builder.py
44
+ src/crypto_trader_analysis/apps/learning/models/training/train_model.py
45
+ src/crypto_trader_analysis/apps/learning/models/training/training_model.py
46
+ src/crypto_trader_analysis/apps/learning/models/training/training_model_builder.py
47
+ src/crypto_trader_analysis/apps/learning/models/training/training_session.py
48
+ src/crypto_trader_analysis/apps/learning/models/training/training_type.py
49
+ src/crypto_trader_analysis/apps/learning/models/training/correlations/__init__.py
50
+ src/crypto_trader_analysis/apps/learning/models/training/correlations/colrelations_analyzer.py
51
+ src/crypto_trader_analysis/apps/learning/models/training/specs/__init__.py
52
+ src/crypto_trader_analysis/apps/learning/models/training/specs/batch_size_evaluations.py
53
+ src/crypto_trader_analysis/apps/learning/models/training/specs/dataset_size.py
54
+ src/crypto_trader_analysis/apps/learning/models/training/specs/epoch_focus.py
55
+ src/crypto_trader_analysis/apps/learning/models/training/specs/sequence_length_sentiment.py
56
+ src/crypto_trader_analysis/apps/news/__init__.py
57
+ src/crypto_trader_analysis/apps/news/models/__init__.py
58
+ src/crypto_trader_analysis/apps/news/models/fetch_articles.py
59
+ src/crypto_trader_analysis/apps/news/models/analysis/__init__.py
60
+ src/crypto_trader_analysis/apps/news/models/analysis/crypto_regex.py
61
+ src/crypto_trader_analysis/apps/news/models/analysis/parse_sentiment.py
62
+ src/crypto_trader_analysis/apps/news/models/analysis/sentiment/__init__.py
63
+ src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_analyzer.py
64
+ src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_label.py
65
+ src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_model.py
66
+ src/crypto_trader_analysis/apps/news/models/analysis/sentiment/sentiment_result.py
67
+ src/crypto_trader_analysis/apps/news/models/article/__init__.py
68
+ src/crypto_trader_analysis/apps/news/models/article/article.py
69
+ src/crypto_trader_analysis/apps/news/models/article/scored_article.py
70
+ src/crypto_trader_analysis/apps/news/models/sources/__init__.py
71
+ src/crypto_trader_analysis/apps/news/models/sources/author_regex.py
72
+ src/crypto_trader_analysis/apps/news/models/sources/news_source.py
73
+ src/crypto_trader_analysis/apps/news/models/sources/news_sources.json
74
+ src/crypto_trader_analysis/apps/news/models/sources/news_sources.py
75
+ src/crypto_trader_analysis/apps/news/views/__init__.py
76
+ src/crypto_trader_analysis/apps/news/views/urls.py
77
+ src/crypto_trader_analysis/apps/news/views/sentiment/__init__.py
78
+ src/crypto_trader_analysis/apps/news/views/sentiment/sentiment_harvest_view.py
79
+ src/crypto_trader_analysis/apps/news/views/sentiment/urls.py
80
+ src/crypto_trader_analysis/apps/news/views/sentiment/targeted/__init__.py
81
+ src/crypto_trader_analysis/apps/news/views/sentiment/targeted/date_targeted_sentiment_harvest_view.py
82
+ src/crypto_trader_analysis/apps/news/views/sentiment/targeted/urls.py
83
+ src/crypto_trader_analysis/gpu/__init__.py
84
+ src/crypto_trader_analysis/gpu/run_gpu_one.py
85
+ src/crypto_trader_analysis/gpu/run_gpu_zero.py
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ crypto-trader-gpu-one = src.crypto_trader_analysis.gpu.run_gpu_one:main
3
+ crypto-trader-gpu-zero = src.crypto_trader_analysis.gpu.run_gpu_zero:main
@@ -0,0 +1,21 @@
1
+ attrs>=23.0.0
2
+ requests>=2.31.0
3
+ beautifulsoup4>=4.12.0
4
+
5
+ [all]
6
+ Django>=5.1
7
+ numpy>=1.23
8
+ pandas>=2.0
9
+ tensorflow>=2.14
10
+
11
+ [data]
12
+ numpy>=1.23
13
+ pandas>=2.0
14
+
15
+ [ml]
16
+ numpy>=1.23
17
+ pandas>=2.0
18
+ tensorflow>=2.14
19
+
20
+ [web]
21
+ Django>=5.1
@@ -0,0 +1,77 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "crypto-trader-analysis"
7
+ version = "0.1.2"
8
+ description = "Analysis and ML components for the Crypto Trader platform (news sentiment, training, utilities)."
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ requires-python = ">=3.10"
11
+ license = "LicenseRef-Proprietary"
12
+ authors = [
13
+ { name = "Oliver Lear Sigwarth", email = "sigwarthsoftware@gmail.com" }
14
+ ]
15
+ keywords = ["crypto", "trading", "machine-learning", "tensorflow", "django", "analysis", "sentiment"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
+ "Topic :: Office/Business :: Financial :: Investment",
21
+ "Programming Language :: Python",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+ # Keep base deps light; provide heavy ones as extras
28
+ dependencies = [
29
+ "attrs>=23.0.0",
30
+ "requests>=2.31.0",
31
+ "beautifulsoup4>=4.12.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ web = [
36
+ "Django>=5.1",
37
+ ]
38
+ data = [
39
+ "numpy>=1.23",
40
+ "pandas>=2.0",
41
+ ]
42
+ ml = [
43
+ "numpy>=1.23",
44
+ "pandas>=2.0",
45
+ "tensorflow>=2.14",
46
+ ]
47
+ all = [
48
+ "Django>=5.1",
49
+ "numpy>=1.23",
50
+ "pandas>=2.0",
51
+ "tensorflow>=2.14",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/theoliverlear/Crypto-Trader"
56
+ Repository = "https://github.com/theoliverlear/Crypto-Trader"
57
+ Issues = "https://github.com/theoliverlear/Crypto-Trader/issues"
58
+
59
+ [project.scripts]
60
+ crypto-trader-gpu-zero = "src.crypto_trader_analysis.gpu.run_gpu_zero:main"
61
+ crypto-trader-gpu-one = "src.crypto_trader_analysis.gpu.run_gpu_one:main"
62
+
63
+ [tool.setuptools]
64
+ # We intentionally package the top-level "src" as a package because the code imports via
65
+ # "src.crypto_trader_analysis". This preserves import compatibility on installation.
66
+ include-package-data = true
67
+
68
+ [tool.setuptools.packages.find]
69
+ where = ["."]
70
+ include = [
71
+ "src",
72
+ "src.*",
73
+ ]
74
+
75
+ [tool.setuptools.package-data]
76
+ # Include JSON data files inside the package
77
+ "src.crypto_trader_analysis" = ["**/*.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,2 @@
1
+ __all__ = []
2
+ __version__ = "0.1.2"
@@ -0,0 +1,16 @@
1
+ """
2
+ ASGI config for api project.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings')
15
+
16
+ application = get_asgi_application()