karthickmj / yahoo_api

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

Redex: Django webpage for fetching stock data #4

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, 12:11:27 PM UTC

Step 3: Pull Request (Revision 1)

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

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

To develop the requirement of a minimalistic web page that displays real-time financial data for a user-selected stock, I would need to clarify a few points regarding the existing codebase and the integration of the web page:

  1. Web Framework: Is there an existing web framework or technology stack (e.g., Flask, Django, React, Vue.js) that the web page should be integrated with, or am I free to choose one?

  2. Real-time Data: The yahoo.py script retrieves data from Yahoo Finance, but it doesn't mention real-time capabilities. Does the existing library support fetching real-time data, or should I implement a mechanism to periodically update the data on the web page?

  3. Frontend-Backend Communication: How should the web page communicate with the backend Python code? Should I set up an API endpoint using a framework like Flask or Django to serve the data to the frontend?

  4. User Interface Requirements: Are there any specific UI/UX design requirements or preferences for the web page, such as color schemes, fonts, or layout?

  5. User Input: How should the user input the stock ticker symbol on the web page? Should there be a search bar, dropdown menu, or another method?

  6. Error Handling: How should the web page handle errors, such as an invalid ticker symbol or a failure to retrieve data from Yahoo Finance?

  7. Data Refresh Rate: How often should the financial data be refreshed on the web page to ensure it is reasonably up-to-date?

  8. Deployment Considerations: While deployment details are not to be discussed, are there any constraints or preferences for how the web page should be built to facilitate future deployment?

  9. Security: Are there any security considerations I should be aware of when developing the web page, such as protecting API keys or handling user data?

  10. Dependencies: Are there any restrictions on adding new dependencies to the project, or can I add necessary libraries for web development and real-time data handling?

  11. Testing: Although not to be discussed in detail, should I set up any specific testing frameworks or follow certain testing conventions for the new web page functionality?

Clarifying these points will help ensure that the development of the web page aligns with the existing codebase and project requirements.

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

The change involves creating a new Django view and template to display stock data using the existing 'ticker' class from 'yahoo.py'. A new form is also added to capture user input for the stock ticker symbol.

1. File: yahoo_api/models.py

No changes needed as the 'ticker' class in 'yahoo.py' does not require a Django model for its functionality.

2. File: yahoo_api/views.py

Create a new Django view 'StockDataView' that uses the 'ticker' class from 'yahoo.py' to fetch and display stock data. The view should handle GET requests, extract the ticker symbol from the request, and use the 'summary' method of the 'ticker' class to get the stock data. The view should then pass this data to a template for rendering.

3. File: yahoo_api/urls.py

Add a new URL pattern that maps to the 'StockDataView'. The pattern should capture a stock ticker symbol as a URL parameter.

4. File: yahoo_api/templates/stock_data.html

Create a new template that will be used by 'StockDataView' to display the stock data. The template should include placeholders for the data provided by the 'summary' method of the 'ticker' class.

5. File: yahoo_api/forms.py

Create a new Django form 'StockTickerForm' with a CharField to input a stock ticker symbol. This form will be used to capture user input on the frontend.

6. File: yahoo_api/templates/index.html

Create a new template for the homepage that includes the 'StockTickerForm'. The form should submit to the URL mapped to 'StockDataView'.

7. File: yahoo_api/yahoo.py

Refactor the 'ticker' class to ensure it can be imported and used within a Django view. This includes handling exceptions and returning data in a format that can be easily rendered by a Django template.

Next steps :

After implementing the changes, the development team should lint the code using 'flake8', run unit tests using 'python manage.py test', and perform manual testing to ensure the web page works as expected. No database migrations are needed as no new models were created.

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

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

Pull Request: Implement Django Web Page for Stock Data Display: https://github.com/karthickmj/yahoo_api/pull/5