Skip to content

Commit

Permalink
Revert "Drop NSE Endpoint Support and Migrate to Screener.in for Data…
Browse files Browse the repository at this point in the history
… Toolkit"
  • Loading branch information
devfinwiz authored Dec 28, 2024
1 parent 8796ae5 commit dab4a56
Show file tree
Hide file tree
Showing 14 changed files with 4,134 additions and 1,009 deletions.
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
FROM python:3.9-slim

RUN apt-get update && apt-get install -y redis-server && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY redis.conf /etc/redis/redis.conf
COPY entrypoint.sh /usr/local/bin/
COPY shutdown.sh /usr/local/bin/

VOLUME /redis-cache

WORKDIR /app

COPY pyproject.toml poetry.lock /app/

RUN pip install --no-cache-dir poetry && \
poetry config virtualenvs.create false && \
poetry install --only main
poetry install --no-dev

COPY . .

EXPOSE 8000
EXPOSE 6379

ENV REDIS_HOST=localhost
ENV REDIS_PORT=6379

WORKDIR /app/fin_maestro_kin

CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/shutdown.sh

RUN touch /var/log/redis/redis-server.log && chown redis:redis /var/log/redis/redis-server.log

ENTRYPOINT ["bash", "/usr/local/bin/entrypoint.sh"]
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
cd /app/fin_maestro_kin
redis-server /etc/redis/redis.conf
poetry run uvicorn main:app --host 0.0.0.0 --port 8000
bash /usr/local/bin/shutdown.sh
24 changes: 22 additions & 2 deletions fin_maestro_kin/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
ENDPOINTS = [
'/equities/security-archives?symbol=TCS&start_date=04-01-2024&end_date=07-01-2024&series=ALL',
'/equities/bulk-deals-archives?start_date=28-01-2024&end_date=01-02-2024',
'/equities/block-deals-archives?start_date=28-01-2024&end_date=01-02-2024',
'/equities/short-selling-archives?start_date=28-01-2024&end_date=01-02-2024',
'/equities/corporate-actions?start_date=28-01-2024&end_date=01-02-2024',
'/equities/most-active-securities',
'/equities/advances-declines?year=2024',
'/equities/monthly-settlement-stats/capital-market?financial_year=2022-2023',
'/equities/monthly-settlement-stats/fno?financial_year=2022-2023',
'/equities/stock-pcr?symbol=RELIANCE',
'/equities/equity-tickers',
'/equities/annual-reports?symbol=BAJAJCON',
'/equities/shareholding-patterns?symbol=BAJAJCON',
'/equities/insider-trading?start_date=28-01-2024&end_date=01-02-2024',
'/equities/board-meetings?start_date=28-01-2024&end_date=01-02-2024',
'/nseindices/history?symbol=NIFTY 50&start_date=10-01-2024&end_date=12-01-2024',
'/nseindices/ratios?symbol=NIFTY 50&start_date=10-Jan-2024&end_date=12-Jan-2024',
'/nseindices/returns?symbol=NIFTY 50&start_date=10-Jan-2024&end_date=12-Jan-2024',
'/nseindices/indice-pcr?symbol=NIFTY',
'/nseindices/india-vix?start_date=28-01-2024&end_date=01-02-2024',
'/nseindices/index-symbols',
'/sentiment/pcr-indice-analysis',
'/sentiment/pcr-stocks-analysis?symbol=INFY',
'/generate_plot?ticker=BSE.NS',
Expand All @@ -7,6 +28,5 @@
'/screener-equities/cash-flow?symbol=vedl',
'/screener-equities/balance-sheet?symbol=vedl',
'/screener-equities/annual-profit-loss?symbol=vedl',
'/screener-equities/ratios?symbol=vedl',
'/screener-equities/key-metrics?symbol=vedl'
'/screener-equities/ratios?symbol=vedl'
]
7 changes: 7 additions & 0 deletions fin_maestro_kin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from starlette.responses import RedirectResponse
from modules.sentiment_analysis.sentiment_analysis import SentimentAnalyzer
from modules.trend_detector.trend_detector import TrendDetector
from modules.data_toolkit.nse.nse_operations import NSEIndices, NSEEquities
from modules.data_toolkit.screener.screener_equities import ScreenerEquities

app = FastAPI()
Expand All @@ -17,6 +18,12 @@ async def apidog_docs_redirect(request: Request, call_next):
screener_eq = ScreenerEquities()
screener_eq.register_routes(app)

nse_eq = NSEEquities()
nse_eq.register_routes(app)

nse_indices = NSEIndices()
nse_indices.register_routes(app)

sentiment = SentimentAnalyzer()
sentiment.register_routes(app)

Expand Down
1 change: 1 addition & 0 deletions fin_maestro_kin/modules/data_toolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .nse import *
Empty file.
Loading

0 comments on commit dab4a56

Please sign in to comment.