karthickmj / yahoo_api

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

Redex: Django webpage for fetching stock data #8

Open karthickmj opened 8 months ago

karthickmj commented 8 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 8 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, 17:11:40 PM UTC

Step 3: Pull Request (Revision 1)

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

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 8 months ago

Given the context of the existing codebase, here are some clarifying questions that would help in accurately developing the requirement:

  1. Web Framework: Which web framework is currently being used in the codebase, if any (e.g., Flask, Django, FastAPI)? Or is the expectation to create a new web page from scratch without a specific framework?

  2. Real-time Data: The requirement mentions "real-time financial data." Does the existing Python library support real-time data retrieval, or is there a need to implement a polling mechanism or use websockets to periodically update the data on the web page?

  3. Frontend Technologies: Are there any preferred frontend technologies or libraries (e.g., React, Angular, Vue.js) for developing the web page, or should I use plain HTML/CSS/JavaScript?

  4. User Interface: What level of user interface design is expected? Should the web page have a particular look and feel, or is a basic functional interface sufficient?

  5. Stock Selection: How should the user select a stock? Should there be a search bar, dropdown menu, or another method of input?

  6. Data Display: Are there specific requirements for how the data should be displayed on the web page (e.g., tables, charts, etc.)?

  7. Error Handling: How should the web page handle errors or unavailable data when retrieving financial data from Yahoo Finance?

  8. API Rate Limits: Is there a need to handle API rate limits or caching to avoid hitting Yahoo Finance's data retrieval limits?

  9. Deployment Considerations: While deployment details are not to be discussed, are there any server-side considerations that need to be taken into account for the web page to interface with the existing Python library?

  10. Security: Are there any security considerations, such as protecting against XSS or CSRF attacks, that need to be addressed in the web page?

  11. Browser Compatibility: Are there any specific browser compatibility requirements for the web page?

  12. Mobile Responsiveness: Does the web page need to be mobile-responsive?

  13. Accessibility: Are there any accessibility requirements for the web page (e.g., ARIA attributes, keyboard navigation)?

  14. User Authentication: Is user authentication required to access the web page, or is it publicly accessible?

  15. Configuration: Are there any configuration settings or environment variables that need to be set up for the web page to function correctly?

  16. Documentation: Should the new code be documented, and if so, is there a preferred format or template to follow?

These questions aim to clarify the scope and technical requirements for integrating the new web page with the existing Python library and ensure that the end product meets the expectations.

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 8 months ago

We prefer Django web framework. Add all necessary django files. 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 8 months ago

Change Plan (Revision 1)

The change plan includes the creation of a new Django model, form, view, URL pattern, and template to display stock data on a web page. It also updates the README.md file with instructions for the new feature.

1. File: yahoo_api/models.py

Define a new Django model 'Stock' with the following fields: 'ticker_symbol' (CharField, max_length=10) to store the stock symbol, and 'last_updated' (DateTimeField, auto_now=True) to store the timestamp of the last data retrieval. Ensure the 'ticker_symbol' field is unique.

2. File: yahoo_api/forms.py

Create a new Django form class 'StockSelectionForm' with a single field 'ticker' (ModelChoiceField) that queries 'Stock' model objects to populate the dropdown menu. The form will be used to select a stock ticker symbol for data retrieval.

3. File: yahoo_api/views.py

Implement a new Django class-based view 'StockDataView' that handles GET and POST requests. On GET, display 'StockSelectionForm'. On POST, validate the form, use the 'ticker' class from 'yahoo.py' to fetch data for the selected ticker symbol, and pass the data to the template context.

4. File: yahoo_api/urls.py

Add a new URL pattern that maps the path '/stock-data/' to the 'StockDataView' class. This URL will be used to access the stock data web page.

5. File: yahoo_api/templates/stock_data.html

Create an HTML template that extends a base layout. Include the 'StockSelectionForm' and a section to display stock data such as current price, market change, and financial highlights. Use template tags to dynamically render the data passed from the view.

6. File: README.md

Append a new section to the README.md file that describes the new web page feature. Include instructions on how to run the Django server, access the stock data page, and select a stock ticker to view its data.

Next steps :

The development team should lint the code using 'flake8', run unit tests with 'python manage.py test', and perform manual testing to ensure the web page functions correctly. No migrations are needed for deployment since 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 8 months ago

Pull Request (Revision 1)

Implement Django Web Page for Displaying Stock Data: https://github.com/karthickmj/yahoo_api/pull/9

karthickmj commented 8 months ago

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