karthickmj / yahoo_api

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

Redex: Django webpage to fetch stock data #10

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)

"https://github.com/karthickmj/yahoo_api/issues/10#issuecomment-1854509054"

Change Plan (Revision 1) "https://github.com/karthickmj/yahoo_api/issues/10#issuecomment-1854491085"

Step 3: Pull Request (IN_PROGRESS)

Redex AI is generating the pull request. We have generated 3 out of 10 files. ETA: ~35, 19:17:49 PM UTC

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

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

  1. API Integration: Does the existing yahoo_api library have any rate limits or authentication requirements that we need to be aware of when making real-time requests to Yahoo Finance?

  2. Real-time Data: The requirement mentions "real-time financial data." How real-time does the data need to be? Is there a specific refresh interval (e.g., every second, every minute) expected for the stock price and market change?

  3. User Interface: Are there any specific design guidelines or frameworks (e.g., React, Angular, Vue) that should be used for the web page, or is the choice of technology up to the developer?

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

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

  6. Error Handling: How should the web page handle situations where the Yahoo Finance API is not available or the requested stock ticker symbol does not exist?

  7. Backend Integration: Should the web page communicate directly with Yahoo Finance, or should it go through a backend server that uses the yahoo_api library? If a backend is required, what are the preferred technologies and frameworks?

  8. Data Persistence: Is there a need to store any of the financial data on the server side for caching or historical purposes, or should all data be fetched live without any persistence layer?

  9. Mobile Responsiveness: Does the web page need to be mobile-responsive, and are there any specific requirements for how it should look or behave on mobile devices?

  10. Accessibility: Are there any accessibility requirements (e.g., screen reader compatibility, keyboard navigation) for the web page?

  11. Deployment: While deployment details are not to be discussed, should the code be structured in a way that is ready for containerization or serverless deployment?

  12. Testing: Even though testing details are not to be discussed, should the code include unit tests or integration tests for the new functionality?

  13. Documentation: Should the new web page functionality be documented within the existing README.md, or should a separate documentation file be created?

  14. Code Structure: Is there a preferred code structure or any coding standards that should be followed when integrating the new web page into the existing codebase?

  15. Third-Party Libraries: Are there any restrictions on using third-party libraries for the frontend development, or can any necessary libraries be included?

Answering these questions will help ensure that the development of the new web page aligns with the project's requirements and constraints.

If you just want to test us out without providing clarifying answers, please 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 involves refactoring the 'yahoo.py' script to provide a consolidated data retrieval method, creating a new form and view in Django to handle stock data requests, and adding a new template to display the stock data. A new URL pattern will also be added to route requests to the new view.

1. File: yahoo.py

Refactor the 'ticker' class to include a new method 'get_stock_data' which will encapsulate the functionality of 'summary' and 'statistics' methods. This new method will return a dictionary with keys 'Summary' and 'Statistics' containing the respective data. This change will allow for a single method call to retrieve all necessary data for the Django view.

Please note that this file size is beyond our generation capacity.. We are recommending the change but will not able to generate the changes in this file

2. File: models.py

No changes needed as the stock data will not be persisted in the database.

3. File: forms.py

Create a new Django form 'StockSelectForm' with a single ChoiceField named 'ticker_symbol'. The choices for this field will be dynamically populated in the view from a predefined list of stock ticker symbols.

4. File: views.py

Add a new Django view 'StockDataView' that renders the 'StockSelectForm' and handles form submissions. Upon form submission, the view will call the 'get_stock_data' method from the 'ticker' class and pass the returned data to the context of the 'stock_data.html' template.

5. File: urls.py

Add a new URL pattern that maps the path 'stock-data/' to the 'StockDataView'.

6. File: templates/stock_data.html

Create a new HTML template that includes the 'StockSelectForm' and displays the stock data retrieved from the 'get_stock_data' method. The template will show an alert with an error message if the data retrieval fails.

Next steps :

After implementing the changes, developers should lint the code using 'flake8' or a similar tool, run any existing tests to ensure no regressions have occurred, and perform manual testing to validate the new functionality. Developers should also update the 'README.md' file to include instructions on how to use the new webpage feature.

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 Webpage for Displaying Stock Data: https://github.com/karthickmj/yahoo_api/pull/11

karthickmj commented 8 months ago

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

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

Change Plan (Revision 2)

The change plan includes creating a new method in the 'yahoo.py' script, setting up Django project files, creating a new form, view, URL pattern, and template for displaying stock data.

1. File: yahoo.py

Add a new method 'get_stock_data' to the 'ticker' class. This method will call 'summary' and 'statistics' methods and return a combined dictionary with keys 'Summary' and 'Statistics'.

Input: None Output: dict {'Summary': {summary_data}, 'Statistics': {statistics_data}}

Please note that this file size is beyond our generation capacity.. We are recommending the change but will not able to generate the changes in this file

2. File: views.py

Create a new view 'stock_data_view' that uses the 'StockSelectForm' to get the user-selected stock ticker, calls the 'get_stock_data' method from the 'ticker' class, and passes the data to the 'stock_data.html' template.

Contract: URL path '/stock-data/', method 'GET' for form display and 'POST' for form submission.

3. File: forms.py

Create a new form 'StockSelectForm' with a ChoiceField 'ticker_symbol' to select a stock ticker. Populate the choices dynamically in the view.

Contract: The form will be used in 'stock_data_view' to capture user input.

4. File: urls.py

Add a new URL pattern for the stock data view. Map the path 'stock-data/' to the 'stock_data_view'.

Contract: New URL path '/stock-data/' for accessing the stock data view. Create a new 'urls.py' file in the project directory to define the URL configuration for the Django project.

Contract: This file will include the URL patterns for the application, including the new stock data view. Create a new 'urls.py' file in the project directory to define the URL configuration for the Django project.

Contract: This file will include the URL patterns for the application, including the new stock data view.

5. File: templates/stock_data.html

Create a new HTML template 'stock_data.html' to display the stock data form and the retrieved stock data. Include error handling for failed data retrieval.

Contract: The template will receive a context variable 'stock_data' containing the data to display.

6. File: manage.py

Create a new 'manage.py' file for the Django project to handle administrative tasks.

Contract: This file will be the entry point for running commands like 'runserver', 'makemigrations', 'migrate', etc.

7. File: settings.py

Set up a new 'settings.py' file with the necessary Django settings, including installed apps, middleware, templates, and database configurations.

Contract: This file will configure the Django project settings.

8. File: wsgi.py

Create a new 'wsgi.py' file to configure the WSGI application for the Django project.

Contract: This file will be used for deploying the application to a WSGI server.

9. File: asgi.py

Create a new 'asgi.py' file to configure the ASGI application for the Django project.

Contract: This file will be used for deploying the application to an ASGI server like Daphne or Uvicorn.

10. File: urls.py

Create a new 'urls.py' file in the project directory to define the URL configuration for the Django project.

Contract: This file will include the URL patterns for the application, including the new stock data view.

Next steps :

After implementing the changes, developers should lint the code using tools like 'flake8', run tests with 'python manage.py test', manually test the new webpage functionality, and update the 'README.md' with the new feature instructions. To deploy, use 'python manage.py runserver' for local development or configure a WSGI/ASGI server for production.

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