1b8ba0ef9c
Task 6.7: porting alpaca da services/mcp-alpaca a src/cerbero_mcp. client.py + leverage_cap.py copiati 1:1 (default cap 1 cash). tools.py: 17 tool senza ACL/Principal/audit. Router /mcp-alpaca con 18 route (env_info + 17 tool). Builder branch alpaca: paper=(env=="testnet"), api_key viene da settings.alpaca.api_key_id. Test client + leverage_cap migrati (15 test alpaca pass). Test builder con stub SDK alpaca-py. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
856 B
Python
40 lines
856 B
Python
from __future__ import annotations
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
import pytest
|
|
from cerbero_mcp.exchanges.alpaca.client import AlpacaClient
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_trading():
|
|
return MagicMock(name="alpaca_TradingClient")
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_stock():
|
|
return MagicMock(name="alpaca_StockHistoricalDataClient")
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_crypto():
|
|
return MagicMock(name="alpaca_CryptoHistoricalDataClient")
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_option():
|
|
return MagicMock(name="alpaca_OptionHistoricalDataClient")
|
|
|
|
|
|
@pytest.fixture
|
|
def client(mock_trading, mock_stock, mock_crypto, mock_option):
|
|
return AlpacaClient(
|
|
api_key="test_key",
|
|
secret_key="test_secret",
|
|
paper=True,
|
|
trading=mock_trading,
|
|
stock_data=mock_stock,
|
|
crypto_data=mock_crypto,
|
|
option_data=mock_option,
|
|
)
|