Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 0 additions & 22 deletions .github/workflows/create_or_update_portfolio.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions applications/ensemble_manager/src/ensemble_manager/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@

logger = structlog.get_logger()

DATAMANAGER_BASE_URL = os.getenv(
"FUND_DATAMANAGER_BASE_URL", "http://data-manager:8080"
DATA_MANAGER_BASE_URL = os.getenv(
"FUND_DATA_MANAGER_BASE_URL", "http://data-manager:8080"
)
_environment = os.environ.get("FUND_ENVIRONMENT", "development")
MODEL_VERSION_SSM_PARAMETER = f"/fund/{_environment}/ensemble-manager/model-version"
Expand Down Expand Up @@ -265,7 +265,7 @@ def create_predictions(request: Request) -> Response:

try:
equity_bars_response = requests.get(
url=f"{DATAMANAGER_BASE_URL}/equity-bars",
url=f"{DATA_MANAGER_BASE_URL}/equity-bars",
params={
"start_timestamp": start_date.isoformat(),
"end_timestamp": end_date.isoformat(),
Expand All @@ -286,7 +286,7 @@ def create_predictions(request: Request) -> Response:

try:
equity_details_response = requests.get(
url=f"{DATAMANAGER_BASE_URL}/equity-details",
url=f"{DATA_MANAGER_BASE_URL}/equity-details",
timeout=60,
)

Expand Down Expand Up @@ -368,7 +368,7 @@ def create_predictions(request: Request) -> Response:

try:
save_predictions_response = requests.post(
url=f"{DATAMANAGER_BASE_URL}/predictions",
url=f"{DATA_MANAGER_BASE_URL}/predictions",
json={
"timestamp": current_timestamp.isoformat(),
"data": validated_predictions.to_dicts(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from alpaca.data import StockHistoricalDataClient
from alpaca.trading import (
Asset,
Clock,
ClosePositionRequest,
GetAssetsRequest,
OrderRequest,
Expand Down Expand Up @@ -58,6 +59,11 @@ def __init__(

self.is_paper = is_paper

def is_market_open(self) -> bool:
clock: Clock = cast("Clock", self.trading_client.get_clock())
time.sleep(self.rate_limit_sleep)
return bool(clock.is_open)

def get_account(self) -> AlpacaAccount:
account: TradeAccount = cast("TradeAccount", self.trading_client.get_account())

Expand Down
Loading
Loading