Benjamin Consolvo commited on
Commit
13d43cd
·
1 Parent(s): f3d0040

readme updates with prompt

Browse files
Files changed (1) hide show
  1. README.md +40 -14
README.md CHANGED
@@ -16,6 +16,7 @@ short_description: 'Stock trading application'
16
  ## Overview
17
  Stock Trader is an interactive web application built with Streamlit that allows you to monitor stock market data, execute trades using a paper trading account through Alpaca, analyze market sentiment, and visualize stock performance. The application combines real-time market data, news sentiment analysis, and automated trading capabilities in an easy-to-use interface.
18
 
 
19
  ## Features
20
  - **Real-time Stock Data**: Track current prices and market status
21
  - **Manual Trading**: Buy and sell stocks with customizable quantities
@@ -24,6 +25,29 @@ Stock Trader is an interactive web application built with Streamlit that allows
24
  - **Portfolio Visualization**: View your holdings and portfolio value in real-time
25
  - **Market Insights**: Monitor top volume stocks with interactive charts
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ## Installation
28
 
29
  ### Prerequisites
@@ -38,24 +62,24 @@ Stock Trader is an interactive web application built with Streamlit that allows
38
  1. Clone the repository
39
 
40
  ```sh
41
- git clone https://github.com/opea-project/Enterprise-Inference/
42
- cd examples/stocktrader
43
  ```
44
 
45
  2. Initialize the virtual environment
46
- ```bash
47
- uv init
48
- ```
49
 
50
  3. Install dependencies
51
- ```bash
52
- uv add -r requirements.txt
53
- ```
54
 
55
  4. Activate the virtual environment
56
- ```bash
57
- source .venv/bin/activate
58
- ```
59
 
60
  5. Configure your API keys in `.streamlit/secrets.toml`. For this application, you will need:
61
  - **Alpaca Trading API**: Sign up at [Alpaca](https://alpaca.markets/) to get your API key and secret key. This app uses paper trading, so make sure to get paper trading credentials.
@@ -73,10 +97,12 @@ NEWS_API_KEY = "your_news_api_key"
73
  ALPHA_VANTAGE_API_KEY = "your_alpha_vantage_api_key"
74
  ```
75
 
 
 
76
  6. Launch the application
77
- ```bash
78
- streamlit run app.py
79
- ```
80
 
81
  ## Using the Application
82
 
 
16
  ## Overview
17
  Stock Trader is an interactive web application built with Streamlit that allows you to monitor stock market data, execute trades using a paper trading account through Alpaca, analyze market sentiment, and visualize stock performance. The application combines real-time market data, news sentiment analysis, and automated trading capabilities in an easy-to-use interface.
18
 
19
+
20
  ## Features
21
  - **Real-time Stock Data**: Track current prices and market status
22
  - **Manual Trading**: Buy and sell stocks with customizable quantities
 
25
  - **Portfolio Visualization**: View your holdings and portfolio value in real-time
26
  - **Market Insights**: Monitor top volume stocks with interactive charts
27
 
28
+ ## Prompt
29
+ I used a DeepSeek distilled Llama model with the following chat application to build the initial codebase: https://huggingface.co/spaces/Intel/intel-ai-enterprise-inference.
30
+ Here is the prompt I wrote:
31
+
32
+ ```text
33
+ You are an expert Python software engineer and financial technology developer. Generate a fully functional Python stock trading application that uses the `yfinance` and `alpaca` packages to fetch stock data and automatically buys and sells stocks (a day-trader) based on sentiment analysis of news headlines. The app should:
34
+
35
+ 1. Fetch historical stock data for the top 10 stocks, by volume traded.
36
+ 2. Fetch the top news headlines for these top 10 stocks and then rate them as “Negative, Neutral, or Positive” from a sentiment analysis model. If negative, sell the stock. If neutral, hold it. If positive, buy the stock. You will have to make sure that we first have a position in the stock before selling it!
37
+ 3. Keep track of when the stock trading day is open or closed to make sure that trades are only being executed while the trading day is open.
38
+ 4. Continuously check for updated news and stock prices throughout the trading day.
39
+ 5. Display key indicators like moving averages and price charts.
40
+ 6. In addition to automatically buying and selling stocks based on news sentiment, allow the user to buy or sell stocks manually.
41
+ 7. Maintain a portfolio state (cash balance, current holdings, transaction history).
42
+ 8. Log transactions and update the portfolio after each command.
43
+ 9. Be modular, clean, and readable. Put all of the code in one block, but split into classes and functions as necessary.
44
+ 10. Create a simple web UI for the program. I prefer streamlit.
45
+ 11. Include comments, a short README describing how to run the app, and a requirements.txt file for what packages are required.
46
+ 12. Use only free frameworks and APIs. Don’t use any paid ones.
47
+
48
+
49
+ ```
50
+
51
  ## Installation
52
 
53
  ### Prerequisites
 
62
  1. Clone the repository
63
 
64
  ```sh
65
+ git clone https://huggingface.co/spaces/Intel/stocktrader
66
+ cd stocktrader
67
  ```
68
 
69
  2. Initialize the virtual environment
70
+ ```bash
71
+ uv init
72
+ ```
73
 
74
  3. Install dependencies
75
+ ```bash
76
+ uv add -r requirements.txt
77
+ ```
78
 
79
  4. Activate the virtual environment
80
+ ```bash
81
+ source .venv/bin/activate
82
+ ```
83
 
84
  5. Configure your API keys in `.streamlit/secrets.toml`. For this application, you will need:
85
  - **Alpaca Trading API**: Sign up at [Alpaca](https://alpaca.markets/) to get your API key and secret key. This app uses paper trading, so make sure to get paper trading credentials.
 
97
  ALPHA_VANTAGE_API_KEY = "your_alpha_vantage_api_key"
98
  ```
99
 
100
+ Or you can add your secrets directly to the Hugging Face Space Settings if you are deploying the application on Hugging Face.
101
+
102
  6. Launch the application
103
+ ```bash
104
+ streamlit run app.py
105
+ ```
106
 
107
  ## Using the Application
108