1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add Yahoo Finance module (#1066)

* Move finnhub to a stocks folder

As I am preparing an other stocks data provider, let's move `finnhub` to
a stocks folder that will host the others providers.

* Use go-pretty v6

Will be used by the new stock provider module, so let's just upgrade
this one to reduce the number of dependencies.

* Add Yahoo Finance module

Yahoo Finance provides an API for which `piquette/finance-go` is a
powerful client. This new module leverages this module to integrate all
indices provided by Yahoo Finance (international stocks, crypto,
options, currencies...)

Sample config:
```yaml
    yfinance:
      title: "Stocks 🚀"
      symbols:
        - "MSFT"
        - "GC=F"
        - "ORA.PA"
      sort: true
      enabled: true
      refreshInterval: 60
      position:
        top: 1
        left: 0
        height: 1
        width: 1
```
This commit is contained in:
Antoine Meillet
2021-03-27 21:42:28 +01:00
committed by GitHub
parent ac0aafc04d
commit 9fb57845ed
10 changed files with 284 additions and 19 deletions

View File

@@ -25,7 +25,6 @@ import (
"github.com/wtfutil/wtf/modules/docker"
"github.com/wtfutil/wtf/modules/exchangerates"
"github.com/wtfutil/wtf/modules/feedreader"
"github.com/wtfutil/wtf/modules/finnhub"
"github.com/wtfutil/wtf/modules/football"
"github.com/wtfutil/wtf/modules/gcal"
"github.com/wtfutil/wtf/modules/gerrit"
@@ -62,6 +61,8 @@ import (
"github.com/wtfutil/wtf/modules/spotify"
"github.com/wtfutil/wtf/modules/spotifyweb"
"github.com/wtfutil/wtf/modules/status"
"github.com/wtfutil/wtf/modules/stocks/finnhub"
"github.com/wtfutil/wtf/modules/stocks/yfinance"
"github.com/wtfutil/wtf/modules/subreddit"
"github.com/wtfutil/wtf/modules/textfile"
"github.com/wtfutil/wtf/modules/todo"
@@ -332,6 +333,9 @@ func MakeWidget(
case "finnhub":
settings := finnhub.NewSettingsFromYAML(moduleName, moduleConfig, config)
widget = finnhub.NewWidget(tviewApp, settings)
case "yfinance":
settings := yfinance.NewSettingsFromYAML(moduleName, moduleConfig, config)
widget = yfinance.NewWidget(tviewApp, settings)
default:
settings := unknown.NewSettingsFromYAML(moduleName, moduleConfig, config)
widget = unknown.NewWidget(tviewApp, settings)