mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-16 07:16:40 +00:00
159 lines
3.8 KiB
Python
159 lines
3.8 KiB
Python
"""Class with functions for running the bot with IEX Cloud.
|
|
"""
|
|
|
|
import logging
|
|
|
|
import pandas as pd
|
|
|
|
from Symbol import Stock
|
|
|
|
|
|
class placeholder_Symbol:
|
|
"""
|
|
Functions for finding stock market information about symbols.
|
|
"""
|
|
|
|
placeholder_message = """
|
|
Due to increased costs for market data from IEX Cloud, a new provider will be required for the bot to have stock market data. Until then only cryptocurrency data will be available on the bot.
|
|
*Track this issue here:* https://t.me/simplestockbotnews
|
|
"""
|
|
|
|
def __init__(self) -> None:
|
|
"""Creates a placeholder Symbol Object"""
|
|
|
|
logging.warning("Creating a placeholder Symbol.")
|
|
|
|
def status(self) -> str:
|
|
"""Checks IEX Status dashboard for any current API issues.
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Human readable text on status of stock market data
|
|
"""
|
|
|
|
return self.placeholder_message
|
|
|
|
def price_reply(self, symbol: Stock) -> str:
|
|
"""Returns price movement of Stock for the last market day, or after hours.
|
|
|
|
Parameters
|
|
----------
|
|
symbol : Stock
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Formatted markdown
|
|
"""
|
|
|
|
return self.placeholder_message
|
|
|
|
def dividend_reply(self, symbol: Stock) -> str:
|
|
"""Returns the most recent, or next dividend date for a stock symbol.
|
|
|
|
Parameters
|
|
----------
|
|
symbol : Stock
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Formatted markdown
|
|
"""
|
|
return self.placeholder_message
|
|
|
|
def news_reply(self, symbol: Stock) -> str:
|
|
"""Gets most recent, english, non-paywalled news
|
|
|
|
Parameters
|
|
----------
|
|
symbol : Stock
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Formatted markdown
|
|
"""
|
|
return self.placeholder_message
|
|
|
|
def info_reply(self, symbol: Stock) -> str:
|
|
"""Gets description for Stock
|
|
|
|
Parameters
|
|
----------
|
|
symbol : Stock
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Formatted text
|
|
"""
|
|
return self.placeholder_message
|
|
|
|
def stat_reply(self, symbol: Stock) -> str:
|
|
"""Key statistics on a Stock
|
|
|
|
Parameters
|
|
----------
|
|
symbol : Stock
|
|
|
|
Returns
|
|
-------
|
|
str
|
|
Formatted markdown
|
|
"""
|
|
return self.placeholder_message
|
|
|
|
def cap_reply(self, symbol: Stock) -> str:
|
|
"""Get the Market Cap of a stock"""
|
|
|
|
return self.placeholder_message
|
|
|
|
def intra_reply(self, symbol: Stock) -> pd.DataFrame:
|
|
"""Returns price data for a symbol since the last market open.
|
|
|
|
Parameters
|
|
----------
|
|
symbol : str
|
|
Stock symbol.
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
Returns a timeseries dataframe with high, low, and volume data if its available. Otherwise returns empty pd.DataFrame.
|
|
"""
|
|
|
|
return pd.DataFrame()
|
|
|
|
def chart_reply(self, symbol: Stock) -> pd.DataFrame:
|
|
"""Returns price data for a symbol of the past month up until the previous trading days close.
|
|
Also caches multiple requests made in the same day.
|
|
|
|
Parameters
|
|
----------
|
|
symbol : str
|
|
Stock symbol.
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
Returns a timeseries dataframe with high, low, and volume data if its available. Otherwise returns empty pd.DataFrame.
|
|
"""
|
|
|
|
return pd.DataFrame()
|
|
|
|
def spark_reply(self, symbol: Stock) -> str:
|
|
return ""
|
|
|
|
def trending(self) -> list[str]:
|
|
"""Gets current coins trending on IEX. Only returns when market is open.
|
|
|
|
Returns
|
|
-------
|
|
list[str]
|
|
list of $ID: NAME, CHANGE%
|
|
"""
|
|
|
|
return [self.placeholder_message]
|