mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-16 07:16:40 +00:00
upgraded /start and /help + donation info
This commit is contained in:
parent
7e7fbbceb2
commit
9c0abb0946
61
README.md
61
README.md
@ -6,10 +6,11 @@
|
||||
<h3 align="center">Simple Telegram Stock Bot</h3>
|
||||
|
||||
<div align="center">
|
||||
<style>.bmc-button img{height: 34px !important;width: 35px !important;margin-bottom: 1px !important;box-shadow: none !important;border: none !important;vertical-align: middle !important;}.bmc-button{padding: 7px 15px 7px 10px !important;line-height: 35px !important;height:51px !important;text-decoration: none !important;display:inline-flex !important;color:#FFFFFF !important;background-color:#FF813F !important;border-radius: 5px !important;border: 1px solid transparent !important;padding: 7px 15px 7px 10px !important;font-size: 22px !important;letter-spacing: 0.6px !important;box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;margin: 0 auto !important;font-family:'Cookie', cursive !important;-webkit-box-sizing: border-box !important;box-sizing: border-box !important;}.bmc-button:hover, .bmc-button:active, .bmc-button:focus {-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;opacity: 0.85 !important;color:#FFFFFF !important;}</style><link href="https://fonts.googleapis.com/css?family=Cookie" rel="stylesheet"><a class="bmc-button" target="_blank" href="https://www.buymeacoffee.com/Anson"><img src="https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg" alt="Buy me a beer"><span style="margin-left:5px;font-size:28px !important;">Buy me a beer</span></a>
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[](/LICENSE)
|
||||
[]()
|
||||
[]()
|
||||
[](/LICENSE)
|
||||
|
||||
</div>
|
||||
|
||||
@ -20,17 +21,19 @@
|
||||
</p>
|
||||
|
||||
## 📝 Table of Contents
|
||||
+ [About](#about)
|
||||
+ [How it works](#working)
|
||||
+ [Usage](#usage)
|
||||
+ [Getting Started](#getting_started)
|
||||
+ [Deploying your own bot](#deployment)
|
||||
+ [Built Using](#built_using)
|
||||
+ [Contributing](../CONTRIBUTING.md)
|
||||
+ [author](#author)
|
||||
+ [Acknowledgments](#acknowledgement)
|
||||
|
||||
- [About](#about)
|
||||
- [How it works](#working)
|
||||
- [Usage](#usage)
|
||||
- [Getting Started](#getting_started)
|
||||
- [Deploying your own bot](#deployment)
|
||||
- [Built Using](#built_using)
|
||||
- [Contributing](../CONTRIBUTING.md)
|
||||
- [author](#author)
|
||||
- [Acknowledgments](#acknowledgement)
|
||||
|
||||
## 🧐 About <a name = "about"></a>
|
||||
|
||||
This bot aims to be as simple as possible while providing all the information you need on the stock market. The motivation of this bot is to provide similar stock market functionality that the Google Assistant provided in [Google Allo](https://gcemetery.co/google-allo/) before the project was sunset.
|
||||
|
||||
## 💭 How it works <a name = "working"></a>
|
||||
@ -42,14 +45,19 @@ This bot works by using the [IEX API 2.0](https://iexcloud.io/docs/api/). Using
|
||||
### Basic Usage
|
||||
|
||||
The simplest way to use the bot is just by sending a message either as a direct message or in a group chat with the bot active. The bot will search every message for text with a dollar sign followed by a stock symbol, and it will return the full name of the company and the current trading price.
|
||||
|
||||
```
|
||||
$tsla
|
||||
```
|
||||
|
||||
The symbols can be anywhere in the message, and you can post as many as you like so commands such as:
|
||||
|
||||
```
|
||||
I wonder if $aapl is down as much as $msft is today.
|
||||
```
|
||||
|
||||
would return the stock price of both Apple and Microsoft like so:
|
||||
|
||||
```
|
||||
The current stock price of Microsoft Corp. is $131.4, the stock is currently up 2.8%
|
||||
|
||||
@ -59,10 +67,13 @@ The current stock price of Apple, Inc. is $190.15, the stock is currently up 2.6
|
||||
### /dividend
|
||||
|
||||
To get information about the dividend of a stock type `/dividend` followed by any text that has symbols with a dollar sign in front of them. So, the following command:
|
||||
|
||||
```
|
||||
/dividend $psec
|
||||
```
|
||||
|
||||
Would return information about Prospect Capitals dividend:
|
||||
|
||||
```
|
||||
Prospect Capital Corp. Declares June 2019 Dividend of $0.06 Per Share
|
||||
The dividend is in: 38 Days 3 Hours 53 Minutes 22 Seconds.
|
||||
@ -73,25 +84,29 @@ The dividend is in: 38 Days 3 Hours 53 Minutes 22 Seconds.
|
||||
### /news
|
||||
|
||||
To get the latest news about a stock symbol use `/news` followed by any text that has symbols with a dollar sign in front of them. So, the following command:
|
||||
|
||||
```
|
||||
/news $psec
|
||||
```
|
||||
|
||||
Would return news for Prospect Capital:
|
||||
|
||||
News for PSEC:
|
||||
|
||||
[Yield-Starved Investors Still Accumulating BDCs Paying More Than 10% Annually](https://cloud.iexapis.com/v1/news/article/d994b8b5-9fbf-4ceb-afbe-e6defcfc6352)
|
||||
[Yield-Starved Investors Still Accumulating BDCs Paying More Than 10% Annually](https://cloud.iexapis.com/v1/news/article/d994b8b5-9fbf-4ceb-afbe-e6defcfc6352)
|
||||
|
||||
[Assessing Main Street Capital's Results For Q1 2019 (Includes Updated Price Target And Investment Ratings Analysis)](https://cloud.iexapis.com/v1/news/article/e60899bc-5230-4388-a609-fc2b8736a7d4)
|
||||
[Assessing Main Street Capital's Results For Q1 2019 (Includes Updated Price Target And Investment Ratings Analysis)](https://cloud.iexapis.com/v1/news/article/e60899bc-5230-4388-a609-fc2b8736a7d4)
|
||||
|
||||
[Fully Assessing Prospect Capital's Fiscal Q3 2019 (Includes Current Recommendation And Price Target)](https://cloud.iexapis.com/v1/news/article/08881160-72c5-4f5d-885b-1751187d24eb)
|
||||
[Fully Assessing Prospect Capital's Fiscal Q3 2019 (Includes Current Recommendation And Price Target)](https://cloud.iexapis.com/v1/news/article/08881160-72c5-4f5d-885b-1751187d24eb)
|
||||
|
||||
### /info
|
||||
|
||||
To get information about a stock type `/info` followed by any text that has symbols with a dollar sign in front of them. So, the following command:
|
||||
|
||||
```
|
||||
/info $psec
|
||||
```
|
||||
|
||||
Would return information about Prospect Capitals:
|
||||
|
||||
Company Name: [Prospect Capital Corp.](http://www.prospectstreet.com/)
|
||||
@ -138,16 +153,20 @@ docker run --detach \
|
||||
Your bot should be running! If you are new to Docker, I would recommend checking out its documentation for full control over your bot.
|
||||
|
||||
## 🚀 Deploying your own bot <a name = "deployment"></a>
|
||||
|
||||
I recommend Digital Ocean for small projects like this because it is straightforward to use and affordable. [Sign up with my referral code, and we both get some free hosting.](https://m.do.co/c/6b5df7ef55b6)
|
||||
|
||||
## ⛏️ Built Using <a name = "built_using"></a>
|
||||
+ [python-telegram-bot](https://python-telegram-bot.org/) - Python Telegram API Wrapper
|
||||
+ [Digital Ocean](https://www.digitalocean.com/) - IaaS hosting platform
|
||||
|
||||
- [python-telegram-bot](https://python-telegram-bot.org/) - Python Telegram API Wrapper
|
||||
- [Digital Ocean](https://www.digitalocean.com/) - IaaS hosting platform
|
||||
|
||||
## ✍️ author <a name = "author"></a>
|
||||
+ [Anson Biggs](https://blog.ansonbiggs.com/author/anson/) - The one and only
|
||||
|
||||
- [Anson Biggs](https://blog.ansonbiggs.com/author/anson/) - The one and only
|
||||
|
||||
## 🎉 Acknowledgements <a name = "acknowledgement"></a>
|
||||
+ Telegram for having a great bot API
|
||||
+ IEX Cloud for offering a free tier
|
||||
+ Viewers like you ♥
|
||||
|
||||
- Telegram for having a great bot API
|
||||
- IEX Cloud for offering a free tier
|
||||
- Viewers like you ♥
|
||||
|
10
bot.py
10
bot.py
@ -29,13 +29,17 @@ print("Bot Online")
|
||||
|
||||
def start(update, context):
|
||||
"""Send a message when the command /start is issued."""
|
||||
update.message.reply_text("I am started and ready to go!")
|
||||
update.message.reply_text(
|
||||
text=Symbol.help_text, parse_mode=telegram.ParseMode.MARKDOWN
|
||||
)
|
||||
|
||||
|
||||
def help(update, context):
|
||||
"""Send link to docs when the command /help is issued."""
|
||||
message = "[Please see the documentaion for Bot information](https://simple-stock-bots.gitlab.io/site/telegram/)"
|
||||
update.message.reply_text(text=message, parse_mode=telegram.ParseMode.MARKDOWN)
|
||||
|
||||
update.message.reply_text(
|
||||
text=Symbol.help_text, parse_mode=telegram.ParseMode.MARKDOWN
|
||||
)
|
||||
|
||||
|
||||
def symbol_detect(update, context):
|
||||
|
18
functions.py
18
functions.py
@ -18,6 +18,24 @@ class Symbol:
|
||||
|
||||
searched_symbols = {}
|
||||
|
||||
help_text = """
|
||||
Thanks for using this bot, consider supporting it by [buying me a beer.](https://www.buymeacoffee.com/Anson)
|
||||
|
||||
Full documentation can be found [here.](https://simple-stock-bots.gitlab.io/site/telegram/)
|
||||
|
||||
**Commands**
|
||||
- /dividend `$[symbol]` will return dividend information for the symbol.
|
||||
- /news `$[symbol]` will return news about the symbol.
|
||||
- /info `$[symbol]` will return general information about the symbol.
|
||||
|
||||
**Inline Features**
|
||||
You can type @SimpleStockBot `[search]` in any chat or direct message to search for the stock bots full list of stock symbols and return the price of the ticker.
|
||||
|
||||
The bot also looks at every message in any chat it is in for stock symbols. Symbols start with a `$` followed by the stock symbol. For example: $tsla would return price information for Tesla Motors.
|
||||
|
||||
Market data is provided by [IEX Cloud](https://iexcloud.io)
|
||||
"""
|
||||
|
||||
def __init__(self, IEX_TOKEN: str):
|
||||
self.IEX_TOKEN = IEX_TOKEN
|
||||
self.get_symbol_list()
|
||||
|
Loading…
x
Reference in New Issue
Block a user