Add Binance demo trading key settings and signed demo client
Store demo API key/secret encrypted in a single-row trading_account table, expose get/put/delete/test endpoints under /api/settings/exchange, and add a settings card to enter and test the key. The client is hard-wired to demo-fapi.binance.com.
This commit is contained in:
1 parent
438d6a00d9
commit
20fd5a98b2
8 files changed
+384
-5
No files matched your search
@@ -0,0 +1,41 @@
|
||||
"""trading account
|
||||
|
||||
Revision ID: a7d3e9c41f02
|
||||
Revises: 5c2e8f1a7b3d
|
||||
Create Date: 2026-10-15 10:00:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a7d3e9c41f02'
|
||||
down_revision: Union[str, Sequence[str], None] = '5c2e8f1a7b3d'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
op.create_table('trading_account',
|
||||
sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('api_key_encrypted', sa.LargeBinary(), nullable=True),
|
||||
sa.Column('api_secret_encrypted', sa.LargeBinary(), nullable=True),
|
||||
sa.Column('api_key_hint', sa.String(length=8), nullable=True),
|
||||
sa.Column('running', sa.Boolean(), nullable=False),
|
||||
sa.Column('running_changed_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('provider_id', sa.Integer(), nullable=True),
|
||||
sa.Column('reasoning_effort', sa.String(length=8), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.CheckConstraint('id = 1', name='trading_account_single_row'),
|
||||
sa.ForeignKeyConstraint(['provider_id'], ['ai_providers.id'], ondelete='SET NULL'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
op.drop_table('trading_account')
|
||||
Reference in new issue
Block a user