Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fjctp/polygon-fetcher
A report generator for stocks using Polygon.io REST APIs
https://github.com/fjctp/polygon-fetcher
golang server stock-analysis
Last synced: 6 days ago
JSON representation
A report generator for stocks using Polygon.io REST APIs
- Host: GitHub
- URL: https://github.com/fjctp/polygon-fetcher
- Owner: fjctp
- License: mit
- Created: 2023-04-12T18:38:43.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-06T17:39:10.000Z (over 1 year ago)
- Last Synced: 2024-06-19T18:06:39.245Z (5 months ago)
- Topics: golang, server, stock-analysis
- Language: Go
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# polygon-fetcher
This program runs a static file server that serves HTML reports for stocks.
## Usage
The server listens to port `80` and serves HTML reports from `output_dir/html` folder. To request a report for `AAPL`, run the program and go to `localhost/AAPL.html` in a broswer. If the report does not exist, the program will pull data from `polygon.io` using REST APIs and generate a HTML report. The data will be stored in `output_dir/json` in JSON format, while the report will be stored in `output_dir/html` as HTML.
## Prerequisite
* `polygon.io` API key
* `just` >= 1.8.0
* `go` >= 1.19.6## Run
### Build executable
Build the executable under `build` folder
```
just build
```### Run the executabke
Run the server and set the output folder to `./output`, where the JSON data and html reports will locate in their sub-folders.
```
export POLYGON_API_KEY="Your API key"
polygon-fetcher -output_dir "output"
```Or run it wil `just`, which set the output folder to `./build/output`
```
echo POLYGON_API_KEY="Your API key" > .env
just serve
```### Use Docker
Define `POLYGON_API_KEY` in `.env`.
```
podman run -it --rm -p 3000:80 --env-file .env -v $PWD/output/:/data fjctp/polygon-fetcher:latest
```