Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luizcartolano2 committed Apr 5, 2024
1 parent 84cf52f commit 014b251
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 13 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# Github Template
# Stock Analyser

Github Template is a repository that aims to make easy to create new repos.
Project implements a stock-analyser API.

The following sections are examples for a good README.md .
The project is implemented using Flask Framework with Python 3.9. We also use Docker to make it easier to deploy and also for tests on local environment.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install foobar.
In order to use the project `docker-compose` is probably going to be enough to execute the project. It might be necessary to install the projects dependencies before execute it, what can be done with following command:

```bash
pip install foobar
pip install -r requirements.txt
```

## Usage

```python
import foobar
After install the dependencies, you can use following commands to execute the Docker instance at your local environment:
1. Build dockerfile : `docker-compose build`
2. Make system up: `docker-compose up`
3. Make system down: `docker-compose down`

foobar.pluralize('word') # returns 'words'
foobar.pluralize('goose') # returns 'geese'
foobar.singularize('phenomena') # returns 'phenomenon'
```
To run the created tests it will be necessary to follow these steps:
1. Run tests: `pytest`

To run the documentation:
1. Run: `mkdocs serve`
2. Open the browser on the informed url

## Postman Requests
A sample of the possible requests for the system are presented at `stock-analyser.postman_collection.json` file and can be imported at Postman for local usage.

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand Down
35 changes: 35 additions & 0 deletions docs/how-to-guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## How To Analyse Stock Information?

If you want to retrieve historical data and analyse it, so
you're in luck! The `stock-analyser` package can help you
get this done.

Download the code from this GitHub repository and run some
Docker commands to get a running API to do it for you:

```shell
docker-compose build
docker-compose up
```

### Endpoints

#### Ping

- **Method**: GET
- **URL**: `http://127.0.0.1:5000/ping`

#### Tickers

- **Method**: GET
- **URL**: `http://127.0.0.1:5000/tickers`

#### Post

- **Method**: POST
- **URL**: `http://127.0.0.1:5000/tickers`
- **Body**:
```json
{
"tickers": ["AAPL"]
}
30 changes: 30 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This site contains the project documentation for the
`stock-analyser`. Its aim is to give you a server that retrieves information
from stock exchanges using multiple providers and also doing analyses for these.

## Table Of Contents

The documentation follows the best practice for
project documentation as described by Daniele Procida
in the [Diátaxis documentation framework](https://diataxis.fr/)
and consists of four separate parts:

1. [How-To Guides](how-to-guides.md)
2. [Reference](reference.md)

Quickly find what you're looking for depending on
your use case by looking at the different pages.

## Acknowledgements

I want to extend my sincerest gratitude to our steadfast office plants,
for silently witnessing our triumphs, failures, and occasional office drama
without ever leafing us hanging. To the coffee machine, for being the unsung hero
of our productivity and for always perking us up, one cup at a time.
A huge shoutout to my patient family and friends, who have perfected the
art of nodding along to our techno-babble without skipping a beat.
And last but not least, a heartfelt thank you to the internet – for
being our reliable co-pilot through the highs and lows of this project,
and for providing endless cat videos during those much-needed breaks.
Without all of you, this endeavor would have been as futile as trying to find a
`Ctrl + Alt + Delete` button on a typewriter.
12 changes: 12 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This part of the project documentation focuses on
an **information-oriented** approach. Use it as a
reference for the technical implementation of the
`stock-analyser` project code.

## Flask Application
::: src.app

## API Client Application
::: src.client.api_client
::: src.client.api_name
::: src.client.frequency
18 changes: 18 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
site_name: Stock Analyser Project

theme:
name: "material"

plugins:
- mkdocstrings:
handlers:
custom_handler:
handler_config_option: yes
options:
some_config_option: "a"
other_config_option: 0

nav:
- Stock Analyser: index.md
- How-To Guides: how-to-guides.md
- reference.md
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ Flask-Caching~=2.1.0
gunicorn~=21.2.0
pytest~=8.1.1
pytest-mock~=3.14.0
mocker~=1.1.1
mocker~=1.1.1
mkdocs~=1.5.3
mkdocs-material~=9.5.17
mkdocstrings~=0.24.2
mkdocstrings-python~=1.9.2
29 changes: 28 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,34 @@
long_description_content_type='text/markdown',
url='https://github.com/luizcartolano2/stock-analyser',
packages=find_packages(),
install_requires=[],
install_requires=[
'setuptools~=58.0.4',
'pip~=21.2.4',
'wheel~=0.37.0',
'dill~=0.3.8',
'future~=0.18.2',
'isort~=5.13.2',
'tomli~=2.0.1',
'pylint~=3.1.0',
'astroid~=3.1.0',
'tomlkit~=0.12.4',
'mccabe~=0.7.0',
'platformdirs~=4.2.0',
'numpy~=1.26.4',
'pandas~=2.2.1',
'tiingo~=0.14.0',
'python-dotenv~=1.0.1',
'flask~=3.0.2',
'Flask-Caching~=2.1.0',
'gunicorn~=21.2.0',
'pytest~=8.1.1',
'pytest-mock~=3.14.0',
'mocker~=1.1.1',
'mkdocs~=1.5.3',
'mkdocs-material~=9.5.17',
'mkdocstrings~=0.24.2',
'mkdocstrings-python~=1.9.2'
],
python_requires='>=3.8',
license='MIT License',
)
107 changes: 107 additions & 0 deletions stock-analyser.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"info": {
"_postman_id": "2e99fe44-6a26-4cd7-8f58-1a696487c8dc",
"name": "stock-analyser",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "34091265"
},
"item": [
{
"name": "ping",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:5000/ping",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "5000",
"path": [
"ping"
]
}
},
"response": []
},
{
"name": "tickers",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:5000/tickers",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "5000",
"path": [
"tickers"
]
}
},
"response": []
},
{
"name": "post",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"tickers\": [\"APPL\"]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:5000/tickers",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "5000",
"path": [
"tickers"
]
}
},
"response": []
},
{
"name": "prices",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:5000/prices",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "5000",
"path": [
"prices"
]
}
},
"response": []
}
]
}

0 comments on commit 014b251

Please sign in to comment.