Finance: Quick start with pystoxx, rapidapi, ver. 2

Last Updated on August 31, 2021 by shibatau

I.What do you learn?

 

Retrieving current and historical data for Toyota Motor Corporation (TM)) using the PyStoxx and RapidAPI.

You can learn  how to use them here:

 

Stock Data Analysis and Visualization using PyStoxx

 

You can get the sample scripts here: 

 

https://colab.research.google.com/drive/1aoyTUuY1DxHq5aeWZdOZmZWzz6IO7AKu?usp=sharing

 

II.Quick Start

 

1.Install and import PyStoxx

 

pip install pystoxx
from pystoxx import Stoxx
 

 

2.Create a stoxx object and add your API Token

 

stoxx = Stoxx()
stoxx.RapidAPI("add-your-token-here")
 

 

The document liked above tells you to get your token using the RapidAPI. You don’t have to use the RapidAPI but it allows you to get your token that represents all of the APIs you have registered there. It means you can use the same API keys to your projects or applications.

 

III.Creating charts

 

Line chart for Tesla

 

 

IV.Fetch news headlines and URLs

 

You can fetch current and historical news headlines,  their  Urls and evaluations  

 

# fetch current and historical news headlines and urls
stoxx.get_historical_news(ticker=ticker, months=1)
 

 

Show the first four items.

 

[{'FeedUrl': 'https://finance.yahoo.com/news/this-bill-gates-backed-battery-maker-is-on-track-to-do-big-things-for-electric-vehicles-171925284.html?.tsrc=rss',
  'Polarity': 0.21212122,
  'PublishDate': '2021-08-02T17:19:25+00:00',
  'Subjectivity': 0.7777778,
  'Title': 'This Bill Gates-backed battery maker is on track to do big things for electric vehicles: CEO',
  'VaderAggregate': 0.4939,
  'VaderNegative': 0,
  'VaderNeutral': 0.842,
  'VaderPositive': 0.158,
  'id': '924f162a-c359-4e87-ba2f-d5262fb4b8c3'},
 {'FeedUrl': 'https://finance.yahoo.com/news/grab-loss-narrows-food-delivery-143620690.html?.tsrc=rss',
  'Polarity': 0.125,
  'PublishDate': '2021-08-02T14:36:20+00:00',
  'Subjectivity': 0.31666666,
  'Title': 'Grab Loss Narrows on Food Delivery Ahead of U.S. SPAC Merger',
  'VaderAggregate': 0.2006,
  'VaderNegative': 0.066,
  'VaderNeutral': 0.87,
  'VaderPositive': 0.064,
  'id': '3420f2b6-89c4-36eb-a9c9-5c8a39192ab7'},
 {'FeedUrl': 'https://finance.yahoo.com/news/key-factors-shaping-fate-toyotas-114511012.html?.tsrc=rss',
  'Polarity': 0,
  'PublishDate': '2021-08-03T11:45:11+00:00',
  'Subjectivity': 0.525,
  'Title': "Key Factors Shaping the Fate of Toyota's (TM) Q1 Earnings",
  'VaderAggregate': 0,
  'VaderNegative': 0,
  'VaderNeutral': 1,
  'VaderPositive': 0,
  'id': '8fb97fb5-d3d6-300a-8e6b-7b1bacefaf1f'},
 {'FeedUrl': 'https://finance.yahoo.com/m/a327806b-2f31-3a06-b565-7f34e764b5e6/yes%2C-you-can-still-get.html?.tsrc=rss',
  'Polarity': -0.125,
  'PublishDate': '2021-08-03T09:05:00+00:00',
  'Subjectivity': 0.375,
  'Title': 'Yes, you can still get electric vehicle tax credits — here’s a guide',
  'VaderAggregate': 0.1285,
  'VaderNegative': 0.079,
  'VaderNeutral': 0.824,
  'VaderPositive': 0.097,
  'id': 'a327806b-2f31-3a06-b565-7f34e764b5e6'},

 

Not completed.

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.