Skip to content

copypasteearth/stock_sentiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stock_sentiment

A package to get stock sentiment from headlines.

Getting Started

dependencies:
  stock_sentiment: ^0.0.5

code quick example

// @dart=2.9
/// import the stock sentiment package
import 'package:stock_sentiment/stock_sentiment.dart';

/// main() example
void main() {
  var sentiment = StockSentiment("GOOG ?jO+");
  /// get headlines for 8 days
  try{
    sentiment.getHeadlines(8).then((value) {

      print(value);
      /// get the sentiment for each day
      var stuff = sentiment.getDailySentiment(value);
      print(stuff);
      /// get a single headline sentiment
      var single = sentiment.getSingleSentiment(value["GOOG"][0].text);

      print(single);
      /// this will be null
      print(value["?jO+"]);

    });
  }catch(e){
    print(e);
  }


}

functions

Future<Map<String,List<Headline>>> getHeadlines(int days) async
Map<String,Map<DateTime,SentimentResult>>? getDailySentiment(Map<String,List<Headline>> map)
Map<String,dynamic> getSingleSentiment(String text)

classes

//a stock sentiment with String tickers, each seperated with space.
StockSentiment(String tickers)
//average sentiment, number of positive, negative, and neutral headlines
SentimentResult(double average, int positive,int negative,int neutral)
//Headline date, text, link, and extract
Headline(DateTime date, String text, String link, String extract)

uses and licenses

Buckthorn Dev sentiment_dart: ^0.0.4 (MIT)

the Dart project authors. http: ^0.13.3 (BSD)

the Dart project authors. intl: ^0.17.0 (BSD)

html: ^0.15.0 (MIT)

html Contributors:

James Graham - [email protected]

Anne van Kesteren - [email protected]

Lachlan Hunt - [email protected]

Matt McDonald - [email protected]

Sam Ruby - [email protected]

Ian Hickson (Google) - [email protected]

Thomas Broyer - [email protected]

Jacques Distler - [email protected]

Henri Sivonen - [email protected]

Adam Barth - [email protected]

Eric Seidel - [email protected]

The Mozilla Foundation (contributions from Henri Sivonen since 2008)

David Flanagan (Mozilla) - [email protected]

Google Inc. (contributed the Dart port) - [email protected]

donate to buy this developer a cup of coffee

Donate

About

Stock Sentiment Dart package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages