Skip to content

Refactor timeseriesservice#75

Merged
BytecodeBrewer merged 14 commits into
developfrom
refactor-timeseriesservice
Jul 7, 2026
Merged

Refactor timeseriesservice#75
BytecodeBrewer merged 14 commits into
developfrom
refactor-timeseriesservice

Conversation

@BytecodeBrewer

@BytecodeBrewer BytecodeBrewer commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What changed?

  • seperated functionalies in time_series_service into two new services: market_data_service and trend_analysis_service
  • restructured the workflow between service layer and storage layer as well as service layer and client layer
  • edit the domain models and add a scheme for price bar instead of a model
  • implemented the first storage logic
  • trend_analysis_service calls analytics not vise versa
  • add and edit a lot of tests and improved the test qulity

Related issue

Closes #70

Tests

  • I ran pytest
  • Existing tests pass
  • I added or updated tests where necessary
  • Not needed because this only affects documentation or repository setup

Checklist

  • The change is focused
  • No secrets or API keys are included
  • Documentation was updated if needed
  • CI is expected to pass

Notes

  • I know that I made more than the tickets said but some things before were really messed up and weren't connected good enough. Though I had to fix the cascade of tests

@BytecodeBrewer BytecodeBrewer merged commit 404a669 into develop Jul 7, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 469c45833d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/argus/gui/app.py
import pandas as pd
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from argus.analytics.charts.trend_chart import create_trendchart
from argus.services.market_data_service import prepare_trend_analysis

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Import the trend service from the module that defines it

Launching the GUI now fails during import because market_data_service only defines get_market_data; the new prepare_trend_analysis function is defined in argus.services.trend_analysis_service. In any environment with the declared dependencies installed, importing argus.gui.app or argus.main raises ImportError before the app window can start.

Useful? React with 👍 / 👎.

return response.message

df = response.bars.copy()
df = add_daily_percentage_change(df)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Convert price bars before running trend metrics

When get_market_data succeeds, response.bars uses the new price-bar schema (timestamp/close), but the existing trend metric functions still index rate and later date. A normal successful trend request therefore raises KeyError: 'rate' here instead of returning a figure; this was masked because the added trend-analysis tests are inside a module-level string.

Useful? React with 👍 / 👎.

FOREIGN KEY (source_id) REFERENCES data_sources (id),
FOREIGN KEY (instrument_id) REFERENCES instruments (id),
UNIQUE (source_id, instrument_id, timestamp, timeframe)
UNIQUE (source_id, instrument_id, timestamp,close)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep timeframe in stored price-bar identity

The request model still carries timeframe, and get_market_data checks storage before calling yfinance, but the table no longer stores or keys by timeframe. After caching daily bars for an instrument/date range, a later hourly request for the same source/instrument/dates will be treated as a storage hit and return the daily rows instead of fetching hourly data.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant