lecrapaud 0.4.2__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 +37 -17
- 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.2.dist-info/METADATA +0 -177
- lecrapaud-0.4.2.dist-info/RECORD +0 -61
- {lecrapaud-0.4.2.dist-info → lecrapaud-0.5.0.dist-info}/LICENSE +0 -0
- {lecrapaud-0.4.2.dist-info → lecrapaud-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"""generalise_stock_to_group
|
|
2
|
-
|
|
3
|
-
Revision ID: c175e4a36d68
|
|
4
|
-
Revises: 6b6f2d38e9bc
|
|
5
|
-
Create Date: 2025-05-31 11:11:42.103206
|
|
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 = 'c175e4a36d68'
|
|
16
|
-
down_revision: Union[str, None] = '6b6f2d38e9bc'
|
|
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('datasets', sa.Column('number_of_groups', sa.Integer(), nullable=False))
|
|
24
|
-
op.add_column('datasets', sa.Column('list_of_groups', sa.JSON(), nullable=False))
|
|
25
|
-
op.drop_column('datasets', 'number_of_stocks')
|
|
26
|
-
op.drop_column('datasets', 'list_of_companies')
|
|
27
|
-
# ### end Alembic commands ###
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def downgrade() -> None:
|
|
31
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
32
|
-
op.add_column('datasets', sa.Column('list_of_companies', mysql.JSON(), nullable=False))
|
|
33
|
-
op.add_column('datasets', sa.Column('number_of_stocks', mysql.INTEGER(), autoincrement=False, nullable=False))
|
|
34
|
-
op.drop_column('datasets', 'list_of_groups')
|
|
35
|
-
op.drop_column('datasets', 'number_of_groups')
|
|
36
|
-
# ### end Alembic commands ###
|
lecrapaud/db/alembic/versions/2025_05_31_1256-5681095bfc27_create_investment_run_and_portfolio_.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"""create_investment_run_and_portfolio_history
|
|
2
|
-
|
|
3
|
-
Revision ID: 5681095bfc27
|
|
4
|
-
Revises: c175e4a36d68
|
|
5
|
-
Create Date: 2025-05-31 12:56:05.041307
|
|
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 = '5681095bfc27'
|
|
16
|
-
down_revision: Union[str, None] = 'c175e4a36d68'
|
|
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('portfolio_history',
|
|
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('env', sa.String(length=50), nullable=False),
|
|
28
|
-
sa.Column('portfolio', sa.JSON(), nullable=False),
|
|
29
|
-
sa.Column('total_value', sa.Double(), nullable=False),
|
|
30
|
-
sa.Column('total_cash', sa.Double(), nullable=False),
|
|
31
|
-
sa.Column('total_cash_eur', sa.Double(), nullable=False),
|
|
32
|
-
sa.Column('total_cash_usd', sa.Double(), nullable=False),
|
|
33
|
-
sa.Column('total_portfolio_value', sa.Double(), nullable=False),
|
|
34
|
-
sa.PrimaryKeyConstraint('id')
|
|
35
|
-
)
|
|
36
|
-
op.create_index(op.f('ix_portfolio_history_id'), 'portfolio_history', ['id'], unique=False)
|
|
37
|
-
op.create_table('investment_runs',
|
|
38
|
-
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
|
39
|
-
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
40
|
-
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False),
|
|
41
|
-
sa.Column('env', sa.String(length=50), nullable=False),
|
|
42
|
-
sa.Column('start_date', sa.Date(), nullable=False),
|
|
43
|
-
sa.Column('end_date', sa.Date(), nullable=True),
|
|
44
|
-
sa.Column('dataset_id', sa.BigInteger(), nullable=False),
|
|
45
|
-
sa.Column('initial_investment', sa.Double(), nullable=False),
|
|
46
|
-
sa.Column('portfolio_max_size', sa.Integer(), nullable=False),
|
|
47
|
-
sa.Column('buffer_days_rebuy', sa.Integer(), nullable=False),
|
|
48
|
-
sa.Column('initial_portfolio', sa.JSON(), nullable=False),
|
|
49
|
-
sa.ForeignKeyConstraint(['dataset_id'], ['datasets.id'], ),
|
|
50
|
-
sa.PrimaryKeyConstraint('id')
|
|
51
|
-
)
|
|
52
|
-
op.create_index(op.f('ix_investment_runs_id'), 'investment_runs', ['id'], unique=False)
|
|
53
|
-
# ### end Alembic commands ###
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def downgrade() -> None:
|
|
57
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
58
|
-
op.drop_index(op.f('ix_investment_runs_id'), table_name='investment_runs')
|
|
59
|
-
op.drop_table('investment_runs')
|
|
60
|
-
op.drop_index(op.f('ix_portfolio_history_id'), table_name='portfolio_history')
|
|
61
|
-
op.drop_table('portfolio_history')
|
|
62
|
-
# ### end Alembic commands ###
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"""add_investment_run_id
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Revision ID: 339927587383
|
|
5
|
-
Revises: 5681095bfc27
|
|
6
|
-
Create Date: 2025-05-31 18:06:13.741056
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from typing import Sequence, Union
|
|
11
|
-
|
|
12
|
-
from alembic import op
|
|
13
|
-
import sqlalchemy as sa
|
|
14
|
-
from sqlalchemy.dialects import mysql
|
|
15
|
-
|
|
16
|
-
# revision identifiers, used by Alembic.
|
|
17
|
-
revision: str = "339927587383"
|
|
18
|
-
down_revision: Union[str, None] = "5681095bfc27"
|
|
19
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
|
20
|
-
depends_on: Union[str, Sequence[str], None] = None
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def upgrade() -> None:
|
|
24
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
25
|
-
op.add_column(
|
|
26
|
-
"operations", sa.Column("investment_run_id", sa.BigInteger(), nullable=False)
|
|
27
|
-
)
|
|
28
|
-
op.create_foreign_key(
|
|
29
|
-
None,
|
|
30
|
-
"operations",
|
|
31
|
-
"investment_runs",
|
|
32
|
-
["investment_run_id"],
|
|
33
|
-
["id"],
|
|
34
|
-
ondelete="CASCADE",
|
|
35
|
-
)
|
|
36
|
-
op.drop_column("operations", "env")
|
|
37
|
-
op.add_column(
|
|
38
|
-
"portfolio_history",
|
|
39
|
-
sa.Column("investment_run_id", sa.BigInteger(), nullable=False),
|
|
40
|
-
)
|
|
41
|
-
op.create_foreign_key(
|
|
42
|
-
None,
|
|
43
|
-
"portfolio_history",
|
|
44
|
-
"investment_runs",
|
|
45
|
-
["investment_run_id"],
|
|
46
|
-
["id"],
|
|
47
|
-
ondelete="CASCADE",
|
|
48
|
-
)
|
|
49
|
-
op.drop_column("portfolio_history", "env")
|
|
50
|
-
op.add_column(
|
|
51
|
-
"portfolios", sa.Column("investment_run_id", sa.BigInteger(), nullable=False)
|
|
52
|
-
)
|
|
53
|
-
op.drop_constraint("uq_portfolio_composite", "portfolios", type_="unique")
|
|
54
|
-
op.create_unique_constraint(
|
|
55
|
-
"uq_portfolio_composite", "portfolios", ["stock", "investment_run_id"]
|
|
56
|
-
)
|
|
57
|
-
op.create_foreign_key(
|
|
58
|
-
None,
|
|
59
|
-
"portfolios",
|
|
60
|
-
"investment_runs",
|
|
61
|
-
["investment_run_id"],
|
|
62
|
-
["id"],
|
|
63
|
-
ondelete="CASCADE",
|
|
64
|
-
)
|
|
65
|
-
op.drop_column("portfolios", "env")
|
|
66
|
-
op.add_column(
|
|
67
|
-
"transactions", sa.Column("investment_run_id", sa.BigInteger(), nullable=False)
|
|
68
|
-
)
|
|
69
|
-
op.create_foreign_key(
|
|
70
|
-
None,
|
|
71
|
-
"transactions",
|
|
72
|
-
"investment_runs",
|
|
73
|
-
["investment_run_id"],
|
|
74
|
-
["id"],
|
|
75
|
-
ondelete="CASCADE",
|
|
76
|
-
)
|
|
77
|
-
op.drop_column("transactions", "env")
|
|
78
|
-
# ### end Alembic commands ###
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def downgrade() -> None:
|
|
82
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
83
|
-
op.add_column(
|
|
84
|
-
"transactions", sa.Column("env", mysql.VARCHAR(length=50), nullable=False)
|
|
85
|
-
)
|
|
86
|
-
op.drop_constraint(None, "transactions", type_="foreignkey")
|
|
87
|
-
op.drop_column("transactions", "investment_run_id")
|
|
88
|
-
op.add_column(
|
|
89
|
-
"portfolios", sa.Column("env", mysql.VARCHAR(length=50), nullable=False)
|
|
90
|
-
)
|
|
91
|
-
op.drop_constraint(None, "portfolios", type_="foreignkey")
|
|
92
|
-
op.drop_constraint("uq_portfolio_composite", "portfolios", type_="unique")
|
|
93
|
-
op.create_unique_constraint(
|
|
94
|
-
"uq_portfolio_composite", "portfolios", ["stock", "env"]
|
|
95
|
-
)
|
|
96
|
-
op.drop_column("portfolios", "investment_run_id")
|
|
97
|
-
op.add_column(
|
|
98
|
-
"portfolio_history", sa.Column("env", mysql.VARCHAR(length=50), nullable=False)
|
|
99
|
-
)
|
|
100
|
-
op.drop_constraint(None, "portfolio_history", type_="foreignkey")
|
|
101
|
-
op.drop_column("portfolio_history", "investment_run_id")
|
|
102
|
-
op.add_column(
|
|
103
|
-
"operations", sa.Column("env", mysql.VARCHAR(length=50), nullable=False)
|
|
104
|
-
)
|
|
105
|
-
op.drop_constraint(None, "operations", type_="foreignkey")
|
|
106
|
-
op.drop_column("operations", "investment_run_id")
|
|
107
|
-
# ### end Alembic commands ###
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"""make_nullablee
|
|
2
|
-
|
|
3
|
-
Revision ID: 52b809a34371
|
|
4
|
-
Revises: 339927587383
|
|
5
|
-
Create Date: 2025-05-31 18:34:58.962966
|
|
6
|
-
|
|
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 = "52b809a34371"
|
|
17
|
-
down_revision: Union[str, None] = "339927587383"
|
|
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(
|
|
25
|
-
"investment_runs",
|
|
26
|
-
"initial_portfolio",
|
|
27
|
-
existing_type=mysql.JSON(),
|
|
28
|
-
nullable=True,
|
|
29
|
-
)
|
|
30
|
-
op.create_foreign_key(
|
|
31
|
-
None,
|
|
32
|
-
"portfolios",
|
|
33
|
-
"investment_runs",
|
|
34
|
-
["investment_run_id"],
|
|
35
|
-
["id"],
|
|
36
|
-
ondelete="CASCADE",
|
|
37
|
-
)
|
|
38
|
-
# ### end Alembic commands ###
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def downgrade() -> None:
|
|
42
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
43
|
-
op.drop_constraint(None, "portfolios", type_="foreignkey")
|
|
44
|
-
op.alter_column(
|
|
45
|
-
"investment_runs",
|
|
46
|
-
"initial_portfolio",
|
|
47
|
-
existing_type=mysql.JSON(),
|
|
48
|
-
nullable=False,
|
|
49
|
-
)
|
|
50
|
-
# ### end Alembic commands ###
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""change_date_To_datetime
|
|
2
|
-
|
|
3
|
-
Revision ID: 3b8550297e8e
|
|
4
|
-
Revises: 52b809a34371
|
|
5
|
-
Create Date: 2025-05-31 18:49:59.238283
|
|
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 = '3b8550297e8e'
|
|
16
|
-
down_revision: Union[str, None] = '52b809a34371'
|
|
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('investment_runs', 'start_date',
|
|
24
|
-
existing_type=sa.DATE(),
|
|
25
|
-
type_=sa.DateTime(),
|
|
26
|
-
existing_nullable=False)
|
|
27
|
-
op.alter_column('investment_runs', 'end_date',
|
|
28
|
-
existing_type=sa.DATE(),
|
|
29
|
-
type_=sa.DateTime(),
|
|
30
|
-
existing_nullable=True)
|
|
31
|
-
# ### end Alembic commands ###
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def downgrade() -> None:
|
|
35
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
36
|
-
op.alter_column('investment_runs', 'end_date',
|
|
37
|
-
existing_type=sa.DateTime(),
|
|
38
|
-
type_=sa.DATE(),
|
|
39
|
-
existing_nullable=True)
|
|
40
|
-
op.alter_column('investment_runs', 'start_date',
|
|
41
|
-
existing_type=sa.DateTime(),
|
|
42
|
-
type_=sa.DATE(),
|
|
43
|
-
existing_nullable=False)
|
|
44
|
-
# ### end Alembic commands ###
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"""add_date_to_portfolio_history
|
|
2
|
-
|
|
3
|
-
Revision ID: e6b8c95d8243
|
|
4
|
-
Revises: 3b8550297e8e
|
|
5
|
-
Create Date: 2025-05-31 18:52:23.021149
|
|
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 = 'e6b8c95d8243'
|
|
16
|
-
down_revision: Union[str, None] = '3b8550297e8e'
|
|
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('portfolio_history', sa.Column('date', sa.DateTime(), nullable=False))
|
|
24
|
-
# ### end Alembic commands ###
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def downgrade() -> None:
|
|
28
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
29
|
-
op.drop_column('portfolio_history', 'date')
|
|
30
|
-
# ### end Alembic commands ###
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"""AddNewsAndOptionToData
|
|
2
|
-
|
|
3
|
-
Revision ID: db8cdd83563a
|
|
4
|
-
Revises: e6b8c95d8243
|
|
5
|
-
Create Date: 2025-06-10 11:36:57.478070
|
|
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 = 'db8cdd83563a'
|
|
16
|
-
down_revision: Union[str, None] = 'e6b8c95d8243'
|
|
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('datas', sa.Column('news', sa.JSON(), nullable=True))
|
|
24
|
-
op.add_column('datas', sa.Column('options', sa.JSON(), nullable=True))
|
|
25
|
-
# ### end Alembic commands ###
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def downgrade() -> None:
|
|
29
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
30
|
-
op.drop_column('datas', 'options')
|
|
31
|
-
op.drop_column('datas', 'news')
|
|
32
|
-
# ### end Alembic commands ###
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
Revision ID: c45f5e49fa2c
|
|
4
|
-
Revises: db8cdd83563a
|
|
5
|
-
Create Date: 2025-06-17 16:52:45.042045
|
|
6
|
-
|
|
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 = "c45f5e49fa2c"
|
|
17
|
-
down_revision: Union[str, None] = "db8cdd83563a"
|
|
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(
|
|
25
|
-
"datasets", "train_size", existing_type=mysql.INTEGER(), nullable=True
|
|
26
|
-
)
|
|
27
|
-
op.alter_column(
|
|
28
|
-
"datasets", "test_size", existing_type=mysql.INTEGER(), nullable=True
|
|
29
|
-
)
|
|
30
|
-
op.alter_column(
|
|
31
|
-
"datasets", "number_of_groups", existing_type=mysql.INTEGER(), nullable=True
|
|
32
|
-
)
|
|
33
|
-
op.alter_column(
|
|
34
|
-
"datasets", "list_of_groups", existing_type=mysql.JSON(), nullable=True
|
|
35
|
-
)
|
|
36
|
-
op.alter_column(
|
|
37
|
-
"datasets", "start_date", existing_type=mysql.DATETIME(), nullable=True
|
|
38
|
-
)
|
|
39
|
-
op.alter_column(
|
|
40
|
-
"datasets", "end_date", existing_type=mysql.DATETIME(), nullable=True
|
|
41
|
-
)
|
|
42
|
-
op.alter_column(
|
|
43
|
-
"datasets", "train_start_date", existing_type=mysql.DATETIME(), nullable=True
|
|
44
|
-
)
|
|
45
|
-
op.alter_column(
|
|
46
|
-
"datasets", "train_end_date", existing_type=mysql.DATETIME(), nullable=True
|
|
47
|
-
)
|
|
48
|
-
op.alter_column(
|
|
49
|
-
"datasets", "test_start_date", existing_type=mysql.DATETIME(), nullable=True
|
|
50
|
-
)
|
|
51
|
-
op.alter_column(
|
|
52
|
-
"datasets", "test_end_date", existing_type=mysql.DATETIME(), nullable=True
|
|
53
|
-
)
|
|
54
|
-
# ### end Alembic commands ###
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def downgrade() -> None:
|
|
58
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
|
59
|
-
op.alter_column(
|
|
60
|
-
"datasets", "test_end_date", existing_type=mysql.DATETIME(), nullable=False
|
|
61
|
-
)
|
|
62
|
-
op.alter_column(
|
|
63
|
-
"datasets", "test_start_date", existing_type=mysql.DATETIME(), nullable=False
|
|
64
|
-
)
|
|
65
|
-
op.alter_column(
|
|
66
|
-
"datasets", "train_end_date", existing_type=mysql.DATETIME(), nullable=False
|
|
67
|
-
)
|
|
68
|
-
op.alter_column(
|
|
69
|
-
"datasets", "train_start_date", existing_type=mysql.DATETIME(), nullable=False
|
|
70
|
-
)
|
|
71
|
-
op.alter_column(
|
|
72
|
-
"datasets", "end_date", existing_type=mysql.DATETIME(), nullable=False
|
|
73
|
-
)
|
|
74
|
-
op.alter_column(
|
|
75
|
-
"datasets", "start_date", existing_type=mysql.DATETIME(), nullable=False
|
|
76
|
-
)
|
|
77
|
-
op.alter_column(
|
|
78
|
-
"datasets", "list_of_groups", existing_type=mysql.JSON(), nullable=False
|
|
79
|
-
)
|
|
80
|
-
op.alter_column(
|
|
81
|
-
"datasets", "number_of_groups", existing_type=mysql.INTEGER(), nullable=False
|
|
82
|
-
)
|
|
83
|
-
op.alter_column(
|
|
84
|
-
"datasets", "test_size", existing_type=mysql.INTEGER(), nullable=False
|
|
85
|
-
)
|
|
86
|
-
op.alter_column(
|
|
87
|
-
"datasets", "train_size", existing_type=mysql.INTEGER(), nullable=False
|
|
88
|
-
)
|
|
89
|
-
# ### end Alembic commands ###
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: lecrapaud
|
|
3
|
-
Version: 0.4.2
|
|
4
|
-
Summary: Framework for machine and deep learning, with regression, classification and time series analysis
|
|
5
|
-
License: Apache License
|
|
6
|
-
Author: Pierre H. Gallet
|
|
7
|
-
Requires-Python: ==3.12.*
|
|
8
|
-
Classifier: License :: Other/Proprietary License
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
-
Requires-Dist: backoff (>=2.2.1)
|
|
12
|
-
Requires-Dist: category-encoders (>=2.8.1)
|
|
13
|
-
Requires-Dist: celery (>=5.5.1)
|
|
14
|
-
Requires-Dist: curl-cffi (>=0.11.1)
|
|
15
|
-
Requires-Dist: deep-translator (>=1.11.4)
|
|
16
|
-
Requires-Dist: degiro-connector (>=3.0.26)
|
|
17
|
-
Requires-Dist: fake-useragent (>=2.1.0)
|
|
18
|
-
Requires-Dist: ftfy (>=6.3.1)
|
|
19
|
-
Requires-Dist: honeybadger (>=0.21)
|
|
20
|
-
Requires-Dist: joblib (>=1.4.2)
|
|
21
|
-
Requires-Dist: keras (>=3.9.0)
|
|
22
|
-
Requires-Dist: keras-tcn (>=3.1.2)
|
|
23
|
-
Requires-Dist: lightgbm (>=4.6.0)
|
|
24
|
-
Requires-Dist: matplotlib (>=3.10.1)
|
|
25
|
-
Requires-Dist: mlxtend (>=0.23.4)
|
|
26
|
-
Requires-Dist: numpy (>=2.1.3)
|
|
27
|
-
Requires-Dist: openai (>=1.86.0)
|
|
28
|
-
Requires-Dist: pandas (>=2.2.3)
|
|
29
|
-
Requires-Dist: pandas-market-calendars (>=4.6.1)
|
|
30
|
-
Requires-Dist: playwright (>=1.52.0)
|
|
31
|
-
Requires-Dist: pydantic (>=2.10.6)
|
|
32
|
-
Requires-Dist: python-dotenv (>=1.0.1)
|
|
33
|
-
Requires-Dist: pytz (>=2025.1)
|
|
34
|
-
Requires-Dist: ratelimit (>=2.2.1)
|
|
35
|
-
Requires-Dist: scikit-learn (>=1.6.1)
|
|
36
|
-
Requires-Dist: scipy (>=1.15.2)
|
|
37
|
-
Requires-Dist: seaborn (>=0.13.2)
|
|
38
|
-
Requires-Dist: sentence-transformers (>=3.4.1)
|
|
39
|
-
Requires-Dist: sqlalchemy (>=2.0.39)
|
|
40
|
-
Requires-Dist: tensorboardx (>=2.6.2.2)
|
|
41
|
-
Requires-Dist: tensorflow (>=2.19.0)
|
|
42
|
-
Requires-Dist: tf-keras (>=2.19.0)
|
|
43
|
-
Requires-Dist: tiktoken (>=0.9.0)
|
|
44
|
-
Requires-Dist: tqdm (>=4.67.1)
|
|
45
|
-
Requires-Dist: xgboost (>=3.0.0)
|
|
46
|
-
Requires-Dist: yahoo-fin (>=0.8.9.1)
|
|
47
|
-
Requires-Dist: yfinance (>=0.2.55)
|
|
48
|
-
Description-Content-Type: text/markdown
|
|
49
|
-
|
|
50
|
-
<div align="center">
|
|
51
|
-
|
|
52
|
-
<img src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/frog-face.png" width=120 alt="crapaud"/>
|
|
53
|
-
|
|
54
|
-
## Welcome to LeCrapaud
|
|
55
|
-
|
|
56
|
-
**An all-in-one machine learning framework**
|
|
57
|
-
|
|
58
|
-
[](https://github.com/pierregallet/lecrapaud/stargazers)
|
|
59
|
-
[](https://badge.fury.io/py/lecrapaud)
|
|
60
|
-
[](https://pypi.org/project/lecrapaud)
|
|
61
|
-
[](https://github.com/pierregallet/lecrapaud/blob/main/LICENSE)
|
|
62
|
-
[](https://codecov.io/gh/pierregallet/lecrapaud)
|
|
63
|
-
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
## 🚀 Introduction
|
|
67
|
-
|
|
68
|
-
LeCrapaud is a high-level Python library for end-to-end machine learning workflows on tabular data, with a focus on financial and stock datasets. It provides a simple API to handle feature engineering, model selection, training, and prediction, all in a reproducible and modular way.
|
|
69
|
-
|
|
70
|
-
## ✨ Key Features
|
|
71
|
-
|
|
72
|
-
- 🧩 Modular pipeline: Feature engineering, preprocessing, selection, and modeling as independent steps
|
|
73
|
-
- 🤖 Automated model selection and hyperparameter optimization
|
|
74
|
-
- 📊 Easy integration with pandas DataFrames
|
|
75
|
-
- 🔬 Supports both regression and classification tasks
|
|
76
|
-
- 🛠️ Simple API for both full pipeline and step-by-step usage
|
|
77
|
-
- 📦 Ready for production and research workflows
|
|
78
|
-
|
|
79
|
-
## ⚡ Quick Start
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Install the package
|
|
83
|
-
|
|
84
|
-
```sh
|
|
85
|
-
pip install lecrapaud
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### How it works
|
|
89
|
-
|
|
90
|
-
This package provides a high-level API to manage experiments for feature engineering, model selection, and prediction on tabular data (e.g. stock data).
|
|
91
|
-
|
|
92
|
-
### Typical workflow
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
from lecrapaud import LeCrapaud
|
|
96
|
-
|
|
97
|
-
# 1. Create the main app
|
|
98
|
-
app = LeCrapaud()
|
|
99
|
-
|
|
100
|
-
# 2. Define your experiment context (see your notebook or api.py for all options)
|
|
101
|
-
context = {
|
|
102
|
-
"data": your_dataframe,
|
|
103
|
-
"columns_drop": [...],
|
|
104
|
-
"columns_date": [...],
|
|
105
|
-
# ... other config options
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
# 3. Create an experiment
|
|
109
|
-
experiment = app.create_experiment(**context)
|
|
110
|
-
|
|
111
|
-
# 4. Run the full training pipeline
|
|
112
|
-
experiment.train(your_dataframe)
|
|
113
|
-
|
|
114
|
-
# 5. Make predictions on new data
|
|
115
|
-
predictions = experiment.predict(new_data)
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Modular usage
|
|
119
|
-
|
|
120
|
-
You can also use each step independently:
|
|
121
|
-
|
|
122
|
-
```python
|
|
123
|
-
data_eng = experiment.feature_engineering(data)
|
|
124
|
-
train, val, test = experiment.preprocess_feature(data_eng)
|
|
125
|
-
features = experiment.feature_selection(train)
|
|
126
|
-
std_data, reshaped_data = experiment.preprocess_model(train, val, test)
|
|
127
|
-
experiment.model_selection(std_data, reshaped_data)
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## 🤝 Contributing
|
|
131
|
-
|
|
132
|
-
### Reminders for Github usage
|
|
133
|
-
|
|
134
|
-
1. Creating Github repository
|
|
135
|
-
|
|
136
|
-
```sh
|
|
137
|
-
$ brew install gh
|
|
138
|
-
$ gh auth login
|
|
139
|
-
$ gh repo create
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
2. Initializing git and first commit to distant repository
|
|
143
|
-
|
|
144
|
-
```sh
|
|
145
|
-
$ git init
|
|
146
|
-
$ git add .
|
|
147
|
-
$ git commit -m 'first commit'
|
|
148
|
-
$ git remote add origin <YOUR_REPO_URL>
|
|
149
|
-
$ git push -u origin master
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
3. Use conventional commits
|
|
153
|
-
https://www.conventionalcommits.org/en/v1.0.0/#summary
|
|
154
|
-
|
|
155
|
-
4. Create environment
|
|
156
|
-
|
|
157
|
-
```sh
|
|
158
|
-
$ pip install virtualenv
|
|
159
|
-
$ python -m venv .venv
|
|
160
|
-
$ source .venv/bin/activate
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
5. Install dependencies
|
|
164
|
-
|
|
165
|
-
```sh
|
|
166
|
-
$ make install
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
6. Deactivate virtualenv (if needed)
|
|
170
|
-
|
|
171
|
-
```sh
|
|
172
|
-
$ deactivate
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
Pierre Gallet © 2025
|