1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2026-06-03 21:00:26 +00:00

Compare commits

...

12 Commits

Author SHA1 Message Date
Anson d5e40a976b black 2023-10-17 00:03:34 -06:00
Anson 2d94d19b52 okay actually finish patch lol 2023-10-16 23:59:23 -06:00
Anson 850598b696 finish patch lol 2023-10-16 23:55:32 -06:00
Anson 43b58fdbe8 patch 2023-10-16 23:53:28 -06:00
Anson 2758c45432 Merge branch '113-make-announcement-for-milestone-completion-2' into 'master'
Resolve "Make announcement for Milestone completion"

Closes #113

See merge request simple-stock-bots/simple-stock-bot!61
2023-10-17 05:43:32 +00:00
Anson c717739b75 Resolve "Make announcement for Milestone completion" 2023-10-17 05:43:32 +00:00
Anson 8a78ab5f55 Merge branch '113-make-announcement-for-milestone-completion' into 'master'
Resolve "Make announcement for Milestone completion"

Closes #113

See merge request simple-stock-bots/simple-stock-bot!60
2023-10-17 05:14:24 +00:00
Anson a54653bbc7 Resolve "Make announcement for Milestone completion" 2023-10-17 05:14:24 +00:00
Anson 686cf889c1 Merge branch '36-add-rate-limiting' into 'master'
Resolve "Add rate limiting"

Closes #36

See merge request simple-stock-bots/simple-stock-bot!57
2023-10-16 05:54:35 +00:00
Anson 662344bf18 Resolve "Add rate limiting" 2023-10-16 05:54:35 +00:00
Anson 87d9346f98 Merge branch '112-move-to-new-url' into 'master'
Update links from individual bot repos to monorepo

Closes #112

See merge request simple-stock-bots/simple-stock-bot!59
2023-10-16 04:53:23 +00:00
Anson 2fd5906f9e Update links from individual bot repos to monorepo 2023-10-16 04:53:23 +00:00
29 changed files with 765 additions and 639 deletions
+11 -9
View File
@@ -5,7 +5,8 @@
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/python:1-3-bookworm", // "image": "mcr.microsoft.com/devcontainers/python:1-3-bookworm",
"build": { "build": {
"dockerfile": "Dockerfile" "dockerfile": "Dockerfile",
"context": ".."
}, },
"features": { "features": {
"ghcr.io/devcontainers-contrib/features/black:2": {}, "ghcr.io/devcontainers-contrib/features/black:2": {},
@@ -16,16 +17,17 @@
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
"ms-python.python", "ms-python.python",
"ms-python.black-formatter", "ms-python.black-formatter",
"ms-python.vscode-pylance", "ms-python.vscode-pylance",
"ms-python.isort", "ms-python.isort",
"charliermarsh.ruff", "charliermarsh.ruff",
"ms-toolsai.jupyter" "ms-toolsai.jupyter",
] "esbenp.prettier-vscode"
]
} }
}, },
"postCreateCommand": "pip3 install --user -r dev-reqs.txt" "postCreateCommand": "pip3 install --user -r dev-reqs.txt && apt-get update && apt-get install -y nodejs npm && npm install"
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}, // "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
+1
View File
@@ -1,2 +1,3 @@
__pycache__ __pycache__
.env .env
node_modules
+6 -3
View File
@@ -1,9 +1,7 @@
stages: stages:
- lint - lint
- build
- build_site - build_site
- deploy - deploy
- deploy_site
black: black:
stage: lint stage: lint
@@ -13,12 +11,17 @@ black:
ruff: ruff:
stage: lint stage: lint
# image: registry.gitlab.com/pipeline-components/ruff:latest
image: python:3.11-slim image: python:3.11-slim
script: script:
- pip3 install ruff - pip3 install ruff
- ruff --output-format gitlab . - ruff --output-format gitlab .
prettier:
stage: lint
image: node:16-slim # Use Node.js image since prettier is a Node.js tool
script:
- npm install prettier
- npx prettier --check . # Adjust the path as needed
include: include:
- local: /site/.gitlab-ci.yml - local: /site/.gitlab-ci.yml
+7 -7
View File
@@ -1,10 +1,10 @@
{ {
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnSaveMode": "modificationsIfAvailable",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.formatOnPaste": true, "editor.formatOnSaveMode": "file"
"editor.formatOnSaveMode": "modificationsIfAvailable", }
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file"
}
} }
+5 -1
View File
@@ -9,6 +9,7 @@ Enhance your group chats on Telegram and Discord with real-time stock and crypto
## Documentation ## Documentation
Comprehensive documentation is available to help you understand the features and capabilities of Simple Stock Bots: Comprehensive documentation is available to help you understand the features and capabilities of Simple Stock Bots:
- [Official Documentation](https://simplestockbot.com/) - [Official Documentation](https://simplestockbot.com/)
- [Command Reference](https://simplestockbot.com/commands/) - [Command Reference](https://simplestockbot.com/commands/)
@@ -17,6 +18,7 @@ Comprehensive documentation is available to help you understand the features and
Simple Stock Bots is sustained entirely through donations, with an annual expense of about $420 for server and premium market data subscriptions from [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo). Simple Stock Bots is sustained entirely through donations, with an annual expense of about $420 for server and premium market data subscriptions from [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo).
You can contribute by: You can contribute by:
- Donating through [Buy Me A Coffee](https://www.buymeacoffee.com/Anson) (PayPal or Credit Card accepted). - Donating through [Buy Me A Coffee](https://www.buymeacoffee.com/Anson) (PayPal or Credit Card accepted).
- Using the `/donate` [command](commands.md#donate-amount-in-usd) on Telegram. - Using the `/donate` [command](commands.md#donate-amount-in-usd) on Telegram.
- [Getting in touch](contact.md) for any inquiries or suggestions. - [Getting in touch](contact.md) for any inquiries or suggestions.
@@ -24,7 +26,7 @@ You can contribute by:
### Additional Support: ### Additional Support:
- Follow on [Twitter](https://twitter.com/AnsonBiggs) - Follow on [Twitter](https://twitter.com/AnsonBiggs)
- Contribute or star the project on [GitLab](https://gitlab.com/simple-stock-bots) - Contribute or star the project on [GitLab](https://gitlab.com/simple-stock-bots/simple-stock-bot)
- Utilize referral links for self-hosting: - Utilize referral links for self-hosting:
- [DigitalOcean](https://m.do.co/c/6b5df7ef55b6) - [DigitalOcean](https://m.do.co/c/6b5df7ef55b6)
- [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web) - [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web)
@@ -32,11 +34,13 @@ You can contribute by:
## Hosting ## Hosting
Self-hosting instructions are provided for those interested in running the bot on their own servers: Self-hosting instructions are provided for those interested in running the bot on their own servers:
- [Hosting Guide](https://simplestockbot.com/hosting/) - [Hosting Guide](https://simplestockbot.com/hosting/)
## Contact ## Contact
Reach out for bug reports, feature requests, or other inquiries: Reach out for bug reports, feature requests, or other inquiries:
- [Contact Page](https://simplestockbot.com/contact/) - [Contact Page](https://simplestockbot.com/contact/)
--- ---
+1 -1
View File
@@ -1,8 +1,8 @@
import datetime as dt import datetime as dt
import logging import logging
import os import os
from typing import Dict
from collections import OrderedDict from collections import OrderedDict
from typing import Dict
import humanize import humanize
import pandas as pd import pandas as pd
+14
View File
@@ -7,6 +7,9 @@ import schedule
from markdownify import markdownify from markdownify import markdownify
from common.Symbol import Coin from common.Symbol import Coin
from common.utilities import rate_limited
import time
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -24,10 +27,21 @@ class cg_Crypto:
self.get_symbol_list() self.get_symbol_list()
schedule.every().day.do(self.get_symbol_list) schedule.every().day.do(self.get_symbol_list)
# Coingecko's rate limit is 30 requests per minute.
# Since there are two bots sharing the same IP, we allocate half of that limit to each bot.
# This results in a rate limit of 15 requests per minute for each bot.
# Given this, the rate limit effectively becomes 1 request every 4 seconds for each bot.
@rate_limited(0.25)
def get(self, endpoint, params: dict = {}, timeout=10) -> dict: def get(self, endpoint, params: dict = {}, timeout=10) -> dict:
url = "https://api.coingecko.com/api/v3" + endpoint url = "https://api.coingecko.com/api/v3" + endpoint
resp = r.get(url, params=params, timeout=timeout) resp = r.get(url, params=params, timeout=timeout)
# Make sure API returned a proper status code # Make sure API returned a proper status code
if resp.status_code == 429:
log.warning(f"CoinGecko returned 429 - Too Many Requests for endpoint: {endpoint}. Sleeping and trying again.")
time.sleep(10)
return self.get(endpoint=endpoint, params=params, timeout=timeout)
try: try:
resp.raise_for_status() resp.raise_for_status()
except r.exceptions.HTTPError as e: except r.exceptions.HTTPError as e:
+1
View File
@@ -4,4 +4,5 @@ markdownify==0.11.6
mplfinance==0.12.10b0 mplfinance==0.12.10b0
pandas==2.1.1 pandas==2.1.1
requests==2.31.0 requests==2.31.0
rush==2021.4.0
schedule==1.2.1 schedule==1.2.1
+31
View File
@@ -0,0 +1,31 @@
import time
import logging
log = logging.getLogger(__name__)
def rate_limited(max_per_second):
"""
Decorator that ensures the wrapped function is called at most `max_per_second` times per second.
"""
min_interval = 1.0 / max_per_second
def decorate(func):
last_called = [0.0]
def rate_limited_function(*args, **kwargs):
elapsed = time.time() - last_called[0]
left_to_wait = min_interval - elapsed
if left_to_wait > 0:
log.info(f"Rate limit exceeded. Waiting for {left_to_wait:.2f} seconds.")
time.sleep(left_to_wait)
ret = func(*args, **kwargs)
last_called[0] = time.time()
return ret
return rate_limited_function
return decorate
+1 -1
View File
@@ -10,7 +10,7 @@ class D_info:
license = re.sub( license = re.sub(
r"\b\n", r"\b\n",
" ", " ",
r.get("https://gitlab.com/simple-stock-bots/simple-discord-stock-bot/-/raw/master/LICENSE").text, r.get("https://gitlab.com/simple-stock-bots/simple-stock-bot/-/raw/master/LICENSE").text,
) )
help_text = """ help_text = """
+1 -2
View File
@@ -1,10 +1,9 @@
version: '3' version: "3"
services: services:
telegram: telegram:
build: build:
context: . context: .
dockerfile: telegram/Dockerfile dockerfile: telegram/Dockerfile
image: registry.gitlab.com/simple-stock-bots/simple-telegram-stock-bot
env_file: .env env_file: .env
discord: discord:
build: build:
+27
View File
@@ -0,0 +1,27 @@
{
"name": "simple-stock-bot",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"prettier": "3.0.3"
}
},
"node_modules/prettier": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
"dev": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
}
}
}
+5
View File
@@ -0,0 +1,5 @@
{
"devDependencies": {
"prettier": "3.0.3"
}
}
+6 -6
View File
@@ -1,7 +1,7 @@
image: python:3.11 image: python:3.11
build_site: build_mkdocs:
stage: build stage: build_site
script: script:
- cd ./site - cd ./site
- pip install -r requirements.txt - pip install -r requirements.txt
@@ -10,14 +10,14 @@ build_site:
paths: paths:
- public - public
deploy_site: pages:
stage: deploy stage: deploy
script: script:
- echo "Publishing site..." - echo "Publishing site..."
dependencies: dependencies:
- build_site - build_mkdocs
artifacts: artifacts:
paths: paths:
- public - public
rules: # rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
+10 -10
View File
@@ -1,12 +1,12 @@
{ {
"yaml.schemas": { "yaml.schemas": {
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml" "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
}, },
"yaml.customTags": [ "yaml.customTags": [
"!ENV scalar", "!ENV scalar",
"!ENV sequence", "!ENV sequence",
"tag:yaml.org,2002:python/name:materialx.emoji.to_svg", "tag:yaml.org,2002:python/name:materialx.emoji.to_svg",
"tag:yaml.org,2002:python/name:materialx.emoji.twemoji", "tag:yaml.org,2002:python/name:materialx.emoji.twemoji",
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format" "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
] ]
} }
-1
View File
@@ -1,2 +1 @@
# Blog # Blog
+6 -4
View File
@@ -4,7 +4,7 @@ date: 2023-10-10
tags: [Simple Stock Bot, Introduction, Telegram, Discord, Financial Insights] tags: [Simple Stock Bot, Introduction, Telegram, Discord, Financial Insights]
authors: [Anson] authors: [Anson]
description: > description: >
Welcome to the world of Simple Stock Bot, where real-time financial insights are integrated seamlessly into your group chats on Telegram and Discord! Welcome to the world of Simple Stock Bot, where real-time financial insights are integrated seamlessly into your group chats on Telegram and Discord!
--- ---
## What is Simple Stock Bot? ## What is Simple Stock Bot?
@@ -25,7 +25,10 @@ Simple Stock Bot is a chatbot designed to enrich your financial discussions on T
</div> </div>
</div> </div>
<!-- more -->
With Simple Stock Bot, you can: With Simple Stock Bot, you can:
- **Fetch Real-time Quotes**: Obtain the latest stock and cryptocurrency prices instantly within your group chat. - **Fetch Real-time Quotes**: Obtain the latest stock and cryptocurrency prices instantly within your group chat.
- **View Charts**: Delve into intraday movements or assess a month's trading data right inside your group chat. - **View Charts**: Delve into intraday movements or assess a month's trading data right inside your group chat.
- **Stay Updated on Market Trends**: Discover what's buzzing in the stock and crypto spheres. - **Stay Updated on Market Trends**: Discover what's buzzing in the stock and crypto spheres.
@@ -36,13 +39,12 @@ With Simple Stock Bot, you can:
[:fontawesome-brands-discord: Discord](https://discordapp.com/api/oauth2/authorize?client_id=532045200823025666&permissions=36507338752&scope=bot){ .md-button } [:fontawesome-brands-discord: Discord](https://discordapp.com/api/oauth2/authorize?client_id=532045200823025666&permissions=36507338752&scope=bot){ .md-button }
## Using the Bot ## Using the Bot
Embarking on your journey with Simple Stock Bot is effortless. Just add the bot to your Telegram or Discord group, and you're all set to dive into financial discussions right from your chat! Embarking on your journey with Simple Stock Bot is effortless. Just add the bot to your Telegram or Discord group, and you're all set to dive into financial discussions right from your chat!
Here are some simple commands to get you started: Here are some simple commands to get you started:
- `/intra` to view intraday charts. - `/intra` to view intraday charts.
- `/chart` for a glimpse of the last month's trading data. - `/chart` for a glimpse of the last month's trading data.
- `/trending` to catch up on the latest trending stocks and cryptocurrencies. - `/trending` to catch up on the latest trending stocks and cryptocurrencies.
@@ -51,7 +53,7 @@ Here are some simple commands to get you started:
Simple Stock Bot is a community-supported project, thriving on the contributions from its users. It's sustained entirely through donations to cover server costs and premium market data subscriptions, ensuring it remains free for everyone. Simple Stock Bot is a community-supported project, thriving on the contributions from its users. It's sustained entirely through donations to cover server costs and premium market data subscriptions, ensuring it remains free for everyone.
Feeling generous? You can support the project by [donating](https://simplestockbot.com/donate/), following on [Twitter](https://twitter.com/AnsonBiggs), or contributing on [GitLab](https://gitlab.com/simple-stock-bot). Feeling generous? You can support the project by [donating](https://simplestockbot.com/donate/), following on [Twitter](https://twitter.com/AnsonBiggs), or contributing on [GitLab](https://gitlab.com/simple-stock-bots/simple-stock-bot).
## Dive Deeper ## Dive Deeper
@@ -0,0 +1,40 @@
---
title: "v2023.1 Release! New Stock Market Data Provider and More!"
date: 2023-10-16
tags: [Simple Stock Bot, Telegram, Discord, MarketDataApp]
authors: [Anson]
description: >
Discover the latest updates for Simple Stock Bot, including our new integration with MarketData.app for enhanced real-time stock market insights.
---
## 🌐 General Updates:
- **New Home**: We've transitioned to our fresh and updated website at [simplestockbot.com](https://simplestockbot.com/).
- **New Data Provider**: We're excited to announce [MarketData.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web) as our new provider for real-time stock market data, ensuring timely and accurate insights for our users.
<!-- more -->
## 📈 MarketData.app Integration Enhancements:
- We've introduced **additional options** to our MarketData.app integration, ensuring even more precise and varied financial data.
- **Afterhours Data Fix**: Addressed an issue where after hours stock market data caused errors.
- **Trending Symbol Accuracy**: Fixed a bug that led to the display of invalid symbols in the `/trending` command.
## 🤖 Bot Improvements & Fixes:
- **Unified Repository**: To streamline our development and deployment, we've merged the Discord and Telegram bots into a single monorepo. Check it out on [GitLab](https://gitlab.com/simple-stock-bots/simple-stock-bot). Contributions welcome!
- **Inline Functionality Restoration**: Fixed the telegram bot's inline functionality.
- **Python Telegram Bot Update**: Migrated to the latest version of `Python Telegram Bot` for superior performance and more features.
- **Rate Limiting Addition**: Implemented rate limiting to ensure optimal performance during peak usage times.
- **SO MUCH MORE**: [Move to Marketdata.app GitLab Issues](https://gitlab.com/simple-stock-bots/simple-stock-bot/-/milestones/3)
## 📝 Documentation & Repository Overhauls:
- **Centralized Documentation**: For convenience and improved maintenance, we've shifted our documentation into the monorepo.
- **Documentation Refinement**: Updated our documentation to reflect the latest homepage details.
**Special Mention**: Immense gratitude to our dedicated community for their continual feedback and unwavering support. Dive deeper into the financial realm with Simple Stock Bot!
---
📥 For any concerns, queries, or feedback, don't hesitate to [Contact Us](../../contact.md).
+4 -2
View File
@@ -32,7 +32,6 @@ The Simple Stock Bot looks at every message it can see and tries to detect stock
This command allows you to query real-time data for stock options. By simply inputting the stock symbol, strike price, month, and specifying either a call or a put, you can get the latest options data right at your fingertips. For example, `AAPL $220 December call` will provide the current data for Apple's call option with a $220 strike price expiring in December. This command allows you to query real-time data for stock options. By simply inputting the stock symbol, strike price, month, and specifying either a call or a put, you can get the latest options data right at your fingertips. For example, `AAPL $220 December call` will provide the current data for Apple's call option with a $220 strike price expiring in December.
![Image of the telegram bot providing options info.](img/telegram_options.png) ![Image of the telegram bot providing options info.](img/telegram_options.png)
## `/donate [Amount in USD]` :fontawesome-brands-telegram-plane: ## `/donate [Amount in USD]` :fontawesome-brands-telegram-plane:
@@ -104,7 +103,9 @@ Gets the latest trending stocks and their change in price
━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━━━
$GME: Gamestop Corporation - Class A, 5.06% $GME: Gamestop Corporation - Class A, 5.06%
$MMAT: Meta Materials Inc, 4.77% $MMAT: Meta Materials Inc, 4.77%
$$BTC: Bitcoin, -0.83%
$$
BTC: Bitcoin, -0.83%
$$ETH: Ethereum, 6.06% $$ETH: Ethereum, 6.06%
$$DOGE: Binance-Peg Dogecoin, 0.14% $$DOGE: Binance-Peg Dogecoin, 0.14%
@@ -184,3 +185,4 @@ full list of stock symbols and return the price of the ticker. Then once you sel
want the bot will send a message as you in that chat with the latest stock price. want the bot will send a message as you in that chat with the latest stock price.
The bot also looks at every message in any chat it is in for stock symbols.Symbols start with a 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. `$` followed by the stock symbol. For example:$tsla would return price information for Tesla Motors.
$$
+1 -1
View File
@@ -5,4 +5,4 @@ Your feedback and experience with Simple Stock Bot is invaluable. Whether you've
- **Telegram**: Drop me a message on [Telegram](https://t.me/MisterBiggs). - **Telegram**: Drop me a message on [Telegram](https://t.me/MisterBiggs).
- **Discord**: Feel free to reach out on Discord at `MisterBiggs#0465`. - **Discord**: Feel free to reach out on Discord at `MisterBiggs#0465`.
- **Twitter**: Send me a tweet on [Twitter](https://twitter.com/AnsonBiggs). - **Twitter**: Send me a tweet on [Twitter](https://twitter.com/AnsonBiggs).
- **GitLab**: For technical issues or feature requests, feel free to open an issue on our [GitLab Repository](https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot). - **GitLab**: For technical issues or feature requests, feel free to open an issue on our [GitLab Repository](https://gitlab.com/simple-stock-bots/simple-stock-bot).
+20 -17
View File
@@ -17,35 +17,38 @@ Ensure the following are installed or obtained before proceeding:
- **[marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web)**: Sign up to get an API key. A free tier is available and should suffice for private groups. More details [here](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo). - **[marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web)**: Sign up to get an API key. A free tier is available and should suffice for private groups. More details [here](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo).
!!! tip !!! tip
The bot will still operate without a [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo) key but will revert to using only cryptocurrency data. The bot will still operate without a [marketdata.app](https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=repo) key but will revert to using only cryptocurrency data.
!!! note !!! note
To enable donation acceptance, obtain a Stripe API key and provide a `STRIPE` key to your bot. [https://stripe.com/]() To enable donation acceptance, obtain a Stripe API key and provide a `STRIPE` key to your bot. [https://stripe.com/]()
## Setup Instructions ## Setup Instructions
1. **Download/Clone the Repository**: 1. **Download/Clone the Repository**:
- Download or clone this repository to your local machine.
- Download or clone this repository to your local machine.
2. **Configure Environment Variables**: 2. **Configure Environment Variables**:
- Navigate to the project directory and locate the `.env` file.
- Fill in the `.env` file with your obtained API keys:
```plaintext - Navigate to the project directory and locate the `.env` file.
MARKETDATA=your_marketdata_api_key - Fill in the `.env` file with your obtained API keys:
STRIPE=your_stripe_api_key
TELEGRAM=your_telegram_api_key
DISCORD=your_discord_api_key
```
Alternatively, pass the variables using Docker Compose environment variables or command-line arguments. ```plaintext
MARKETDATA=your_marketdata_api_key
STRIPE=your_stripe_api_key
TELEGRAM=your_telegram_api_key
DISCORD=your_discord_api_key
```
Alternatively, pass the variables using Docker Compose environment variables or command-line arguments.
3. **Build and Run the Bot:** 3. **Build and Run the Bot:**
- Open a terminal in the project directory.
- Build and run both bots using Docker Compose:
```bash - Open a terminal in the project directory.
docker-compose up - Build and run both bots using Docker Compose:
```
```bash
docker-compose up
```
Now, your bot(s) should be up and running! If you're unfamiliar with Docker, reviewing the [Docker documentation](https://docs.docker.com/) is highly recommended to gain better control over your bot and understand Docker commands better. Now, your bot(s) should be up and running! If you're unfamiliar with Docker, reviewing the [Docker documentation](https://docs.docker.com/) is highly recommended to gain better control over your bot and understand Docker commands better.
+6
View File
@@ -9,25 +9,31 @@ Discover a new level of financial discussion with Simple Stock Bot, your go-to s
## [Commands](commands.md) ## [Commands](commands.md)
### Real-Time Stock and Cryptocurrency Updates ### Real-Time Stock and Cryptocurrency Updates
- Get live price updates of stocks and cryptocurrencies. - Get live price updates of stocks and cryptocurrencies.
- Symbol Detection: Use `$` for stocks and `$$` for cryptocurrencies, e.g., `$tsla` for Tesla and `$$btc` for Bitcoin. - Symbol Detection: Use `$` for stocks and `$$` for cryptocurrencies, e.g., `$tsla` for Tesla and `$$btc` for Bitcoin.
### Intraday and Historical Data Visualization ### Intraday and Historical Data Visualization
- `/intra`: View a stock's movement since the last market open or a cryptocurrency's 24-hour chart. - `/intra`: View a stock's movement since the last market open or a cryptocurrency's 24-hour chart.
- `/chart`: Provides a chart of the last month's trading data up till the day before. - `/chart`: Provides a chart of the last month's trading data up till the day before.
### Trending Assets Awareness ### Trending Assets Awareness
- `/trending`: Discover the latest trending stocks and cryptocurrencies and their price changes. - `/trending`: Discover the latest trending stocks and cryptocurrencies and their price changes.
### In-App Assistance and Support ### In-App Assistance and Support
- `/help`: Provides a quick summary of available commands for easy reference. - `/help`: Provides a quick summary of available commands for easy reference.
- `/donate`: Support the maintenance of the bot to ensure continued free access. - `/donate`: Support the maintenance of the bot to ensure continued free access.
### User-Friendly Interaction ### User-Friendly Interaction
- Easy symbol and command usage for a smooth user experience. - Easy symbol and command usage for a smooth user experience.
- Engage with a community of financial enthusiasts and share insights effortlessly. - Engage with a community of financial enthusiasts and share insights effortlessly.
## [Contact](contact.md) ## [Contact](contact.md)
Need assistance or have inquiries? Feel free to reach out and I'll be happy to help. Need assistance or have inquiries? Feel free to reach out and I'll be happy to help.
## Powered by MarketData.app ## Powered by MarketData.app
+1 -8
View File
@@ -1,14 +1,12 @@
site_name: Simple Stock Bot site_name: Simple Stock Bot
site_url: https://simplestockbot.com site_url: https://simplestockbot.com
edit_uri: /simple-stock-bots/site/tree/master/site repo_url: https://gitlab.com/simple-stock-bots/simple-stock-bot
repo_url: https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot
repo_name: Simple Stock Bots repo_name: Simple Stock Bots
site_description: Simple Discord and Telegram chat bots for Stock Market Data. site_description: Simple Discord and Telegram chat bots for Stock Market Data.
site_author: Anson Biggs site_author: Anson Biggs
copyright: <a href="https://ansonbiggs.com">Anson Biggs</a> 2018 </br> Available Under an <a href="/LICENSE/">MIT LICENSE</a> </br> copyright: <a href="https://ansonbiggs.com">Anson Biggs</a> 2018 </br> Available Under an <a href="/LICENSE/">MIT LICENSE</a> </br>
nav: nav:
- Home: index.md - Home: index.md
- Commands: commands.md - Commands: commands.md
@@ -56,19 +54,14 @@ extra:
link: https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web link: https://dashboard.marketdata.app/marketdata/aff/go/misterbiggs?keyword=web
name: MarketData.app for stock data name: MarketData.app for stock data
extra_css: extra_css:
- stylesheets/phone.css - stylesheets/phone.css
plugins: plugins:
- search - search
- social - social
- blog - blog
markdown_extensions: markdown_extensions:
- attr_list - attr_list
- pymdownx.emoji: - pymdownx.emoji:
+1 -1
View File
@@ -10,7 +10,7 @@ class T_info:
license = re.sub( license = re.sub(
r"\b\n", r"\b\n",
" ", " ",
r.get("https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot/-/raw/master/LICENSE").text, r.get("https://gitlab.com/simple-stock-bots/simple-stock-bot/-/raw/master/LICENSE").text,
) )
help_text = """ help_text = """
+8 -14
View File
@@ -11,27 +11,21 @@ import traceback
from uuid import uuid4 from uuid import uuid4
import mplfinance as mpf import mplfinance as mpf
import telegram from T_info import T_info
from telegram import (
InlineQueryResultArticle,
InputTextMessageContent,
LabeledPrice,
Update,
)
import telegram
from common.symbol_router import Router
from telegram import InlineQueryResultArticle, InputTextMessageContent, LabeledPrice, Update
from telegram.ext import ( from telegram.ext import (
Application, Application,
CommandHandler, CommandHandler,
InlineQueryHandler,
PreCheckoutQueryHandler,
MessageHandler,
filters,
ContextTypes, ContextTypes,
InlineQueryHandler,
MessageHandler,
PreCheckoutQueryHandler,
filters,
) )
from common.symbol_router import Router
from T_info import T_info
# Enable logging # Enable logging
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO) logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)