Skip to main content

A small sentiment analysis library for bitcoin

Project description

btc-sentiment-analysis

Small Python package for gathering news articles and performing basic bitcoin sentiment analysis.

Installation

Use the package manager pip to install btc-sentiment-analysis.

pip install btc-sentiment-analysis

Usage

This python package contains python scripts for gathering news articles on the topic "Bitcoin." An XML file provided by a Google news RSS Feed, is parsed for all published news articles on "Bitcoin." The urls of the published articles are visited and scraped for all usable content such as title, article, published date, etc.

from btc_sentiment_analysis import scrape_btc_news, visualize

articles = scrape_btc_news() # returns a list of Article objects
visualize(articles) # receives list of Article objects as an argument, displays simple seaborn violin plot

The function scrape_btc_news() crawls for BTC articles on the web, scrapes important information, and creates Article objects for each news Article. Article objects contain attributes such as title, text, news source, publication date, and link. Article objects also contain two methods. The vader_analysis method uses the Natural Language Toolkit (nltk) library to return the sentiment of the title and text of the article as a dict type. The blob_analysis method uses the Text Blob (textblob) library to return the sentiment of the title and text of the article as a dict type.

class Article:

	def __init__(self, title, source, date, link, text):
		...

	def vader_analysis(self):
		...
		return {'title': title_sentiment, 'text': text_sentiment}

	def blob_analysis(self):
		...
		return {'title': title_sentiment, 'text': text_sentiment}

The function visualize simply plots an example Violin Plot using seaborn. Visualize takes any list of Article objects and returns a seaborn violin plot showing the distribution of the sentiment analysis for Article.title and Article.text using nltk's Vader, and Text Blob.

Bitcoin_Violin_Plot

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btc-sentiment-analysis-0.0.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

btc_sentiment_analysis-0.0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file btc-sentiment-analysis-0.0.2.tar.gz.

File metadata

  • Download URL: btc-sentiment-analysis-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.3

File hashes

Hashes for btc-sentiment-analysis-0.0.2.tar.gz
Algorithm Hash digest
SHA256 17419bb6d0c31f7cabb75650a3d411ba42baed058cca9796a705ced24a04c585
MD5 89e13a121d76fb3f510529ae82c940de
BLAKE2b-256 4f7a7eea20ec3eee34d7334ed5e8ac6ceed5ba6e830a150dd51fab5266d3f1cc

See more details on using hashes here.

File details

Details for the file btc_sentiment_analysis-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: btc_sentiment_analysis-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.3

File hashes

Hashes for btc_sentiment_analysis-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa152bf8f6d1921814c343198aabf82b8a919784f803b083c572e93bd652f79d
MD5 285a245b0516f1020be91b841be8b301
BLAKE2b-256 d1582cf57b48914b56b9a4a8b31421897d0c7021d4dd78b4ade53f7dc08ecd44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page