From 17a9ee5c45a9f081ee6fe2dd69c950028fa19102 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:05:35 -0700 Subject: [PATCH 01/21] has to be in root directory --- web/.gitlab-ci.yml => .gitlab-ci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename web/.gitlab-ci.yml => .gitlab-ci.yml (100%) diff --git a/web/.gitlab-ci.yml b/.gitlab-ci.yml similarity index 100% rename from web/.gitlab-ci.yml rename to .gitlab-ci.yml From d5a55ce5f3251e795e4f0df61e2a886d125a5d12 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:08:08 -0700 Subject: [PATCH 02/21] commands weren't being run in web directory --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8458cda..9b1e4df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ before_script: pages: script: + - cd ./web - mkdocs build - mv site public artifacts: From 6fbcc1174c62e15f8b44578948416e27b7e3f47f Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:20:01 -0700 Subject: [PATCH 03/21] Changing things until page deploys --- web/docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/docs/index.md b/web/docs/index.md index ec3f3a8..f0e45a1 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -22,7 +22,7 @@ I wonder how $aapl, $nflx, and $sono are performing today. Will return: -![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png) +`![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png)` As long as the bot is in your chat it will reply to any stock tickers in your messages. From fcea0239315b3196b85dd41b0785d4ede57ba5a0 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:22:29 -0700 Subject: [PATCH 04/21] changey changey --- web/docs/commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/docs/commands.md b/web/docs/commands.md index 042167c..537f054 100644 --- a/web/docs/commands.md +++ b/web/docs/commands.md @@ -16,7 +16,7 @@ I wonder how $aapl, $nflx, and $sono are performing today. Will return: -![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png) +`![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png)` ## Commands From 03116908f3bab352c7fa9478bbacf8532ee8e988 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:24:29 -0700 Subject: [PATCH 05/21] getting closer, or am I? --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b1e4df..63ce3c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,6 @@ pages: - mv site public artifacts: paths: - - public + - ./web/public only: - master From fd7e1dfba4c9d867a885ad325b23837208e850ec Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:29:56 -0700 Subject: [PATCH 06/21] Give site a url --- web/mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/web/mkdocs.yml b/web/mkdocs.yml index d79a96e..3e91d26 100644 --- a/web/mkdocs.yml +++ b/web/mkdocs.yml @@ -1,4 +1,5 @@ site_name: Simple Stock Bot +site_url: http://misterbiggs.gitlab.io/simple-telegram-bot nav: - Home: index.md # - Commands: commands.md From 16089b8c3f30f1325ecf0f4ff52e3392b20592b4 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:36:50 -0700 Subject: [PATCH 07/21] lil change to path still poking buttons --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63ce3c6..5309ac7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,6 @@ pages: - mv site public artifacts: paths: - - ./web/public + - ./web/public/ only: - master From 15e15b7b97be9679ef38f840409d4d574e8ecb7b Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:39:47 -0700 Subject: [PATCH 08/21] poke --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5309ac7..1a4ff5a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,9 +9,9 @@ pages: script: - cd ./web - mkdocs build - - mv site public + - mv site ../public artifacts: paths: - - ./web/public/ + - public only: - master From 9654d02c1399c4723861f45a901cb3199bb1112d Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 20:46:18 -0700 Subject: [PATCH 09/21] fixed url --- web/docs/index.md | 2 +- web/mkdocs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/docs/index.md b/web/docs/index.md index f0e45a1..ec3f3a8 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -22,7 +22,7 @@ I wonder how $aapl, $nflx, and $sono are performing today. Will return: -`![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png)` +![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png) As long as the bot is in your chat it will reply to any stock tickers in your messages. diff --git a/web/mkdocs.yml b/web/mkdocs.yml index 3e91d26..e369c70 100644 --- a/web/mkdocs.yml +++ b/web/mkdocs.yml @@ -1,5 +1,5 @@ site_name: Simple Stock Bot -site_url: http://misterbiggs.gitlab.io/simple-telegram-bot +site_url: https://misterbiggs.gitlab.io/simple-telegram-bot nav: - Home: index.md # - Commands: commands.md From 0764313e8eb0d7fa491a3238359334a8e10c97ae Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 21:12:56 -0700 Subject: [PATCH 10/21] Fixed image links --- web/docs/commands.md | 2 +- web/docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/docs/commands.md b/web/docs/commands.md index 537f054..bc6f68c 100644 --- a/web/docs/commands.md +++ b/web/docs/commands.md @@ -16,7 +16,7 @@ I wonder how $aapl, $nflx, and $sono are performing today. Will return: -`![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png)` +![Conversation With Simple Telegram Bot](img\telegramBotTickerReply.png) ## Commands diff --git a/web/docs/index.md b/web/docs/index.md index ec3f3a8..8098f3d 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -22,7 +22,7 @@ I wonder how $aapl, $nflx, and $sono are performing today. Will return: -![Conversation With Simple Telegram Bot](\img\telegramBotTickerReply.png) +![Conversation With Simple Telegram Bot](img\telegramBotTickerReply.png) As long as the bot is in your chat it will reply to any stock tickers in your messages. From a2100f3fbb37324615c75175a7f9c59bd51ad805 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 21:31:28 -0700 Subject: [PATCH 11/21] Formatting of run commands --- web/docs/index.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/web/docs/index.md b/web/docs/index.md index 8098f3d..61c28cb 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -58,9 +58,20 @@ You can also run your own bot super easily in a [Docker](https://hub.docker.com/ 1. Download the repository. 2. Change information in [Credentials.py]() with your own Telegram Bot key, which can be found [here.]() 3. Navigate to /bot directory in Powershell -4. Build an image of the bot: - `docker build -t stockbot .` +4. Build an image of the bot: + +```powershell +docker build -t stockbot . +``` + 5. Run the image: - `docker run -it --rm --detatch --name stockbot stockbot` + +```powershell +docker run -it --rm --detatch --name stockbot stockbot +``` + 6. Or you can run the image headless: - `docker run -it --rm --detatch --name stockbot stockbot` \ No newline at end of file + +```powershell +docker run -it --rm --detatch --name stockbot stockbot +``` From cd149f7b1184a340584063b8a50f52abb590c69f Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 5 Feb 2019 21:33:21 -0700 Subject: [PATCH 12/21] Updated readme to reflect new static pages --- README.md | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2ecdb28..c3ac82b 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,5 @@ # simple-telegram-bot -## Docker Instructions +## A Telegram Bot for stock market Data. -Build the Image - -```powershell -docker build -t stockbot . -``` - -Run The image - -```powershell -docker run -it --rm --name stockbot stockbot -``` - -Or run the Image headless - -```powershell -docker run -it --rm --detatch --name stockbot stockbot -``` \ No newline at end of file +## Full documentation [here.](https://misterbiggs.gitlab.io/simple-telegram-bot) \ No newline at end of file From a4aff05848bd4f15ee7bffce2368c418dfc7c4dc Mon Sep 17 00:00:00 2001 From: Anson Biggs Date: Thu, 7 Feb 2019 17:12:11 +0000 Subject: [PATCH 13/21] Commands for docker were wrong --- web/docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/docs/index.md b/web/docs/index.md index 61c28cb..a9d3032 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -67,11 +67,11 @@ docker build -t stockbot . 5. Run the image: ```powershell -docker run -it --rm --detatch --name stockbot stockbot +docker run -it --rm --name stockbot stockbot ``` 6. Or you can run the image headless: ```powershell -docker run -it --rm --detatch --name stockbot stockbot +docker run -it --rm -detatch --name stockbot stockbot ``` From e96a824cf573861bad415ad37c47d407f488c464 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 8 Feb 2019 20:03:57 -0700 Subject: [PATCH 14/21] Edit button now works correctly --- web/mkdocs.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/mkdocs.yml b/web/mkdocs.yml index e369c70..c1b9f46 100644 --- a/web/mkdocs.yml +++ b/web/mkdocs.yml @@ -1,13 +1,14 @@ site_name: Simple Stock Bot site_url: https://misterbiggs.gitlab.io/simple-telegram-bot +edit_uri: blob/master/web/docs/ nav: - - Home: index.md - # - Commands: commands.md - # - About: about.md - # - Author's Website: https://blog.ansonbiggs.com/ - - LICENSE: LICENSE.md -theme: 'material' + - Home: index.md + # - Commands: commands.md + # - About: about.md + # - Author's Website: https://blog.ansonbiggs.com/ + - LICENSE: LICENSE.md +theme: "material" repo_url: https://gitlab.com/MisterBiggs/simple-telegram-bot repo_name: Simple Telegram Bot -site_description: A Telegram Bot for stock market Data. \ No newline at end of file +site_description: A Telegram Bot for stock market Data. From 18f82286ceccfff002bcd9257f37bb2ee82d2733 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:18:04 -0700 Subject: [PATCH 15/21] fixed a space --- bot/stockBot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/stockBot.py b/bot/stockBot.py index 60608bf..6f48c61 100644 --- a/bot/stockBot.py +++ b/bot/stockBot.py @@ -82,7 +82,7 @@ def news(bot, update): elif change < 0: message = ( message - + ", the stock is currently **down" + + ", the stock is currently **down " + str(change) + "%**" ) From 4c04c1664d28b7d71704708baa89c4ecdfa808f1 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:18:42 -0700 Subject: [PATCH 16/21] updated docs with new bot info --- web/docs/index.md | 49 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/web/docs/index.md b/web/docs/index.md index a9d3032..b9f6f49 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -2,9 +2,11 @@ ## About +If you aren't already, you can talk to this bot here: **[http://t.me/SimpleStockBot](http://t.me/SimpleStockBot)** + Simple Stock Bot is a bot for [Telegram](https://telegram.org/) that provides information about the stock market. You can view the source code [here.](https://gitlab.com/MisterBiggs/simple-telegram-bot). You can also build your own docker container to run [here.](#Build) -*Coded with ❤ by [@MisterBiggs](https://gitlab.com/MisterBiggs)* +_Coded with ❤ by [@MisterBiggs](https://gitlab.com/MisterBiggs)_ ## Getting a Stock Quote @@ -28,8 +30,9 @@ As long as the bot is in your chat it will reply to any stock tickers in your me ## Commands -* [`/help`](#/help) - Create a new project. -* [`/news`](#/news) - Start the live-reloading docs server. +- [`/help`](#/help) +- [`/news`](#/news) +- [`/dividend`](#/dividend) ### /help @@ -37,19 +40,31 @@ This command just displays a short description of what the bot does and a link t ### /news -This command is intelligent enough to get any tickers in the ticker format: `$amzn`, and can handle as many tickers as you would like to enter. The bot will then return the price of the ticker, and links various websites that provide news about the ticker. Currently for Apple stock the Bot would return: +This command is intelligent enough to get any tickers in the ticker format: `$amzn`, and can handle as many tickers as you would like to enter. The bot will then return the price of the ticker, and links various websites that provide news about the ticker. Currently the command `/news $aapl` returns: +--- -`The current stock price of Apple Inc. is **$174.18**, the stock is currently up **1.71%**` -[`Bravos`](https://bravos.co/AAPL) -[`Seeking Alpha`](https://seekingalpha.com/symbol/AAPL) -[`MSN Money`](https://www.msn.com/en-us/money/stockdetails?symbol=AAPL) -[`Yahoo Finance`](https://finance.yahoo.com/quote/AAPL) -[`Wall Street Journal`](https://quotes.wsj.com/AAPL) -[`The Street`](https://www.thestreet.com/quote/AAPL.html) -[`Zacks`](https://www.zacks.com/stock/quote/AAPL) +`The current stock price of Apple Inc. is $**170.89**, the stock is currently **up 0.86%**` -*The /news command needs updating, feel free to [open an issue](https://gitlab.com/MisterBiggs/simple-telegram-bot/issues) with suggestions.* +[`Apple: The 4 Biggest Risks`](https://api.iextrading.com/1.0/stock/aapl/article/7171544094325661) + +[`Apple is getting so serious about health, it's started hosting heart-health events at Apple Stores`](https://api.iextrading.com/1.0/stock/aapl/article/6966979968162641) + +[`You can now ask Siri to get you directions with Waze so you don't even have to open the app`](https://api.iextrading.com/1.0/stock/aapl/article/7672481171984085) + +--- + +### /dividend + +The dividend command will give you the `dividend yield`, `dividend rate`, and will tell you how long until the payout date for any tickers input. Currently the command `/dividend $psec` returns: + +--- + +`Prospect Capital Corporation current dividend yield is: 0.720%, or $11.285 per share.` + +`The dividend is in: 14 Days 1 Hours 54 Minutes 46 Seconds.` + +--- ## Run your own Bot @@ -59,18 +74,18 @@ You can also run your own bot super easily in a [Docker](https://hub.docker.com/ 2. Change information in [Credentials.py]() with your own Telegram Bot key, which can be found [here.]() 3. Navigate to /bot directory in Powershell 4. Build an image of the bot: - + ```powershell docker build -t stockbot . ``` -5. Run the image: - +5. Run the image: + ```powershell docker run -it --rm --name stockbot stockbot ``` -6. Or you can run the image headless: +6. Or you can run the image headless: ```powershell docker run -it --rm -detatch --name stockbot stockbot From 778c8e9d778da1693adff8343e19006927556e38 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:34:34 -0700 Subject: [PATCH 17/21] updated docs to show gitlab container hosting --- web/docs/index.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/docs/index.md b/web/docs/index.md index b9f6f49..0aec1ac 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -66,7 +66,13 @@ The dividend command will give you the `dividend yield`, `dividend rate`, and wi --- -## Run your own Bot +## Run your own bot using latest build + +```powershell +docker run --detach registry.gitlab.com/misterbiggs/simple-telegram-bot:latest +``` + +## Built and Run your own Bot You can also run your own bot super easily in a [Docker](https://hub.docker.com/) Container. From 22415a8da234ae7efeec8d57591205f3e2a9a2a3 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:40:27 -0700 Subject: [PATCH 18/21] Old import left over from implementing news --- bot/tickerInfo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bot/tickerInfo.py b/bot/tickerInfo.py index 58d5ef2..e031cea 100644 --- a/bot/tickerInfo.py +++ b/bot/tickerInfo.py @@ -1,6 +1,5 @@ import urllib.request import json -import feedparser from datetime import datetime import time From 7215a29d9071b4209483a59ba53ba5ea66e961b9 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:40:56 -0700 Subject: [PATCH 19/21] Bot was typing for every message even when it shouldn't. This should fix --- bot/stockBot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/stockBot.py b/bot/stockBot.py index 6f48c61..311e24e 100644 --- a/bot/stockBot.py +++ b/bot/stockBot.py @@ -113,9 +113,10 @@ def stockInfo(bot, update): try: # regex to find tickers in messages, looks for up to 4 word characters following a dollar sign and captures the 4 word characters tickers = re.findall("[$](\w{1,4})", message) - bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING) tickerData = tickerInfo.tickerQuote(tickers) + bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING) + for ticker in tickers: ticker = ticker.upper() # Makes sure ticker exists From a22c80aa80365019df88e4dd368cc6ac3f456fc2 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 23:46:20 -0700 Subject: [PATCH 20/21] removed docker build instructions Since theres now a remote build so info on how to build their own container feels redundant. Now shows how to run bot outside of docker. --- web/docs/index.md | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/web/docs/index.md b/web/docs/index.md index 0aec1ac..310e17a 100644 --- a/web/docs/index.md +++ b/web/docs/index.md @@ -78,21 +78,5 @@ You can also run your own bot super easily in a [Docker](https://hub.docker.com/ 1. Download the repository. 2. Change information in [Credentials.py]() with your own Telegram Bot key, which can be found [here.]() -3. Navigate to /bot directory in Powershell -4. Build an image of the bot: - -```powershell -docker build -t stockbot . -``` - -5. Run the image: - -```powershell -docker run -it --rm --name stockbot stockbot -``` - -6. Or you can run the image headless: - -```powershell -docker run -it --rm -detatch --name stockbot stockbot -``` +3. Run stockBot.py +4. profit??? From 40c8c7a00d1349171073320a8399347137dba657 Mon Sep 17 00:00:00 2001 From: Anson Biggs Date: Wed, 20 Feb 2019 07:02:29 +0000 Subject: [PATCH 21/21] Add LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..18a8b73 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Anson Biggs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.