karthickmj / yahoo_api

A python library to scrape Yahoo! Finance
0 stars 0 forks source link

Redex: Django webpage for fetching stock data #6

Open karthickmj opened 7 months ago

karthickmj commented 7 months ago

Develop a minimalistic web page that displays real-time financial data for a user-selected stock. The page will provide essential information like current stock price, market change, and basic financial highlights.

redex-ai-karthickmj[bot] commented 7 months ago

Redex Development Progress

0%

Guidelines

Don't edit this comment. This comment is managed by Redex for summary and status updates.

Step 1: Clarifications (PENDING)

Redex AI will come up with Clarification Questions related to this development task. Please answer the relevant questions. Avoid any other unrelevant question

Step 2: Change Plan (Revision 2) (Work in progress)

Redex is working on preparing the change plan. ETA: ~10 minutes, 13:14:06 PM UTC

Step 3: Pull Request (Revision 1)

Pull Request link: "https://github.com/karthickmj/yahoo_api/issues/6#issuecomment-1853843943"

Please review the pull request. In case if it needs any modifications, please drop a comment on the pull request directly. Then a new revision of the pull request will be generated

redex-ai-karthickmj[bot] commented 7 months ago

Based on the provided context, here are some clarifying questions that would help in accurately developing the requirement:

  1. API Integration: Since the existing code base is a Python library for scraping data from Yahoo Finance, do we have permission to use this library on the backend to serve data to the web page? If so, will there be any rate limits or API keys required for continuous data fetching?

  2. Real-time Data: The requirement mentions "real-time financial data." How real-time does the data need to be? Should it be updated every second, minute, or is there a different expected interval?

  3. User Interface: What are the specific design requirements for the web page? Are there any wireframes, color schemes, or branding guidelines to follow?

  4. User Interaction: How should the user select the stock they are interested in? Should there be a search bar, dropdown menu, or another method of input?

  5. Technology Stack: What is the preferred technology stack for the frontend development? Are there any frameworks or libraries (e.g., React, Angular, Vue) that are already being used or that we should use for this project?

  6. Hosting and Server: Where will the web page be hosted? Will there be a dedicated server for the backend, or should we consider serverless options like AWS Lambda or Google Cloud Functions?

  7. Data Persistence: Do we need to store any historical data on our servers, or will all data be fetched in real-time from Yahoo Finance without any caching or database storage?

  8. Error Handling: How should the system handle scenarios where Yahoo Finance is not available or the data for a particular stock is not retrievable?

  9. Security: Are there any security considerations we need to take into account, such as protecting API keys or handling user data?

  10. Financial Highlights: What specific "basic financial highlights" are required on the web page? Are there any preferences for which statistics or financials should be displayed prominently?

  11. Mobile Responsiveness: Should the web page be optimized for mobile devices, or is it intended primarily for desktop use?

  12. Accessibility: Are there any accessibility requirements for the web page, such as support for screen readers or compliance with WCAG guidelines?

  13. Legal Compliance: Are there any legal or compliance requirements we need to be aware of when displaying financial data, such as disclaimers or attribution to Yahoo Finance?

  14. Performance: Are there any performance benchmarks the web page must meet, such as load times or handling a certain number of users simultaneously?

  15. Localization: Will the web page need to support multiple languages or display financial data in different currencies?

These questions aim to clarify the scope and technical requirements of the project to ensure that the development aligns with the expectations and constraints of the existing code base and the project stakeholders.

If you just want to test us out without providing a lot of answers, Just comment DEFAULT and we will take the workflow forward with assumptions :smiley:

karthickmj commented 7 months ago

We prefer Django web framework. Setup all necessary django files from scratch. Don't want any real time data. Just use the methods from yahoo.py file. Refactor them if needed. Simple html page should be fine. Please have a dropdown menu to select the stock Not sure about yahoo_api rate limit For error handling, just display an alert with error message to the user No need to setup deployment. I will just run it locally. No need to worry about security. No need to do anything for caching. No need to do anything for accessibility and responsiveness.

redex-ai-karthickmj[bot] commented 7 months ago

Change Plan (Revision 1)

The plan involves creating a new Django model for stock ticker symbols, a form for stock selection, views to render the webpage and fetch stock data, URL patterns for page navigation, and a template with AJAX functionality for real-time data display.

1. File: yahoo_api/models.py

Define a new Django model 'Stock' with a CharField 'ticker_symbol' to store stock ticker symbols. Include a 'str' method to return the ticker symbol as its string representation.

2. File: yahoo_api/forms.py

Create a new Django form 'StockSelectionForm' with a ModelChoiceField to allow users to select a stock. Populate the choices using the 'Stock' model's objects. The form will have a single dropdown menu populated with stock ticker symbols.

3. File: yahoo_api/views.py

Implement a new view 'StockDataView' that renders the 'stock_data.html' template with the 'StockSelectionForm'. Add a view 'FetchStockData' that accepts a stock ticker symbol as a parameter, uses the 'ticker' class from yahoo.py to fetch data, and returns the data in JSON format.

4. File: yahoo_api/urls.py

Add a new URL pattern for the 'StockDataView' using the path 'stock-data/' and name 'stock_data'. Add another URL pattern for 'FetchStockData' using the path 'fetch-stock-data//' and name 'fetch_stock_data'.

5. File: yahoo_api/templates/stock_data.html

Create the HTML structure for the stock data page. Include the 'StockSelectionForm' and a script to handle form submission and fetch stock data using AJAX. Display the fetched data in a designated area on the page.

6. File: yahoo_api/static/css/styles.css

Write CSS rules for the stock data page layout, form, and data display area to ensure a user-friendly interface.

Next steps :

The development team should lint the code using tools like flake8, run unit tests for the new views and form, and perform manual testing to ensure the webpage functions correctly. No deployment steps are needed as the application will be run locally.

We are working on generating a pull request for the change plan. Meanwhile please review the change plan. In case if it needs any modifications, please drop a comment on the issue directly. Then a new revision of change plan and corresponding pull request will be generated

redex-ai-karthickmj[bot] commented 7 months ago

Pull Request (1): Implement Django Webpage for Stock Data Display: https://github.com/karthickmj/yahoo_api/pull/7

karthickmj commented 7 months ago

Can you please implement manage.py and other necessary django files that are not present?