Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sidhyaashu/building_stock_analysis_cli

Building Stock Analysis CLI
https://github.com/sidhyaashu/building_stock_analysis_cli

Last synced: 12 days ago
JSON representation

Building Stock Analysis CLI

Awesome Lists containing this project

README

        

Here’s a README.md file that you can use for your GitHub repository. This README explains the functionality of your Go-based stock selection and news fetching tool.

```markdown
# Stock Selection and News Fetcher

This project is a Go-based tool designed for selecting stocks based on a gap percentage, calculating potential profits from stock price movements, and fetching relevant news articles about selected stocks from Seeking Alpha. The tool outputs a list of selected stocks along with their positions and associated news articles in JSON format.

## Features

- **Stock Selection:**
- Loads stock data from a CSV file.
- Filters stocks based on their gap percentage.
- Calculates entry price, stop loss, take profit, and potential profit for each selected stock.

- **News Fetching:**
- Fetches relevant articles from Seeking Alpha API for each selected stock ticker.

- **JSON Output:**
- The results are saved in a JSON file, which includes stock tickers, calculated positions, and associated articles.

## Requirements

- Go (v1.16 or higher)
- Access to the Seeking Alpha API (via RapidAPI)

## Installation

### 1. Clone the repository

```bash
git clone https://github.com/your-username/stock-selection-news-fetcher.git
cd stock-selection-news-fetcher
```

### 2. Install dependencies

Ensure you have Go installed. The code requires no additional external dependencies other than the Go standard library.

### 3. API Key

To fetch articles from Seeking Alpha, you'll need a RapidAPI key for their service. Obtain your API key and replace the placeholder in the `apiKey` constant in the `main.go` file.

```go
const apiKey = "your-rapidapi-key-here"
```

### 4. Prepare CSV File

Create or download a CSV file (e.g., `opg.csv`) with stock data. The CSV should have the following columns:

- `Ticker` (e.g., AAPL)
- `Gap Percentage` (e.g., 0.05 for 5%)
- `Opening Price` (e.g., 150.0)

### 5. Run the program

Once everything is set up, you can run the program using:

```bash
go run main.go
```

This will:

1. Load stock data from the `opg.csv` file.
2. Filter stocks based on the gap percentage.
3. Calculate potential positions for each stock.
4. Fetch relevant news articles from Seeking Alpha.
5. Save the results in a JSON file named `opg.json`.

## Example Output

The output JSON file (`opg.json`) will contain an array of stock selections, each including:

- `Ticker`: Stock ticker symbol (e.g., AAPL).
- `Position`: Calculated position details, including entry price, stop loss, take profit, and profit.
- `Articles`: List of articles with publishing date and headline.

### Example:

```json
[
{
"Ticker": "AAPL",
"Position": {
"EntryPrice": 150.00,
"Shares": 100,
"TakeProfitPrice": 160.00,
"StopLossPrice": 140.00,
"Profit": 1000.00
},
"Articles": [
{
"PublishOn": "2024-12-06T08:00:00Z",
"Headline": "Apple Stock Hits New High"
},
{
"PublishOn": "2024-12-05T09:00:00Z",
"Headline": "Apple Unveils New Product"
}
]
}
]
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Contributing

If you have any suggestions or improvements, feel free to open an issue or a pull request. Contributions are welcome!

## Acknowledgments

- **Seeking Alpha API** via [RapidAPI](https://rapidapi.com/).
- Go programming language and its powerful libraries.
```

Make sure to replace `your-username` and `your-rapidapi-key-here` with the actual username and API key when you upload this file to your GitHub repository.