aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 84f97e7ddaef7b1aa6ecb0fac439da251374ec51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# S&P 500 Stock Screener

A simple Node.js application for screening stocks and uploading that data to a google spreadsheet, without any external dependencies.

## Setup

1. **Clone the repository:**
    ```bash
    git clone https://www.git.mfoi.dev/stock-screener.git/
    cd stock-screener
    ```

2. **Configure environment variables:**
    - Create a `.env` file in the root directory following the template.
    - Example `.env`:
      ```
      PORT=3000
      STOCK_SCREENER_AUTH_TOKEN=1234567
      ```

## Running the Server

First, [install Node.js](https://nodejs.org/en/download/) if you haven't already.

Start the server with:
```bash
node server.js
```

The server will run on the port specified in your `.env` file. 

## Usage

The server has two purposes:
1. Update the stock metrics to the spreadsheet weekly.
2. Provide a REST API for updating the spreadsheet on demand.
The only endpoint is `http://localhost:{env.PORT}/api/update-stock-screener?token=${env.STOCK_SCREENER_AUTH_TOKEN}`.

This is meant to be run in the background but still allows for manual triggering via the API. Obviously, you should secure this endpoint in a production environment.