diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 2b59de8..57d3db6 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -2,8 +2,6 @@ name: Lint Code Base on: - push: - branches-ignore: [master] pull_request: branches: [master] diff --git a/README.md b/README.md index 2d6789b..3ad0ccd 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,6 @@ The bots above are hosted in bulk. They are free to use on any discord server. You can have private instances only for your servers, with real time price updates. There is a full logging stack that includes loki & promtail with grafana for visualization. See contact info below for private bot inquiries. -If you encounter any issues with the bots please see the support options at the bottom of this page. - ![Really cool grafana dashboard](https://s3.oc0.rileysnyder.org/public/assets/grafana.png) ### Self-Hosting @@ -120,15 +118,23 @@ export SET_NICKNAME=1 export FREQUENCY=3 ``` +Other options: + +``` +export LOG_FILE=log.log # log to file instead of stdout +export POST_MARKET_PRICE=3 # display post market price instead of difference +``` + Once all your options are set, simply install the dependencies and run the bot (virtual environments might be a smart idea): ``` +pip3 install -r requirements.txt python3 main.py ``` ### Docker -You can also run these bots using docker. This can make running multiple bots esier. Here is an example docker compose file: +You can also run these bots using docker. This can make running multiple bots esier. Here is an example docker compose file (please check for the latest release and update the tags accordingly): ``` --- diff --git a/main.py b/main.py index 542abfd..d2e7eda 100644 --- a/main.py +++ b/main.py @@ -148,10 +148,19 @@ async def stock_update_activity(self, ticker: str, name: str, change_nick: bool # If after hours, get change if price_data.get('postMarketChange'): - raw_diff = price_data.get('postMarketChange', {}).get('raw', 0.00) + + # Get difference or new price + if getenv('POST_MARKET_PRICE'): + post_market_target = 'postMarketPrice' + else: + post_market_target = 'postMarketChange' + + raw_diff = price_data.get(post_market_target, {}).get('raw', 0.00) diff = round(raw_diff, 2) - if diff > 0: - diff = '+' + str(diff) + + if not getenv('POST_MARKET_PRICE'): + if diff > 0: + diff = '+' + str(diff) activity_content = f'After Hours: {diff}' logging.info(f'stock activity after hours price retrived: {activity_content}')