ProsperBot is meant as a easy utility for Discord for getting market data.
Though prosperbot is designed for Prosper stuff, there's nothing stopping others from putting their own bot token and running a version of prosperbot on thier own.
Installing Prosper Bot
ProsperBot is written in python3.5 and uses Discord.py for its bot functionality
- tinyDB as a cache layer
- pandas_datareader for fetching stock quotes
- demjson for formatting Google "json"
- ujson as speed-up for tinyDB and json replacement
- NLTK for sentiment analysis
- requests for generic HTTP fetching
- ProsperCommon for logging/config
virtualenv -p python3 venv_prosperbot
- activate virtualenv
pip install -r bot_requirements.txt
prosperbot_config.cfgis tracked by git. To fill out secrets copy to
prosperbot_config_local.cfgand complete configuration
- ProsperBot has been tested to work on Windows and Ubuntu16
Prosper Bot Functions
ProsperBot comes with a wide array of functions using the
!who [ticker] [please (OPTIONAL)]
!who is for translating stock ticker/symbol to its common/company name.
!who responses are cached in tinyDB for 30 days. This makes responses extremely snappy when looking up company names (both as
!who and other funcs that need the information).
To clear/refresh the cache, use the keyword
please in your request and the company name will be fetched again on the yahoo endpoint.
!price [ticker] [please (OPTIONAL)]
!price returns a summary of the current price of a stock. This endpoint is furnished by yahoo through
!price also hits the following sub functions directly:
!whofor company name (
!newsfor "most relevant article" (
The !news endpoint uses the
pct_change statistic to try and find a "positive" or "negative" article to explain the price movement of the day.
TODO: add image of return?
!news [ticker] [+/- (OPTIONAL)]
!news endpoint hits the Google Finance endpoint to get the relevant articles for a given ticker.
The Google Finance endpoint .json does not return valid JSON, and can only be parsed with
Google Finance endpoint returns 10-15 articles in a query. To grade these responses,
NLTK is run over the headlines to asses them as positive or negative. Then using the
pct_change of a quote, select the "best" or "worst" outlook to match the direction of the stock.
If the call is neutral, both the best/worst articles will be returned with their sentiment scores.
!news uses the vader_lexicon to grade headlines of articles. The best article is picked off the
polarity_scores['compound'] values. First found result wins in a tie.
Links are returned with their sentiment score
!quote [ticker] [range=30] [please (OPTIONAL)]
!quote is meant to give a bigger picture of a stock. Where
!price tells the one-day view,
!quote returns a graph of the stock performance so far