Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 0 additions & 168 deletions .circleci/config.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint black
pip install -r requirements.txt

- name: Run Pylint
run: |
pylint --fail-on=W,E,F --exit-zero ./

- name: Run Black
run: |
black --line-length 79 --exclude '(env|venv|.eggs|.git)' --check .

# - name: Run unit tests
# run: python -m unittest discover tests
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,40 @@
Create Date: 2024-12-26 11:59:36.925991

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '09dc2532fe57'
down_revision: Union[str, None] = 'bc6d5957a826'
revision: str = "09dc2532fe57"
down_revision: Union[str, None] = "bc6d5957a826"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column('miner_predictions', sa.Column('asset', sa.String, nullable=True))
op.add_column('miner_predictions', sa.Column('time_increment', sa.Integer, nullable=True))
op.add_column('miner_predictions', sa.Column('time_length', sa.Integer, nullable=True))
op.add_column('miner_predictions', sa.Column('num_simulations', sa.Integer, nullable=True))
op.add_column(
"miner_predictions", sa.Column("asset", sa.String, nullable=True)
)
op.add_column(
"miner_predictions",
sa.Column("time_increment", sa.Integer, nullable=True),
)
op.add_column(
"miner_predictions",
sa.Column("time_length", sa.Integer, nullable=True),
)
op.add_column(
"miner_predictions",
sa.Column("num_simulations", sa.Integer, nullable=True),
)


def downgrade() -> None:
op.drop_column('miner_predictions', 'num_simulations')
op.drop_column('miner_predictions', 'time_length')
op.drop_column('miner_predictions', 'time_increment')
op.drop_column('miner_predictions', 'asset')
op.drop_column("miner_predictions", "num_simulations")
op.drop_column("miner_predictions", "time_length")
op.drop_column("miner_predictions", "time_increment")
op.drop_column("miner_predictions", "asset")
37 changes: 24 additions & 13 deletions alembic/versions/1154ae96bd0a_add_table_for_miner_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-12-08 15:49:07.612838

"""

from typing import Sequence, Union

from alembic import op
Expand All @@ -13,26 +14,36 @@


# revision identifiers, used by Alembic.
revision: str = '1154ae96bd0a'
down_revision: Union[str, None] = '9f5c6d18896d'
revision: str = "1154ae96bd0a"
down_revision: Union[str, None] = "9f5c6d18896d"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_table(
'miner_rewards',
sa.Column('id', sa.BigInteger, primary_key=True, nullable=False),
sa.Column('miner_uid', sa.Integer, nullable=False),
sa.Column('validation_time', sa.TIMESTAMP(timezone=True), nullable=False),
sa.Column('start_time', sa.TIMESTAMP(timezone=True), nullable=False),
sa.Column('reward_details', JSONB, nullable=False)
"miner_rewards",
sa.Column("id", sa.BigInteger, primary_key=True, nullable=False),
sa.Column("miner_uid", sa.Integer, nullable=False),
sa.Column(
"validation_time", sa.TIMESTAMP(timezone=True), nullable=False
),
sa.Column("start_time", sa.TIMESTAMP(timezone=True), nullable=False),
sa.Column("reward_details", JSONB, nullable=False),
)
op.create_index(
"ix_miner_rewards_validation_time",
"miner_rewards",
["validation_time"],
)
op.create_index(
"ix_miner_rewards_miner_uid", "miner_rewards", ["miner_uid"]
)
op.create_index('ix_miner_rewards_validation_time', 'miner_rewards', ['validation_time'])
op.create_index('ix_miner_rewards_miner_uid', 'miner_rewards', ['miner_uid'])


def downgrade() -> None:
op.drop_index('ix_miner_rewards_validation_time', table_name='miner_rewards')
op.drop_index('ix_miner_rewards_miner_uid', table_name='miner_rewards')
op.drop_table('miner_rewards')
op.drop_index(
"ix_miner_rewards_validation_time", table_name="miner_rewards"
)
op.drop_index("ix_miner_rewards_miner_uid", table_name="miner_rewards")
op.drop_table("miner_rewards")
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-12-08 16:21:37.857982

"""

from typing import Sequence, Union

from alembic import op
Expand All @@ -13,17 +14,21 @@


# revision identifiers, used by Alembic.
revision: str = '448fada07788'
down_revision: Union[str, None] = '1154ae96bd0a'
revision: str = "448fada07788"
down_revision: Union[str, None] = "1154ae96bd0a"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column('miner_rewards', sa.Column('reward', sa.Float, nullable=True))
op.add_column('miner_rewards', sa.Column('real_prices', JSON, nullable=True))
op.add_column(
"miner_rewards", sa.Column("reward", sa.Float, nullable=True)
)
op.add_column(
"miner_rewards", sa.Column("real_prices", JSON, nullable=True)
)


def downgrade() -> None:
op.drop_column('miner_rewards', 'real_prices')
op.drop_column('miner_rewards', 'reward')
op.drop_column("miner_rewards", "real_prices")
op.drop_column("miner_rewards", "reward")
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@
Create Date: 2024-12-08 17:57:30.782720

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '8b8ee3e62171'
down_revision: Union[str, None] = 'dba3765d2374'
revision: str = "8b8ee3e62171"
down_revision: Union[str, None] = "dba3765d2374"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.alter_column('miner_predictions', 'start_time', new_column_name='validation_time')
op.drop_index('ix_start_time', table_name='miner_predictions')
op.create_index('ix_validation_time', 'miner_predictions', ['validation_time'])
op.create_index('ix_miner_uid', 'miner_predictions', ['miner_uid'])
op.alter_column(
"miner_predictions", "start_time", new_column_name="validation_time"
)
op.drop_index("ix_start_time", table_name="miner_predictions")
op.create_index(
"ix_validation_time", "miner_predictions", ["validation_time"]
)
op.create_index("ix_miner_uid", "miner_predictions", ["miner_uid"])


def downgrade() -> None:
op.drop_index('ix_miner_uid', table_name='miner_predictions')
op.drop_index('ix_validation_time', table_name='miner_predictions')
op.alter_column('miner_predictions', 'validation_time', new_column_name='start_time')
op.create_index('ix_start_time', 'miner_predictions', ['start_time'])
op.drop_index("ix_miner_uid", table_name="miner_predictions")
op.drop_index("ix_validation_time", table_name="miner_predictions")
op.alter_column(
"miner_predictions", "validation_time", new_column_name="start_time"
)
op.create_index("ix_start_time", "miner_predictions", ["start_time"])
Loading
Loading