lecrapaud 0.4.1__py3-none-any.whl → 0.5.0__py3-none-any.whl
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.
Potentially problematic release.
This version of lecrapaud might be problematic. Click here for more details.
- lecrapaud/config.py +15 -12
- lecrapaud/db/alembic/env.py +7 -2
- lecrapaud/db/alembic/versions/2025_06_20_1924-1edada319fd7_initial_setup.py +214 -0
- lecrapaud/db/alembic.ini +1 -1
- lecrapaud/db/models/base.py +28 -0
- lecrapaud/db/models/dataset.py +5 -6
- lecrapaud/db/models/feature.py +4 -3
- lecrapaud/db/models/feature_selection.py +11 -8
- lecrapaud/db/models/feature_selection_rank.py +4 -3
- lecrapaud/db/models/model.py +0 -1
- lecrapaud/db/models/model_selection.py +9 -4
- lecrapaud/db/models/model_training.py +2 -3
- lecrapaud/db/models/score.py +5 -13
- lecrapaud/db/models/target.py +2 -3
- lecrapaud/db/session.py +40 -18
- lecrapaud-0.5.0.dist-info/METADATA +263 -0
- lecrapaud-0.5.0.dist-info/RECORD +46 -0
- lecrapaud/db/alembic/versions/2025_04_06_1738-7390745388e4_initial_setup.py +0 -295
- lecrapaud/db/alembic/versions/2025_04_06_1755-40cd8d3e798e_unique_constraint_for_data.py +0 -30
- lecrapaud/db/alembic/versions/2025_05_23_1724-2360941fa0bd_longer_string.py +0 -52
- lecrapaud/db/alembic/versions/2025_05_27_1159-b96396dcfaff_add_env_to_trading_tables.py +0 -34
- lecrapaud/db/alembic/versions/2025_05_27_1337-40cbfc215f7c_fix_nb_character_on_portfolio.py +0 -39
- lecrapaud/db/alembic/versions/2025_05_27_1526-3de994115317_to_datetime.py +0 -36
- lecrapaud/db/alembic/versions/2025_05_27_2003-25c227c684f8_add_fees_to_transactions.py +0 -30
- lecrapaud/db/alembic/versions/2025_05_27_2047-6b6f2d38e9bc_double_instead_of_float.py +0 -132
- lecrapaud/db/alembic/versions/2025_05_31_1111-c175e4a36d68_generalise_stock_to_group.py +0 -36
- lecrapaud/db/alembic/versions/2025_05_31_1256-5681095bfc27_create_investment_run_and_portfolio_.py +0 -62
- lecrapaud/db/alembic/versions/2025_05_31_1806-339927587383_add_investment_run_id.py +0 -107
- lecrapaud/db/alembic/versions/2025_05_31_1834-52b809a34371_make_nullablee.py +0 -50
- lecrapaud/db/alembic/versions/2025_05_31_1849-3b8550297e8e_change_date_to_datetime.py +0 -44
- lecrapaud/db/alembic/versions/2025_05_31_1852-e6b8c95d8243_add_date_to_portfolio_history.py +0 -30
- lecrapaud/db/alembic/versions/2025_06_10_1136-db8cdd83563a_addnewsandoptiontodata.py +0 -32
- lecrapaud/db/alembic/versions/2025_06_17_1652-c45f5e49fa2c_make_fields_nullable.py +0 -89
- lecrapaud-0.4.1.dist-info/METADATA +0 -171
- lecrapaud-0.4.1.dist-info/RECORD +0 -61
- {lecrapaud-0.4.1.dist-info → lecrapaud-0.5.0.dist-info}/LICENSE +0 -0
- {lecrapaud-0.4.1.dist-info → lecrapaud-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
"""initial setup
|
|
2
|
-
|
|
3
|
-
Revision ID: 7390745388e4
|
|
4
|
-
Revises:
|
|
5
|
-
Create Date: 2025-04-06 17:38:29.297967
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '7390745388e4'
|
|
16
|
-
down_revision: Union[str, None] = None
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.create_table('datas',
|
|
24
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
25
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
26
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
27
|
-
sa.Column('date', sa.DateTime(), nullable=True),
|
|
28
|
-
sa.Column('open', sa.Float(), nullable=True),
|
|
29
|
-
sa.Column('high', sa.Float(), nullable=True),
|
|
30
|
-
sa.Column('low', sa.Float(), nullable=True),
|
|
31
|
-
sa.Column('close', sa.Float(), nullable=True),
|
|
32
|
-
sa.Column('adjclose', sa.Float(), nullable=True),
|
|
33
|
-
sa.Column('volume', sa.BigInteger(), nullable=True),
|
|
34
|
-
sa.Column('stock', sa.String(length=50), nullable=True),
|
|
35
|
-
sa.Column('isin', sa.String(length=50), nullable=True),
|
|
36
|
-
sa.Column('security', sa.String(length=50), nullable=True),
|
|
37
|
-
sa.Column('sector', sa.String(length=255), nullable=True),
|
|
38
|
-
sa.Column('subindustry', sa.String(length=255), nullable=True),
|
|
39
|
-
sa.Column('location', sa.String(length=255), nullable=True),
|
|
40
|
-
sa.Column('vix_close', sa.Float(), nullable=True),
|
|
41
|
-
sa.PrimaryKeyConstraint('id')
|
|
42
|
-
)
|
|
43
|
-
op.create_index(op.f('ix_datas_date'), 'datas', ['date'], unique=False)
|
|
44
|
-
op.create_index(op.f('ix_datas_id'), 'datas', ['id'], unique=False)
|
|
45
|
-
op.create_index(op.f('ix_datas_stock'), 'datas', ['stock'], unique=False)
|
|
46
|
-
op.create_table('datasets',
|
|
47
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
48
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
49
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
50
|
-
sa.Column('name', sa.String(length=50), nullable=False),
|
|
51
|
-
sa.Column('path', sa.String(length=255), nullable=True),
|
|
52
|
-
sa.Column('type', sa.String(length=50), nullable=False),
|
|
53
|
-
sa.Column('size', sa.Integer(), nullable=False),
|
|
54
|
-
sa.Column('train_size', sa.Integer(), nullable=False),
|
|
55
|
-
sa.Column('val_size', sa.Integer(), nullable=True),
|
|
56
|
-
sa.Column('test_size', sa.Integer(), nullable=False),
|
|
57
|
-
sa.Column('number_of_stocks', sa.Integer(), nullable=False),
|
|
58
|
-
sa.Column('list_of_companies', sa.JSON(), nullable=False),
|
|
59
|
-
sa.Column('corr_threshold', sa.Float(), nullable=False),
|
|
60
|
-
sa.Column('max_features', sa.Integer(), nullable=False),
|
|
61
|
-
sa.Column('percentile', sa.Float(), nullable=False),
|
|
62
|
-
sa.Column('start_date', sa.DateTime(), nullable=False),
|
|
63
|
-
sa.Column('end_date', sa.DateTime(), nullable=False),
|
|
64
|
-
sa.Column('train_start_date', sa.DateTime(), nullable=False),
|
|
65
|
-
sa.Column('train_end_date', sa.DateTime(), nullable=False),
|
|
66
|
-
sa.Column('val_start_date', sa.DateTime(), nullable=True),
|
|
67
|
-
sa.Column('val_end_date', sa.DateTime(), nullable=True),
|
|
68
|
-
sa.Column('test_start_date', sa.DateTime(), nullable=False),
|
|
69
|
-
sa.Column('test_end_date', sa.DateTime(), nullable=False),
|
|
70
|
-
sa.PrimaryKeyConstraint('id'),
|
|
71
|
-
sa.UniqueConstraint('name', name='uq_datasets_composite')
|
|
72
|
-
)
|
|
73
|
-
op.create_index(op.f('ix_datasets_id'), 'datasets', ['id'], unique=False)
|
|
74
|
-
op.create_table('features',
|
|
75
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
76
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
77
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
78
|
-
sa.Column('name', sa.String(length=50), nullable=False),
|
|
79
|
-
sa.Column('type', sa.String(length=50), nullable=True),
|
|
80
|
-
sa.PrimaryKeyConstraint('id'),
|
|
81
|
-
sa.UniqueConstraint('name')
|
|
82
|
-
)
|
|
83
|
-
op.create_index(op.f('ix_features_id'), 'features', ['id'], unique=False)
|
|
84
|
-
op.create_table('models',
|
|
85
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
86
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
87
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
88
|
-
sa.Column('name', sa.String(length=50), nullable=False),
|
|
89
|
-
sa.Column('type', sa.String(length=50), nullable=False),
|
|
90
|
-
sa.PrimaryKeyConstraint('id'),
|
|
91
|
-
sa.UniqueConstraint('name', 'type', name='uq_model_composite')
|
|
92
|
-
)
|
|
93
|
-
op.create_index(op.f('ix_models_id'), 'models', ['id'], unique=False)
|
|
94
|
-
op.create_table('operations',
|
|
95
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
96
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
97
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
98
|
-
sa.Column('stock', sa.String(length=50), nullable=False),
|
|
99
|
-
sa.Column('price_in', sa.Float(), nullable=False),
|
|
100
|
-
sa.Column('date_in', sa.Date(), nullable=False),
|
|
101
|
-
sa.Column('why_buy', sa.String(length=50), nullable=True),
|
|
102
|
-
sa.Column('price_out', sa.Float(), nullable=False),
|
|
103
|
-
sa.Column('date_out', sa.Date(), nullable=False),
|
|
104
|
-
sa.Column('why_sell', sa.String(length=50), nullable=True),
|
|
105
|
-
sa.Column('pl', sa.Float(), nullable=False),
|
|
106
|
-
sa.Column('cash', sa.Float(), nullable=False),
|
|
107
|
-
sa.Column('portfolio_value', sa.Float(), nullable=False),
|
|
108
|
-
sa.Column('total_value', sa.Float(), nullable=False),
|
|
109
|
-
sa.Column('roi', sa.Float(), nullable=False),
|
|
110
|
-
sa.Column('cumulated_roi', sa.Float(), nullable=False),
|
|
111
|
-
sa.Column('cagr', sa.Float(), nullable=False),
|
|
112
|
-
sa.PrimaryKeyConstraint('id')
|
|
113
|
-
)
|
|
114
|
-
op.create_index(op.f('ix_operations_id'), 'operations', ['id'], unique=False)
|
|
115
|
-
op.create_table('portfolios',
|
|
116
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
117
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
118
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
119
|
-
sa.Column('stock', sa.String(length=50), nullable=False),
|
|
120
|
-
sa.Column('position', sa.Integer(), nullable=False),
|
|
121
|
-
sa.Column('price_in', sa.Float(), nullable=False),
|
|
122
|
-
sa.Column('value', sa.Float(), nullable=False),
|
|
123
|
-
sa.Column('date_in', sa.Date(), nullable=False),
|
|
124
|
-
sa.Column('why_buy', sa.String(length=50), nullable=True),
|
|
125
|
-
sa.PrimaryKeyConstraint('id')
|
|
126
|
-
)
|
|
127
|
-
op.create_index(op.f('ix_portfolios_id'), 'portfolios', ['id'], unique=False)
|
|
128
|
-
op.create_table('targets',
|
|
129
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
130
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
131
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
132
|
-
sa.Column('name', sa.String(length=50), nullable=False),
|
|
133
|
-
sa.Column('type', sa.String(length=50), nullable=False),
|
|
134
|
-
sa.Column('description', sa.String(length=255), nullable=True),
|
|
135
|
-
sa.PrimaryKeyConstraint('id'),
|
|
136
|
-
sa.UniqueConstraint('name', 'type', name='uq_target_composite')
|
|
137
|
-
)
|
|
138
|
-
op.create_index(op.f('ix_targets_id'), 'targets', ['id'], unique=False)
|
|
139
|
-
op.create_table('transactions',
|
|
140
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
141
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
142
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
143
|
-
sa.Column('buy_sell', sa.String(length=50), nullable=False),
|
|
144
|
-
sa.Column('stock', sa.String(length=50), nullable=False),
|
|
145
|
-
sa.Column('price', sa.Float(), nullable=False),
|
|
146
|
-
sa.Column('position', sa.Integer(), nullable=False),
|
|
147
|
-
sa.Column('value', sa.Float(), nullable=False),
|
|
148
|
-
sa.Column('date', sa.Date(), nullable=False),
|
|
149
|
-
sa.Column('why', sa.String(length=50), nullable=True),
|
|
150
|
-
sa.PrimaryKeyConstraint('id')
|
|
151
|
-
)
|
|
152
|
-
op.create_index(op.f('ix_transactions_id'), 'transactions', ['id'], unique=False)
|
|
153
|
-
op.create_table('dataset_target_association',
|
|
154
|
-
sa.Column('dataset_id', sa.BigInteger(), nullable=False),
|
|
155
|
-
sa.Column('target_id', sa.BigInteger(), nullable=False),
|
|
156
|
-
sa.ForeignKeyConstraint(['dataset_id'], ['datasets.id'], ondelete='CASCADE'),
|
|
157
|
-
sa.ForeignKeyConstraint(['target_id'], ['targets.id'], ondelete='CASCADE'),
|
|
158
|
-
sa.PrimaryKeyConstraint('dataset_id', 'target_id')
|
|
159
|
-
)
|
|
160
|
-
op.create_table('feature_selections',
|
|
161
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
162
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
163
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
164
|
-
sa.Column('training_time', sa.Integer(), nullable=True),
|
|
165
|
-
sa.Column('best_features_path', sa.String(length=255), nullable=True),
|
|
166
|
-
sa.Column('dataset_id', sa.BigInteger(), nullable=False),
|
|
167
|
-
sa.Column('target_id', sa.BigInteger(), nullable=False),
|
|
168
|
-
sa.ForeignKeyConstraint(['dataset_id'], ['datasets.id'], ondelete='CASCADE'),
|
|
169
|
-
sa.ForeignKeyConstraint(['target_id'], ['targets.id'], ondelete='CASCADE'),
|
|
170
|
-
sa.PrimaryKeyConstraint('id'),
|
|
171
|
-
sa.UniqueConstraint('dataset_id', 'target_id', name='uq_feature_selection_composite')
|
|
172
|
-
)
|
|
173
|
-
op.create_index(op.f('ix_feature_selections_id'), 'feature_selections', ['id'], unique=False)
|
|
174
|
-
op.create_table('model_selections',
|
|
175
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
176
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
177
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
178
|
-
sa.Column('best_model_params', sa.JSON(), nullable=True),
|
|
179
|
-
sa.Column('best_model_path', sa.String(length=255), nullable=True),
|
|
180
|
-
sa.Column('best_model_id', sa.BigInteger(), nullable=True),
|
|
181
|
-
sa.Column('target_id', sa.BigInteger(), nullable=False),
|
|
182
|
-
sa.Column('dataset_id', sa.BigInteger(), nullable=False),
|
|
183
|
-
sa.ForeignKeyConstraint(['best_model_id'], ['models.id'], ondelete='CASCADE'),
|
|
184
|
-
sa.ForeignKeyConstraint(['dataset_id'], ['datasets.id'], ondelete='CASCADE'),
|
|
185
|
-
sa.ForeignKeyConstraint(['target_id'], ['targets.id'], ondelete='CASCADE'),
|
|
186
|
-
sa.PrimaryKeyConstraint('id'),
|
|
187
|
-
sa.UniqueConstraint('target_id', 'dataset_id', name='uq_model_selection_composite')
|
|
188
|
-
)
|
|
189
|
-
op.create_index(op.f('ix_model_selections_id'), 'model_selections', ['id'], unique=False)
|
|
190
|
-
op.create_table('feature_selection_association',
|
|
191
|
-
sa.Column('feature_selection_id', sa.BigInteger(), nullable=False),
|
|
192
|
-
sa.Column('feature_id', sa.BigInteger(), nullable=False),
|
|
193
|
-
sa.ForeignKeyConstraint(['feature_id'], ['features.id'], ondelete='CASCADE'),
|
|
194
|
-
sa.ForeignKeyConstraint(['feature_selection_id'], ['feature_selections.id'], ondelete='CASCADE'),
|
|
195
|
-
sa.PrimaryKeyConstraint('feature_selection_id', 'feature_id')
|
|
196
|
-
)
|
|
197
|
-
op.create_table('feature_selection_ranks',
|
|
198
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
199
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
200
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
201
|
-
sa.Column('score', sa.Float(), nullable=True),
|
|
202
|
-
sa.Column('pvalue', sa.Float(), nullable=True),
|
|
203
|
-
sa.Column('support', sa.Integer(), nullable=True),
|
|
204
|
-
sa.Column('rank', sa.Integer(), nullable=True),
|
|
205
|
-
sa.Column('method', sa.String(length=50), nullable=True),
|
|
206
|
-
sa.Column('training_time', sa.Integer(), nullable=True),
|
|
207
|
-
sa.Column('feature_id', sa.BigInteger(), nullable=True),
|
|
208
|
-
sa.Column('feature_selection_id', sa.BigInteger(), nullable=True),
|
|
209
|
-
sa.ForeignKeyConstraint(['feature_id'], ['features.id'], ondelete='CASCADE'),
|
|
210
|
-
sa.ForeignKeyConstraint(['feature_selection_id'], ['feature_selections.id'], ondelete='CASCADE'),
|
|
211
|
-
sa.PrimaryKeyConstraint('id'),
|
|
212
|
-
sa.UniqueConstraint('feature_id', 'feature_selection_id', 'method', name='uq_feature_selection_rank_composite')
|
|
213
|
-
)
|
|
214
|
-
op.create_index(op.f('ix_feature_selection_ranks_id'), 'feature_selection_ranks', ['id'], unique=False)
|
|
215
|
-
op.create_table('model_trainings',
|
|
216
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
217
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
218
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
219
|
-
sa.Column('best_params', sa.JSON(), nullable=True),
|
|
220
|
-
sa.Column('model_path', sa.String(length=255), nullable=True),
|
|
221
|
-
sa.Column('training_time', sa.Integer(), nullable=True),
|
|
222
|
-
sa.Column('model_id', sa.BigInteger(), nullable=False),
|
|
223
|
-
sa.Column('model_selection_id', sa.BigInteger(), nullable=False),
|
|
224
|
-
sa.ForeignKeyConstraint(['model_id'], ['models.id'], ),
|
|
225
|
-
sa.ForeignKeyConstraint(['model_selection_id'], ['model_selections.id'], ondelete='CASCADE'),
|
|
226
|
-
sa.PrimaryKeyConstraint('id'),
|
|
227
|
-
sa.UniqueConstraint('model_id', 'model_selection_id', name='uq_model_training_composite')
|
|
228
|
-
)
|
|
229
|
-
op.create_index(op.f('ix_model_trainings_id'), 'model_trainings', ['id'], unique=False)
|
|
230
|
-
op.create_table('scores',
|
|
231
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
232
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
233
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
234
|
-
sa.Column('type', sa.String(length=50), nullable=False),
|
|
235
|
-
sa.Column('training_time', sa.Integer(), nullable=True),
|
|
236
|
-
sa.Column('eval_data_std', sa.Float(), nullable=True),
|
|
237
|
-
sa.Column('rmse', sa.Float(), nullable=True),
|
|
238
|
-
sa.Column('rmse_std_ratio', sa.Float(), nullable=True),
|
|
239
|
-
sa.Column('mae', sa.Float(), nullable=True),
|
|
240
|
-
sa.Column('mape', sa.Float(), nullable=True),
|
|
241
|
-
sa.Column('mam', sa.Float(), nullable=True),
|
|
242
|
-
sa.Column('mad', sa.Float(), nullable=True),
|
|
243
|
-
sa.Column('mae_mam_ratio', sa.Float(), nullable=True),
|
|
244
|
-
sa.Column('mae_mad_ratio', sa.Float(), nullable=True),
|
|
245
|
-
sa.Column('r2', sa.Float(), nullable=True),
|
|
246
|
-
sa.Column('logloss', sa.Float(), nullable=True),
|
|
247
|
-
sa.Column('accuracy', sa.Float(), nullable=True),
|
|
248
|
-
sa.Column('precision', sa.Float(), nullable=True),
|
|
249
|
-
sa.Column('recall', sa.Float(), nullable=True),
|
|
250
|
-
sa.Column('f1', sa.Float(), nullable=True),
|
|
251
|
-
sa.Column('roc_auc', sa.Float(), nullable=True),
|
|
252
|
-
sa.Column('threshold', sa.Float(), nullable=True),
|
|
253
|
-
sa.Column('precision_at_threshold', sa.Float(), nullable=True),
|
|
254
|
-
sa.Column('recall_at_threshold', sa.Float(), nullable=True),
|
|
255
|
-
sa.Column('model_training_id', sa.BigInteger(), nullable=False),
|
|
256
|
-
sa.ForeignKeyConstraint(['model_training_id'], ['model_trainings.id'], ondelete='CASCADE'),
|
|
257
|
-
sa.PrimaryKeyConstraint('id')
|
|
258
|
-
)
|
|
259
|
-
op.create_index(op.f('ix_scores_id'), 'scores', ['id'], unique=False)
|
|
260
|
-
# ### end Alembic commands ###
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def downgrade() -> None:
|
|
264
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
265
|
-
op.drop_index(op.f('ix_scores_id'), table_name='scores')
|
|
266
|
-
op.drop_table('scores')
|
|
267
|
-
op.drop_index(op.f('ix_model_trainings_id'), table_name='model_trainings')
|
|
268
|
-
op.drop_table('model_trainings')
|
|
269
|
-
op.drop_index(op.f('ix_feature_selection_ranks_id'), table_name='feature_selection_ranks')
|
|
270
|
-
op.drop_table('feature_selection_ranks')
|
|
271
|
-
op.drop_table('feature_selection_association')
|
|
272
|
-
op.drop_index(op.f('ix_model_selections_id'), table_name='model_selections')
|
|
273
|
-
op.drop_table('model_selections')
|
|
274
|
-
op.drop_index(op.f('ix_feature_selections_id'), table_name='feature_selections')
|
|
275
|
-
op.drop_table('feature_selections')
|
|
276
|
-
op.drop_table('dataset_target_association')
|
|
277
|
-
op.drop_index(op.f('ix_transactions_id'), table_name='transactions')
|
|
278
|
-
op.drop_table('transactions')
|
|
279
|
-
op.drop_index(op.f('ix_targets_id'), table_name='targets')
|
|
280
|
-
op.drop_table('targets')
|
|
281
|
-
op.drop_index(op.f('ix_portfolios_id'), table_name='portfolios')
|
|
282
|
-
op.drop_table('portfolios')
|
|
283
|
-
op.drop_index(op.f('ix_operations_id'), table_name='operations')
|
|
284
|
-
op.drop_table('operations')
|
|
285
|
-
op.drop_index(op.f('ix_models_id'), table_name='models')
|
|
286
|
-
op.drop_table('models')
|
|
287
|
-
op.drop_index(op.f('ix_features_id'), table_name='features')
|
|
288
|
-
op.drop_table('features')
|
|
289
|
-
op.drop_index(op.f('ix_datasets_id'), table_name='datasets')
|
|
290
|
-
op.drop_table('datasets')
|
|
291
|
-
op.drop_index(op.f('ix_datas_stock'), table_name='datas')
|
|
292
|
-
op.drop_index(op.f('ix_datas_id'), table_name='datas')
|
|
293
|
-
op.drop_index(op.f('ix_datas_date'), table_name='datas')
|
|
294
|
-
op.drop_table('datas')
|
|
295
|
-
# ### end Alembic commands ###
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""unique constraint for data
|
|
2
|
-
|
|
3
|
-
Revision ID: 40cd8d3e798e
|
|
4
|
-
Revises: 7390745388e4
|
|
5
|
-
Create Date: 2025-04-06 17:55:47.709956
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '40cd8d3e798e'
|
|
16
|
-
down_revision: Union[str, None] = '7390745388e4'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.create_unique_constraint('uq_datas_composite', 'datas', ['date', 'stock'])
|
|
24
|
-
# ### end Alembic commands ###
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def downgrade() -> None:
|
|
28
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
29
|
-
op.drop_constraint('uq_datas_composite', 'datas', type_='unique')
|
|
30
|
-
# ### end Alembic commands ###
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"""longer_string
|
|
2
|
-
|
|
3
|
-
Revision ID: 2360941fa0bd
|
|
4
|
-
Revises: 40cd8d3e798e
|
|
5
|
-
Create Date: 2025-05-23 17:24:07.750472
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from sqlalchemy.dialects import mysql
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '2360941fa0bd'
|
|
16
|
-
down_revision: Union[str, None] = '40cd8d3e798e'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.alter_column('operations', 'why_buy',
|
|
24
|
-
existing_type=mysql.VARCHAR(length=50),
|
|
25
|
-
type_=sa.String(length=255),
|
|
26
|
-
existing_nullable=True)
|
|
27
|
-
op.alter_column('operations', 'why_sell',
|
|
28
|
-
existing_type=mysql.VARCHAR(length=50),
|
|
29
|
-
type_=sa.String(length=255),
|
|
30
|
-
existing_nullable=True)
|
|
31
|
-
op.alter_column('transactions', 'why',
|
|
32
|
-
existing_type=mysql.VARCHAR(length=50),
|
|
33
|
-
type_=sa.String(length=255),
|
|
34
|
-
existing_nullable=True)
|
|
35
|
-
# ### end Alembic commands ###
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def downgrade() -> None:
|
|
39
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
40
|
-
op.alter_column('transactions', 'why',
|
|
41
|
-
existing_type=sa.String(length=255),
|
|
42
|
-
type_=mysql.VARCHAR(length=50),
|
|
43
|
-
existing_nullable=True)
|
|
44
|
-
op.alter_column('operations', 'why_sell',
|
|
45
|
-
existing_type=sa.String(length=255),
|
|
46
|
-
type_=mysql.VARCHAR(length=50),
|
|
47
|
-
existing_nullable=True)
|
|
48
|
-
op.alter_column('operations', 'why_buy',
|
|
49
|
-
existing_type=sa.String(length=255),
|
|
50
|
-
type_=mysql.VARCHAR(length=50),
|
|
51
|
-
existing_nullable=True)
|
|
52
|
-
# ### end Alembic commands ###
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""add_env_to_trading_tables
|
|
2
|
-
|
|
3
|
-
Revision ID: b96396dcfaff
|
|
4
|
-
Revises: 2360941fa0bd
|
|
5
|
-
Create Date: 2025-05-27 11:59:55.405410
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = 'b96396dcfaff'
|
|
16
|
-
down_revision: Union[str, None] = '2360941fa0bd'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.add_column('operations', sa.Column('env', sa.String(length=50), nullable=False))
|
|
24
|
-
op.add_column('portfolios', sa.Column('env', sa.String(length=50), nullable=False))
|
|
25
|
-
op.add_column('transactions', sa.Column('env', sa.String(length=50), nullable=False))
|
|
26
|
-
# ### end Alembic commands ###
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def downgrade() -> None:
|
|
30
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
31
|
-
op.drop_column('transactions', 'env')
|
|
32
|
-
op.drop_column('portfolios', 'env')
|
|
33
|
-
op.drop_column('operations', 'env')
|
|
34
|
-
# ### end Alembic commands ###
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"""fix_nb_character_on_portfolio
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Revision ID: 40cbfc215f7c
|
|
5
|
-
Revises: b96396dcfaff
|
|
6
|
-
Create Date: 2025-05-27 13:37:18.291145
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
from typing import Sequence, Union
|
|
10
|
-
|
|
11
|
-
from alembic import op
|
|
12
|
-
import sqlalchemy as sa
|
|
13
|
-
from sqlalchemy.dialects import mysql
|
|
14
|
-
|
|
15
|
-
# revision identifiers, used by Alembic.
|
|
16
|
-
revision: str = '40cbfc215f7c'
|
|
17
|
-
down_revision: Union[str, None] = 'b96396dcfaff'
|
|
18
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
19
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def upgrade() -> None:
|
|
23
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
24
|
-
op.alter_column('portfolios', 'why_buy',
|
|
25
|
-
existing_type=mysql.VARCHAR(length=50),
|
|
26
|
-
type_=sa.String(length=255),
|
|
27
|
-
existing_nullable=True)
|
|
28
|
-
op.create_unique_constraint('uq_portfolio_composite', 'portfolios', ['stock', 'env'])
|
|
29
|
-
# ### end Alembic commands ###
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def downgrade() -> None:
|
|
33
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
34
|
-
op.drop_constraint('uq_portfolio_composite', 'portfolios', type_='unique')
|
|
35
|
-
op.alter_column('portfolios', 'why_buy',
|
|
36
|
-
existing_type=sa.String(length=255),
|
|
37
|
-
type_=mysql.VARCHAR(length=50),
|
|
38
|
-
existing_nullable=True)
|
|
39
|
-
# ### end Alembic commands ###
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"""to_datetime
|
|
2
|
-
|
|
3
|
-
Revision ID: 3de994115317
|
|
4
|
-
Revises: 40cbfc215f7c
|
|
5
|
-
Create Date: 2025-05-27 15:26:01.669012
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '3de994115317'
|
|
16
|
-
down_revision: Union[str, None] = '40cbfc215f7c'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.alter_column('transactions', 'date',
|
|
24
|
-
existing_type=sa.DATE(),
|
|
25
|
-
type_=sa.DateTime(),
|
|
26
|
-
existing_nullable=False)
|
|
27
|
-
# ### end Alembic commands ###
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def downgrade() -> None:
|
|
31
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
-
op.alter_column('transactions', 'date',
|
|
33
|
-
existing_type=sa.DateTime(),
|
|
34
|
-
type_=sa.DATE(),
|
|
35
|
-
existing_nullable=False)
|
|
36
|
-
# ### end Alembic commands ###
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""add_fees_to_transactions
|
|
2
|
-
|
|
3
|
-
Revision ID: 25c227c684f8
|
|
4
|
-
Revises: 3de994115317
|
|
5
|
-
Create Date: 2025-05-27 20:03:08.193307
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '25c227c684f8'
|
|
16
|
-
down_revision: Union[str, None] = '3de994115317'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.add_column('transactions', sa.Column('fees', sa.Float(), nullable=False))
|
|
24
|
-
# ### end Alembic commands ###
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def downgrade() -> None:
|
|
28
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
29
|
-
op.drop_column('transactions', 'fees')
|
|
30
|
-
# ### end Alembic commands ###
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"""double_instead_of_float
|
|
2
|
-
|
|
3
|
-
Revision ID: 6b6f2d38e9bc
|
|
4
|
-
Revises: 25c227c684f8
|
|
5
|
-
Create Date: 2025-05-27 20:47:45.303669
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
from typing import Sequence, Union
|
|
9
|
-
|
|
10
|
-
from alembic import op
|
|
11
|
-
import sqlalchemy as sa
|
|
12
|
-
from sqlalchemy.dialects import mysql
|
|
13
|
-
|
|
14
|
-
# revision identifiers, used by Alembic.
|
|
15
|
-
revision: str = '6b6f2d38e9bc'
|
|
16
|
-
down_revision: Union[str, None] = '25c227c684f8'
|
|
17
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
18
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def upgrade() -> None:
|
|
22
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
23
|
-
op.alter_column('operations', 'price_in',
|
|
24
|
-
existing_type=mysql.FLOAT(),
|
|
25
|
-
type_=sa.Double(),
|
|
26
|
-
existing_nullable=False)
|
|
27
|
-
op.alter_column('operations', 'price_out',
|
|
28
|
-
existing_type=mysql.FLOAT(),
|
|
29
|
-
type_=sa.Double(),
|
|
30
|
-
existing_nullable=False)
|
|
31
|
-
op.alter_column('operations', 'pl',
|
|
32
|
-
existing_type=mysql.FLOAT(),
|
|
33
|
-
type_=sa.Double(),
|
|
34
|
-
existing_nullable=False)
|
|
35
|
-
op.alter_column('operations', 'cash',
|
|
36
|
-
existing_type=mysql.FLOAT(),
|
|
37
|
-
type_=sa.Double(),
|
|
38
|
-
existing_nullable=False)
|
|
39
|
-
op.alter_column('operations', 'portfolio_value',
|
|
40
|
-
existing_type=mysql.FLOAT(),
|
|
41
|
-
type_=sa.Double(),
|
|
42
|
-
existing_nullable=False)
|
|
43
|
-
op.alter_column('operations', 'total_value',
|
|
44
|
-
existing_type=mysql.FLOAT(),
|
|
45
|
-
type_=sa.Double(),
|
|
46
|
-
existing_nullable=False)
|
|
47
|
-
op.alter_column('operations', 'roi',
|
|
48
|
-
existing_type=mysql.FLOAT(),
|
|
49
|
-
type_=sa.Double(),
|
|
50
|
-
existing_nullable=False)
|
|
51
|
-
op.alter_column('operations', 'cumulated_roi',
|
|
52
|
-
existing_type=mysql.FLOAT(),
|
|
53
|
-
type_=sa.Double(),
|
|
54
|
-
existing_nullable=False)
|
|
55
|
-
op.alter_column('operations', 'cagr',
|
|
56
|
-
existing_type=mysql.FLOAT(),
|
|
57
|
-
type_=sa.Double(),
|
|
58
|
-
existing_nullable=False)
|
|
59
|
-
op.alter_column('portfolios', 'price_in',
|
|
60
|
-
existing_type=mysql.FLOAT(),
|
|
61
|
-
type_=sa.Double(),
|
|
62
|
-
existing_nullable=False)
|
|
63
|
-
op.alter_column('portfolios', 'value',
|
|
64
|
-
existing_type=mysql.FLOAT(),
|
|
65
|
-
type_=sa.Double(),
|
|
66
|
-
existing_nullable=False)
|
|
67
|
-
op.alter_column('transactions', 'price',
|
|
68
|
-
existing_type=mysql.FLOAT(),
|
|
69
|
-
type_=sa.Double(),
|
|
70
|
-
existing_nullable=False)
|
|
71
|
-
op.alter_column('transactions', 'value',
|
|
72
|
-
existing_type=mysql.FLOAT(),
|
|
73
|
-
type_=sa.Double(),
|
|
74
|
-
existing_nullable=False)
|
|
75
|
-
# ### end Alembic commands ###
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def downgrade() -> None:
|
|
79
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
80
|
-
op.alter_column('transactions', 'value',
|
|
81
|
-
existing_type=sa.Double(),
|
|
82
|
-
type_=mysql.FLOAT(),
|
|
83
|
-
existing_nullable=False)
|
|
84
|
-
op.alter_column('transactions', 'price',
|
|
85
|
-
existing_type=sa.Double(),
|
|
86
|
-
type_=mysql.FLOAT(),
|
|
87
|
-
existing_nullable=False)
|
|
88
|
-
op.alter_column('portfolios', 'value',
|
|
89
|
-
existing_type=sa.Double(),
|
|
90
|
-
type_=mysql.FLOAT(),
|
|
91
|
-
existing_nullable=False)
|
|
92
|
-
op.alter_column('portfolios', 'price_in',
|
|
93
|
-
existing_type=sa.Double(),
|
|
94
|
-
type_=mysql.FLOAT(),
|
|
95
|
-
existing_nullable=False)
|
|
96
|
-
op.alter_column('operations', 'cagr',
|
|
97
|
-
existing_type=sa.Double(),
|
|
98
|
-
type_=mysql.FLOAT(),
|
|
99
|
-
existing_nullable=False)
|
|
100
|
-
op.alter_column('operations', 'cumulated_roi',
|
|
101
|
-
existing_type=sa.Double(),
|
|
102
|
-
type_=mysql.FLOAT(),
|
|
103
|
-
existing_nullable=False)
|
|
104
|
-
op.alter_column('operations', 'roi',
|
|
105
|
-
existing_type=sa.Double(),
|
|
106
|
-
type_=mysql.FLOAT(),
|
|
107
|
-
existing_nullable=False)
|
|
108
|
-
op.alter_column('operations', 'total_value',
|
|
109
|
-
existing_type=sa.Double(),
|
|
110
|
-
type_=mysql.FLOAT(),
|
|
111
|
-
existing_nullable=False)
|
|
112
|
-
op.alter_column('operations', 'portfolio_value',
|
|
113
|
-
existing_type=sa.Double(),
|
|
114
|
-
type_=mysql.FLOAT(),
|
|
115
|
-
existing_nullable=False)
|
|
116
|
-
op.alter_column('operations', 'cash',
|
|
117
|
-
existing_type=sa.Double(),
|
|
118
|
-
type_=mysql.FLOAT(),
|
|
119
|
-
existing_nullable=False)
|
|
120
|
-
op.alter_column('operations', 'pl',
|
|
121
|
-
existing_type=sa.Double(),
|
|
122
|
-
type_=mysql.FLOAT(),
|
|
123
|
-
existing_nullable=False)
|
|
124
|
-
op.alter_column('operations', 'price_out',
|
|
125
|
-
existing_type=sa.Double(),
|
|
126
|
-
type_=mysql.FLOAT(),
|
|
127
|
-
existing_nullable=False)
|
|
128
|
-
op.alter_column('operations', 'price_in',
|
|
129
|
-
existing_type=sa.Double(),
|
|
130
|
-
type_=mysql.FLOAT(),
|
|
131
|
-
existing_nullable=False)
|
|
132
|
-
# ### end Alembic commands ###
|