mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
fix hugo server (#873)
This commit is contained in:
98
CONTRIBUTING.md
vendored
98
CONTRIBUTING.md
vendored
@@ -16,7 +16,7 @@ The following is a set of guidelines for contributing to Gamestonk Terminal. The
|
||||
4. [Remember Coding Style](#remember-coding-style)
|
||||
5. [Write Code and Commit](#write-code-and-commit)
|
||||
6. [Add a Test](#add-a-test)
|
||||
7. [Write Documentation](#add-documentation)
|
||||
7. [Add Documentation](#add-documentation)
|
||||
8. [Open a Pull Request](#open-a-pull-request)
|
||||
9. [Review Process](#review-process)
|
||||
|
||||
@@ -75,7 +75,7 @@ The fact that this is an Open Source project makes the possibilities of contribu
|
||||
The following layout is expected: `/<context>/<category>/<command_files>`
|
||||
|
||||
If there are sub-categories, the layout will be: `/<context>/<category>/<sub-category>/<command_files>`
|
||||
|
||||
|
||||
**Example:**
|
||||
```
|
||||
gamestonk_terminal/stocks/stocks_controller.py
|
||||
@@ -103,18 +103,18 @@ With:
|
||||
|
||||
|**Context**|**Category**|**File**|**Description**|
|
||||
|:-|:-|:-|:-|
|
||||
|`stocks/`| | `stocks_controller.py` | Manages **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data, or, more importantly, redirecting to the selected _category_. |
|
||||
|`stocks/`| | `stocks_helper.py` | Helper to `stocks_controller.py`. This file is meant to implement `commands` needed by `stocks_controller.py` |
|
||||
|`stocks/`| `due_diligence/` | `dd_controller.py` | Manages **due_diligence** _category_ from **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data. |
|
||||
|`stocks/`| `due_diligence/` | `marketwatch_view.py` | This file contains functions that rely on **Market Watch** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `dd_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `due_diligence/` | `marketwatch_model.py` | This file contains functions that rely on **Market Watch** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `marketwatch_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`stocks/`| `due_diligence/` | `finviz_view.py` | This file contains functions that rely on **Finviz** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `dd_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `due_diligence/` | `finviz_model.py` | This file contains functions that rely on **Finviz** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `finviz_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`stocks/`| `technical_analysis/` | `ta_controller.py` | Manages **technical_analysis** _category_ from **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data. |
|
||||
|`stocks/`| `technical_analysis/` | `tradingview_view.py` | This file contains functions that rely on **TradingView** data. These functions represent _commands_ that belong to **technical_analysis** _category_ from **stocks** _context_. These functions are called by `ta_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `technical_analysis/` | `tradingview_model.py` | This file contains functions that rely on **TradingView** data. These functions represent _commands_ that belong to **technical_analysis** _category_ from **stocks** _context_. These functions are called by `tradingview_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`common/`| `technical_analysis/` | `overlap_view.py` | This file contains functions that rely on **overlap** data. In this case **overlap** is not a data source, but the type of technical analysis performed. These functions represent _commands_ that belong to **technical_analysis** _category_ from **MULTIPLE** _contexts_. These functions are called by `ta_controller.py`, from **MULTIPLE** _contexts_, using the arguments given by the user and will output either a string, table or plot. Due to the fact that this file is **common** to multiple _contexts_ the functions need to be generic enough to accomodate for this. E.g. if we are proving a dataframe to these functions, we should make sure that `stocks/ta_controller.py` and `crypto/ta_controller` use the same formatting. |
|
||||
|`common/`| `technical_analysis/` | `overlap_model.py` | This file contains functions that rely on **overlap** data. In this case **overlap** is not a data source, but the type of technical analysis performed. These functions represent _commands_ that belong to **technical_analysis** _category_ from **MULTIPLE** _contexts_. These functions are called by `overlap_view.py`, and will return data to be processed in either a string, dictionary or dataframe format. Due to the fact that this file is **common** to multiple _contexts_ the functions need to be generic enough to accomodate for this. E.g. if we are getting the sentiment of an instrument, we should ensure that these functions accept both a "GME" or a "BTC", for `stocks` and `crypto`, respectively. |
|
||||
|`stocks/`| | `stocks_controller.py` | Manages **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data, or, more importantly, redirecting to the selected _category_. |
|
||||
|`stocks/`| | `stocks_helper.py` | Helper to `stocks_controller.py`. This file is meant to implement `commands` needed by `stocks_controller.py` |
|
||||
|`stocks/`| `due_diligence/` | `dd_controller.py` | Manages **due_diligence** _category_ from **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data. |
|
||||
|`stocks/`| `due_diligence/` | `marketwatch_view.py` | This file contains functions that rely on **Market Watch** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `dd_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `due_diligence/` | `marketwatch_model.py` | This file contains functions that rely on **Market Watch** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `marketwatch_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`stocks/`| `due_diligence/` | `finviz_view.py` | This file contains functions that rely on **Finviz** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `dd_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `due_diligence/` | `finviz_model.py` | This file contains functions that rely on **Finviz** data. These functions represent _commands_ that belong to **due_diligence** _category_ from **stocks** _context_. These functions are called by `finviz_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`stocks/`| `technical_analysis/` | `ta_controller.py` | Manages **technical_analysis** _category_ from **stocks** _context_ from a user perspective, i.e. routing _commands_ and arguments to output data. |
|
||||
|`stocks/`| `technical_analysis/` | `tradingview_view.py` | This file contains functions that rely on **TradingView** data. These functions represent _commands_ that belong to **technical_analysis** _category_ from **stocks** _context_. These functions are called by `ta_controller.py` using the arguments given by the user and will output either a string, table or plot. |
|
||||
|`stocks/`| `technical_analysis/` | `tradingview_model.py` | This file contains functions that rely on **TradingView** data. These functions represent _commands_ that belong to **technical_analysis** _category_ from **stocks** _context_. These functions are called by `tradingview_view.py` and will return data to be processed in either a string, dictionary or dataframe format. |
|
||||
|`common/`| `technical_analysis/` | `overlap_view.py` | This file contains functions that rely on **overlap** data. In this case **overlap** is not a data source, but the type of technical analysis performed. These functions represent _commands_ that belong to **technical_analysis** _category_ from **MULTIPLE** _contexts_. These functions are called by `ta_controller.py`, from **MULTIPLE** _contexts_, using the arguments given by the user and will output either a string, table or plot. Due to the fact that this file is **common** to multiple _contexts_ the functions need to be generic enough to accommodate for this. E.g. if we are proving a dataframe to these functions, we should make sure that `stocks/ta_controller.py` and `crypto/ta_controller` use the same formatting. |
|
||||
|`common/`| `technical_analysis/` | `overlap_model.py` | This file contains functions that rely on **overlap** data. In this case **overlap** is not a data source, but the type of technical analysis performed. These functions represent _commands_ that belong to **technical_analysis** _category_ from **MULTIPLE** _contexts_. These functions are called by `overlap_view.py`, and will return data to be processed in either a string, dictionary or dataframe format. Due to the fact that this file is **common** to multiple _contexts_ the functions need to be generic enough to accommodate for this. E.g. if we are getting the sentiment of an instrument, we should ensure that these functions accept both a "GME" or a "BTC", for `stocks` and `crypto`, respectively. |
|
||||
|
||||
|
||||
## Follow Coding Guidelines
|
||||
@@ -166,7 +166,7 @@ Note: As explained before, it is possible that this file needs to be created und
|
||||
5. In this function:
|
||||
1. Use typing hints
|
||||
2. Write a descriptive description where at the end the source is specified
|
||||
3. Get the data from the `_model` and parse it to be output in a more meaningful way.
|
||||
3. Get the data from the `_model` and parse it to be output in a more meaningful way.
|
||||
4. Ensure that the data that comes through is reasonable, i.e. at least that we aren't displaying an empty dataframe.
|
||||
5. Do not degrade the main data dataframe coming from model if there's an export flag. This is so that the export can have all the data rather than the short amount of information we may show to the user. Thus, in order to do so `df_data = df.copy()` can be useful as if you change `df_data`, `df` remains intact.
|
||||
6. Always add a new line at the end, this allows for an additional line between 2 commands and makes it easier for the user to visualize what is happening.
|
||||
@@ -346,7 +346,7 @@ Install the pre-commit hooks by running: `pre-commit install`.
|
||||
|
||||
#### Coding
|
||||
|
||||
Although the Coding Guidelines section has been already explained. It is worth mentioning that if you want to be faster at developing a new feature, you may implement it first on a `jupyter notebook` and then carry it accross to the terminal. This is mostly useful when the feature relies on scraping data from a website, or implementing a Neural Network model.
|
||||
Although the Coding Guidelines section has been already explained. It is worth mentioning that if you want to be faster at developing a new feature, you may implement it first on a `jupyter notebook` and then carry it across to the terminal. This is mostly useful when the feature relies on scraping data from a website, or implementing a Neural Network model.
|
||||
|
||||
#### Git Process
|
||||
|
||||
@@ -396,69 +396,7 @@ If you do not want to assert an item but your test still prints output, please a
|
||||
|
||||
## Add Documentation
|
||||
|
||||
#### Structure
|
||||
|
||||
This is the structure that the documentation has:
|
||||
```
|
||||
website/content/_index.md
|
||||
/stocks/_index.md
|
||||
/load/_index.md
|
||||
/candle/_index.md
|
||||
/discovery/_index.md
|
||||
/ipo/_index.md
|
||||
```
|
||||
|
||||
#### New Command
|
||||
|
||||
To add a new command, there are two main actions that need to be done:
|
||||
|
||||
1. Create a directory with the name of the command and a `_index.md` file within. Examples:
|
||||
* When adding `ipo`, since this command belongs to context `stocks` and category `discovery`, we added a `ipo` folder with a `_index.md` file within to `website/content/stocks/discovery`.
|
||||
* When adding `candle`, since this command belongs to context `stocks`, we added a `candle` folder with a `_index.md` file within to `website/content/stocks/`.
|
||||
|
||||
2. The `_index.md` file should have the output of the `command -h` followed by a screenshot example (with white background) of what the user can expect. Note that you can now drag and drop the images while editing the readme file on the remote web version of your PR branch. Github will create a link for it with format (https://user-images.githubusercontent.com/***/***.file_format). Example:
|
||||
|
||||
---
|
||||
```shell
|
||||
usage: ipo [-p PAST_DAYS] [-f FUTURE_DAYS]
|
||||
```
|
||||
|
||||
Past and future IPOs. [Source: https://finnhub.io]
|
||||
* -p : Number of past days to look for IPOs. Default 0.
|
||||
* -f : Number of future days to look for IPOs. Default 10.
|
||||
|
||||
<IMAGE HERE - Use drag and drop hint mentioned above>
|
||||
|
||||
---
|
||||
|
||||
3. Update the Navigation bar to match the content you've added. This is done by adding 2 lines of code to `website/data/menu/`, i.e. a `name` and a `ref`. Example:
|
||||
|
||||
```
|
||||
---
|
||||
main:
|
||||
- name: stocks
|
||||
ref: "/stocks"
|
||||
sub:
|
||||
- name: load
|
||||
ref: "/stocks/load"
|
||||
- name: candle
|
||||
ref: "/stocks/candle"
|
||||
- name: discovery
|
||||
ref: "/stocks/discovery"
|
||||
sub:
|
||||
- name: ipo
|
||||
ref: "/stocks/discovery/ipo"
|
||||
- name: map
|
||||
ref: "/stocks/discovery/map"
|
||||
```
|
||||
|
||||
#### Run Hugo Server
|
||||
|
||||
0. Make sure Hugo is installed. See https://gohugo.io/getting-started/installing/.
|
||||
1. Go into the website directory, i.e. `cd website`
|
||||
2. Run the server locally with `hugo server -D`
|
||||
3. Open the web server at http://localhost:1313/GamestonkTerminal/, or where it says that the Web Server is available at.
|
||||
|
||||
See [Hugo Server instructions](/website/README.md).
|
||||
|
||||
## Open a Pull Request
|
||||
|
||||
@@ -492,6 +430,6 @@ A label **must** be selected from the following types:
|
||||
|
||||
As soon as the Pull Request is opened, our repository has a specific set of github actions that will not only run linters on the branch just pushed, but also run pytest on it. This allows for another layer of safety on the code developed.
|
||||
|
||||
In addition, our team is known for performing `diligent` code reviews. This not only allows us to reduce the amount of iterations on that code and have it to be more future proof, but also allows the developer to learn/improve his coding skills.
|
||||
In addition, our team is known for performing `diligent` code reviews. This not only allows us to reduce the amount of iterations on that code and have it to be more future proof, but also allows the developer to learn/improve his coding skills.
|
||||
|
||||
Often in the past the reviewers have suggested better coding practices, e.g. using `1_000_000` instead of `1000000` for better visibility, or suggesting a speed optimization improvement.
|
||||
|
||||
142
website/README.md
vendored
142
website/README.md
vendored
@@ -1,3 +1,141 @@
|
||||
# Gamestonk Terminal Commands
|
||||
# Hugo Server
|
||||
|
||||
https://gamestonkterminal.github.io/GamestonkTerminal/
|
||||
The current features can be found in [Gamestonk Terminal Features](https://gamestonkterminal.github.io/GamestonkTerminal/).
|
||||
|
||||
<!-- TABLE OF CONTENTS -->
|
||||
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
|
||||
<ol>
|
||||
<li><a href="#install-hugo">Install Hugo</a></li>
|
||||
<li><a href="#run-locally">Run Locally</a></li>
|
||||
<li><a href="#adding-features">Adding Features</a></li>
|
||||
<ul>
|
||||
<li><a href="#structure">Structure</a></li>
|
||||
<li><a href="#new-feature">New Feature</a></li>
|
||||
</ul>
|
||||
</ol>
|
||||
|
||||
|
||||
## Install Hugo
|
||||
|
||||
Install [Hugo](https://gohugo.io/getting-started/installing/).
|
||||
|
||||
## Run Locally
|
||||
|
||||
Go into `website` directory with:
|
||||
```
|
||||
cd website
|
||||
```
|
||||
|
||||
And run:
|
||||
```
|
||||
hugo server -D
|
||||
```
|
||||
|
||||
If everything is working well, the following should appear:
|
||||
```
|
||||
13:58 $ hugo server -D
|
||||
Start building sites …
|
||||
hugo v0.87.0+extended darwin/amd64 BuildDate=unknown
|
||||
|
||||
| EN
|
||||
-------------------+------
|
||||
Pages | 853
|
||||
Paginator pages | 0
|
||||
Non-page files | 1
|
||||
Static files | 111
|
||||
Processed images | 4
|
||||
Aliases | 0
|
||||
Sitemaps | 1
|
||||
Cleaned | 0
|
||||
|
||||
Built in 14912 ms
|
||||
Watching for changes in /Users/DidierRodriguesLopes/Documents/git/GamestonkTerminal/website/{archetypes,assets,content,data,static,themes}
|
||||
Watching for config changes in /Users/DidierRodriguesLopes/Documents/git/GamestonkTerminal/website/config.toml
|
||||
Environment: "development"
|
||||
Serving pages from memory
|
||||
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
|
||||
Web Server is available at http://localhost:1313/GamestonkTerminal/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
And you should be able to access your local version at http://localhost:1313/GamestonkTerminal/.
|
||||
|
||||
This will be important for the addiiton of features to the Hugo Server.
|
||||
|
||||
|
||||
## Adding Features
|
||||
|
||||
### Structure
|
||||
|
||||
This is the structure that the documentation follows:
|
||||
```
|
||||
website/content/_index.md
|
||||
/stocks/_index.md
|
||||
/load/_index.md
|
||||
/candle/_index.md
|
||||
/discovery/_index.md
|
||||
/ipo/_index.md
|
||||
/...
|
||||
/...
|
||||
/...
|
||||
/cryptocurrency/_index.md
|
||||
/chart/_index.md
|
||||
/defi/_index.md
|
||||
/borrow/_index.md
|
||||
/...
|
||||
/...
|
||||
/...
|
||||
/common/_index.md
|
||||
/technical_analysis/_index.md
|
||||
/ema/_index.md
|
||||
/...
|
||||
/...
|
||||
```
|
||||
|
||||
Note that the `common` folder holds features that are common across contexts, e.g. `technical analysis` can be performed on both `stocks` or `crytpo`.
|
||||
|
||||
### New Feature
|
||||
|
||||
To add a new command, there are two main actions that need to be done:
|
||||
|
||||
1. Create a directory with the name of the command and a `_index.md` file within. Examples:
|
||||
* When adding `ipo`, since this command belongs to context `stocks` and category `discovery`, we added a `ipo` folder with a `_index.md` file within to `website/content/stocks/discovery`.
|
||||
* When adding `candle`, since this command belongs to context `stocks`, we added a `candle` folder with a `_index.md` file within to `website/content/stocks/`.
|
||||
|
||||
2. The `_index.md` file should have the output of the `command -h` followed by a screenshot example (with white background) of what the user can expect. Note that you can now drag and drop the images while editing the readme file on the remote web version of your PR branch. Github will create a link for it with format (https://user-images.githubusercontent.com/***/***.file_format).
|
||||
|
||||
Example:
|
||||
|
||||
---
|
||||
```shell
|
||||
usage: ipo [-p PAST_DAYS] [-f FUTURE_DAYS]
|
||||
```
|
||||
|
||||
Past and future IPOs. [Source: https://finnhub.io]
|
||||
* -p : Number of past days to look for IPOs. Default 0.
|
||||
* -f : Number of future days to look for IPOs. Default 10.
|
||||
|
||||
<IMAGE HERE - Use drag and drop hint mentioned above>
|
||||
|
||||
---
|
||||
|
||||
3. Update the Navigation bar to match the content you've added. This is done by adding 2 lines of code to `website/data/menu/`, i.e. a `name` and a `ref`. Example:
|
||||
|
||||
```
|
||||
---
|
||||
main:
|
||||
- name: stocks
|
||||
ref: "/stocks"
|
||||
sub:
|
||||
- name: load
|
||||
ref: "/stocks/load"
|
||||
- name: candle
|
||||
ref: "/stocks/candle"
|
||||
- name: discovery
|
||||
ref: "/stocks/discovery"
|
||||
sub:
|
||||
- name: ipo
|
||||
ref: "/stocks/discovery/ipo"
|
||||
- name: map
|
||||
ref: "/stocks/discovery/map"
|
||||
```
|
||||
|
||||
5
website/content/common/_index.md
vendored
Executable file
5
website/content/common/_index.md
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc-tree >}}
|
||||
5
website/content/common/behavioural_analysis/_index.md
vendored
Executable file
5
website/content/common/behavioural_analysis/_index.md
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc-tree >}}
|
||||
5
website/content/common/prediction_techniques/_index.md
vendored
Executable file
5
website/content/common/prediction_techniques/_index.md
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc-tree >}}
|
||||
5
website/content/common/quantitative_analysis/_index.md
vendored
Executable file
5
website/content/common/quantitative_analysis/_index.md
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc-tree >}}
|
||||
Reference in New Issue
Block a user