mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'jeangovil-bittrex'
This commit is contained in:
commit
23e85f3dc9
85
_site/content/posts/modules/cryptocurrencies/bittrex.md
Normal file
85
_site/content/posts/modules/cryptocurrencies/bittrex.md
Normal file
@ -0,0 +1,85 @@
|
||||
---
|
||||
title: "Bittrex"
|
||||
date: 2018-06-04T20:06:40-07:00
|
||||
draft: false
|
||||
---
|
||||
|
||||
Added in `v0.0.5`.
|
||||
|
||||
Get the last 24 hour summary of cryptocurrencies market using [Bittrex](https://bittrex.com).
|
||||
|
||||
## Source Code
|
||||
|
||||
```bash
|
||||
wtf/cryptoexchanges/bittrex/
|
||||
```
|
||||
|
||||
## Required ENV Vars
|
||||
|
||||
None.
|
||||
|
||||
## Keyboard Commands
|
||||
|
||||
None.
|
||||
|
||||
## Configuration
|
||||
|
||||
```yaml
|
||||
bittrex:
|
||||
enabled: true
|
||||
position:
|
||||
top: 1
|
||||
left: 2
|
||||
height: 3
|
||||
width: 1
|
||||
refreshInterval: 5
|
||||
summary:
|
||||
BTC:
|
||||
displayName: Bitcoin
|
||||
market:
|
||||
- LTC
|
||||
- ETH
|
||||
colors:
|
||||
base:
|
||||
name: orange
|
||||
displayName: red
|
||||
market:
|
||||
name: red
|
||||
field: white
|
||||
value: green
|
||||
```
|
||||
|
||||
### Attributes
|
||||
|
||||
`colors.base.name` <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11
|
||||
color name</a>.
|
||||
|
||||
`colors.base.dispayName` <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11
|
||||
color name</a>.
|
||||
|
||||
`colors.market.name` <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11
|
||||
color name</a>.
|
||||
|
||||
`colors.market.field` <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11
|
||||
color name</a>.
|
||||
|
||||
`colors.market.value` <br />
|
||||
Values: Any <a href="https://en.wikipedia.org/wiki/X11_color_names">X11
|
||||
color name</a>.
|
||||
|
||||
`summary` <br />
|
||||
|
||||
`enabled` <br />
|
||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||
Values: `true`, `false`.
|
||||
|
||||
`position` <br />
|
||||
Defines where in the grid this module's widget will be displayed. <br />
|
||||
|
||||
`refreshInterval` <br />
|
||||
How often, in seconds, this module will update its data. <br />
|
||||
Values: A positive integer, `0..n`.
|
49
cryptoexchanges/bittrex/bittrex.go
Normal file
49
cryptoexchanges/bittrex/bittrex.go
Normal file
@ -0,0 +1,49 @@
|
||||
package bittrex
|
||||
|
||||
type summaryList struct {
|
||||
items []*bCurrency
|
||||
}
|
||||
|
||||
// Base Currency
|
||||
type bCurrency struct {
|
||||
name string
|
||||
displayName string
|
||||
markets []*mCurrency
|
||||
}
|
||||
|
||||
// Market Currency
|
||||
type mCurrency struct {
|
||||
name string
|
||||
summaryInfo
|
||||
}
|
||||
|
||||
type summaryInfo struct {
|
||||
Low string
|
||||
High string
|
||||
Volume string
|
||||
Last string
|
||||
OpenSellOrders string
|
||||
OpenBuyOrders string
|
||||
}
|
||||
|
||||
type summaryResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
Result []struct {
|
||||
MarketName string `json:"MarketName"`
|
||||
High float64 `json:"High"`
|
||||
Low float64 `json:"Low"`
|
||||
Last float64 `json:"Last"`
|
||||
Volume float64 `json:"Volume"`
|
||||
OpenSellOrders int `json:"OpenSellOrders"`
|
||||
OpenBuyOrders int `json:"OpenBuyOrders"`
|
||||
} `json:"result"`
|
||||
}
|
||||
|
||||
func (list *summaryList) addSummaryItem(name, displayName string, marketList []*mCurrency) {
|
||||
list.items = append(list.items, &bCurrency{
|
||||
name: name,
|
||||
displayName: displayName,
|
||||
markets: marketList,
|
||||
})
|
||||
}
|
67
cryptoexchanges/bittrex/display.go
Normal file
67
cryptoexchanges/bittrex/display.go
Normal file
@ -0,0 +1,67 @@
|
||||
package bittrex
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
if ok == false {
|
||||
widget.View.SetText(fmt.Sprintf("%s", errorText))
|
||||
return
|
||||
}
|
||||
|
||||
str := ""
|
||||
str += summaryText(&widget.summaryList, &widget.TextColors)
|
||||
|
||||
widget.View.SetText(fmt.Sprintf("%s", str))
|
||||
}
|
||||
|
||||
func summaryText(list *summaryList, colors *TextColors) string {
|
||||
str := ""
|
||||
|
||||
for _, baseCurrency := range list.items {
|
||||
str += fmt.Sprintf(" [%s]%s[%s] (%s)\n\n", colors.base.displayName, baseCurrency.displayName, colors.base.name, baseCurrency.name)
|
||||
|
||||
resultTemplate := template.New("bittrex")
|
||||
|
||||
for _, marketCurrency := range baseCurrency.markets {
|
||||
writer := new(bytes.Buffer)
|
||||
|
||||
strTemplate, _ := resultTemplate.Parse(
|
||||
" [{{.nameColor}}]{{.mName}}\n" +
|
||||
formatableText("High", "High") +
|
||||
formatableText("Low", "Low") +
|
||||
formatableText("Last", "Last") +
|
||||
formatableText("Volume", "Volume") +
|
||||
"\n" +
|
||||
formatableText("Open Buy", "OpenBuyOrders") +
|
||||
formatableText("Open Sell", "OpenSellOrders"),
|
||||
)
|
||||
|
||||
strTemplate.Execute(writer, map[string]string{
|
||||
"nameColor": colors.market.name,
|
||||
"fieldColor": colors.market.field,
|
||||
"valueColor": colors.market.value,
|
||||
"mName": marketCurrency.name,
|
||||
"High": marketCurrency.High,
|
||||
"Low": marketCurrency.Low,
|
||||
"Last": marketCurrency.Last,
|
||||
"Volume": marketCurrency.Volume,
|
||||
"OpenBuyOrders": marketCurrency.OpenBuyOrders,
|
||||
"OpenSellOrders": marketCurrency.OpenSellOrders,
|
||||
})
|
||||
|
||||
str += writer.String() + "\n"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return str
|
||||
|
||||
}
|
||||
|
||||
func formatableText(key, value string) string {
|
||||
return fmt.Sprintf("[{{.fieldColor}}]%12s: [{{.valueColor}}]{{.%s}}\n", key, value)
|
||||
}
|
190
cryptoexchanges/bittrex/widget.go
Normal file
190
cryptoexchanges/bittrex/widget.go
Normal file
@ -0,0 +1,190 @@
|
||||
package bittrex
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"net/http"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
type TextColors struct {
|
||||
base struct {
|
||||
name string
|
||||
displayName string
|
||||
}
|
||||
market struct {
|
||||
name string
|
||||
field string
|
||||
value string
|
||||
}
|
||||
}
|
||||
|
||||
var ok = true
|
||||
var errorText = ""
|
||||
var started = false
|
||||
var baseURL = "https://bittrex.com/api/v1.1/public/getmarketsummary"
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
summaryList
|
||||
TextColors
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget() *Widget {
|
||||
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(" Bittrex ", "bittrex", false),
|
||||
summaryList: summaryList{},
|
||||
}
|
||||
|
||||
started = false
|
||||
ok = true
|
||||
errorText = ""
|
||||
|
||||
widget.config()
|
||||
widget.setSummaryList()
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
func (widget *Widget) config() {
|
||||
widget.TextColors.base.name = Config.UString("wtf.mods.bittrex.colors.base.name", "red")
|
||||
widget.TextColors.base.displayName = Config.UString("wtf.mods.bittrex.colors.base.displayName", "grey")
|
||||
widget.TextColors.market.name = Config.UString("wtf.mods.bittrex.colors.market.name", "red")
|
||||
widget.TextColors.market.field = Config.UString("wtf.mods.bittrex.colors.market.field", "coral")
|
||||
widget.TextColors.market.value = Config.UString("wtf.mods.bittrex.colors.market.value", "white")
|
||||
}
|
||||
|
||||
func (widget *Widget) setSummaryList() {
|
||||
sCurrencies, _ := Config.Map("wtf.mods.bittrex.summary")
|
||||
for baseCurrencyName := range sCurrencies {
|
||||
displayName, _ := Config.String("wtf.mods.bittrex.summary." + baseCurrencyName + ".displayName")
|
||||
mCurrencyList := makeSummaryMarketList(baseCurrencyName)
|
||||
widget.summaryList.addSummaryItem(baseCurrencyName, displayName, mCurrencyList)
|
||||
}
|
||||
}
|
||||
|
||||
func makeSummaryMarketList(currencyName string) []*mCurrency {
|
||||
mCurrencyList := []*mCurrency{}
|
||||
|
||||
configMarketList, _ := Config.List("wtf.mods.bittrex.summary." + currencyName + ".market")
|
||||
for _, mCurrencyName := range configMarketList {
|
||||
mCurrencyList = append(mCurrencyList, makeMarketCurrency(mCurrencyName.(string)))
|
||||
}
|
||||
|
||||
return mCurrencyList
|
||||
}
|
||||
|
||||
func makeMarketCurrency(name string) *mCurrency {
|
||||
return &mCurrency{
|
||||
name: name,
|
||||
summaryInfo: summaryInfo{
|
||||
High: "",
|
||||
Low: "",
|
||||
Volume: "",
|
||||
Last: "",
|
||||
OpenBuyOrders: "",
|
||||
OpenSellOrders: "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
// Refresh & update after interval time
|
||||
func (widget *Widget) Refresh() {
|
||||
if widget.Disabled() {
|
||||
return
|
||||
}
|
||||
|
||||
if started == false {
|
||||
go func() {
|
||||
for {
|
||||
widget.updateSummary()
|
||||
time.Sleep(time.Second * time.Duration(widget.RefreshInterval()))
|
||||
}
|
||||
}()
|
||||
started = true
|
||||
}
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
|
||||
widget.display()
|
||||
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) updateSummary() {
|
||||
// In case if anything bad happened!
|
||||
defer func() {
|
||||
recover()
|
||||
}()
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: time.Duration(5 * time.Second),
|
||||
}
|
||||
|
||||
for _, baseCurrency := range widget.summaryList.items {
|
||||
for _, mCurrency := range baseCurrency.markets {
|
||||
request := makeRequest(baseCurrency.name, mCurrency.name)
|
||||
response, err := client.Do(request)
|
||||
|
||||
if err != nil {
|
||||
ok = false
|
||||
errorText = "Please Check Your Internet Connection!"
|
||||
break
|
||||
} else {
|
||||
ok = true
|
||||
errorText = ""
|
||||
}
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
errorText = response.Status
|
||||
ok = false
|
||||
break
|
||||
} else {
|
||||
ok = true
|
||||
errorText = ""
|
||||
}
|
||||
|
||||
defer response.Body.Close()
|
||||
jsonResponse := summaryResponse{}
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
decoder.Decode(&jsonResponse)
|
||||
|
||||
if !jsonResponse.Success {
|
||||
ok = false
|
||||
errorText = fmt.Sprintf("%s-%s: %s", baseCurrency.name, mCurrency.name, jsonResponse.Message)
|
||||
break
|
||||
}
|
||||
ok = true
|
||||
errorText = ""
|
||||
|
||||
mCurrency.Last = fmt.Sprintf("%f", jsonResponse.Result[0].Last)
|
||||
mCurrency.High = fmt.Sprintf("%f", jsonResponse.Result[0].High)
|
||||
mCurrency.Low = fmt.Sprintf("%f", jsonResponse.Result[0].Low)
|
||||
mCurrency.Volume = fmt.Sprintf("%f", jsonResponse.Result[0].Volume)
|
||||
mCurrency.OpenBuyOrders = fmt.Sprintf("%d", jsonResponse.Result[0].OpenBuyOrders)
|
||||
mCurrency.OpenSellOrders = fmt.Sprintf("%d", jsonResponse.Result[0].OpenSellOrders)
|
||||
}
|
||||
}
|
||||
|
||||
widget.display()
|
||||
}
|
||||
|
||||
func makeRequest(baseName, marketName string) *http.Request {
|
||||
url := fmt.Sprintf("%s?market=%s-%s", baseURL, baseName, marketName)
|
||||
request, _ := http.NewRequest("GET", url, nil)
|
||||
|
||||
return request
|
||||
}
|
243
docs/posts/modules/bittrex/index.html
Normal file
243
docs/posts/modules/bittrex/index.html
Normal file
@ -0,0 +1,243 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us" class="wf-firasans-n4-active wf-active">
|
||||
|
||||
<head>
|
||||
<link href="http://gmpg.org/xfn/11" rel="profile">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<!-- Enable responsiveness on mobile devices -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
|
||||
<meta name="generator" content="Hugo 0.38.2" />
|
||||
|
||||
<title>Module: Bittrex | WTF - A Terminal Dashboard</title>
|
||||
<meta content="Module: Bittrex - WTF - A Terminal Dashboard" property="og:title">
|
||||
<meta content=" - " property="og:description">
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i|Roboto+Mono:300,300i,400,400i" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/print.css" media="print">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/poole.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/hyde.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/syntax.css">
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/wtf.css">
|
||||
<!-- Font-Awesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.9/js/all.js" integrity="sha384-8iPTk2s/jMVj81dnzb/iFR2sdA7u06vHJyyLlAd4snFpCl/SnyUjRrbdJsw1pGIl"
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Customised CSS -->
|
||||
<link rel="stylesheet" href="https://wtfutil.com/css/custom.css">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Icons -->
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
|
||||
<link rel="shortcut icon" href="/favicon.png">
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="container">
|
||||
<div class="sidebar-about text-center">
|
||||
|
||||
<a href="https://wtfutil.com/">
|
||||
<img src="/img/wtf.png" alt="WFT Logo" class="" width=""> </a>
|
||||
<p class="lead">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 style="color: white;">Content</h3>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1">
|
||||
<a href="/posts/overview/">Overview</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-1">
|
||||
<a href="/posts/installation/">Installation</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-1">
|
||||
<a href="/posts/configuration/">Configuration</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/configuration/attributes/">Attributes</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/configuration/iterm2/">iTerm2</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-1">
|
||||
<a href="https://github.com/senorprogrammer/wtf/releases">Releases</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li class="sidebar-list-item-1">
|
||||
<a href="/posts/modules/">Modules</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/bamboohr/">BambooHR</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/bittrex/">Bittrex</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/clocks/">Clocks</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/cmdrunner/">CmdRunner</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/cryptolive/">CryptoLive</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/git/">Git</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/github/">Github</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/gcal/">Google Calendar</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/ipinfo/">IPInfo</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/jira/">Jira</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/newrelic/">New Relic</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/opsgenie/">OpsGenie</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/power/">Power</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/security/">Security</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/textfile/">Text File</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/todo/">Todo</a>
|
||||
</li>
|
||||
<li class="sidebar-list-item-2">
|
||||
<a href="/posts/modules/weather/">Weather</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p class="copyright">
|
||||
© 2018 Chris Cummer.
|
||||
<br />
|
||||
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content container">
|
||||
<div class="post">
|
||||
<h1>Module: Bittrex</h1>
|
||||
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<span class="text-left post-date meta">
|
||||
|
||||
Jun 04, 2018
|
||||
|
||||
<br/>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p>Get the last 24 hour summary of cryptocurrencies market.</p>
|
||||
|
||||
<h2 id="source-code">Source Code</h2>
|
||||
<div class="highlight">
|
||||
<pre class="chroma"><code class="language-bash" data-lang="bash">wtf/bittrex/</code></pre>
|
||||
</div>
|
||||
<h2 id="required-env-variables">Required ENV Variables</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="keyboard-commands">Keyboard Commands</h2>
|
||||
|
||||
<p>None.</p>
|
||||
|
||||
<h2 id="configuration">Configuration</h2>
|
||||
<div class="highlight">
|
||||
<pre class="chroma"><code class="language-yaml" data-lang="yaml">bittrex<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>enabled<span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
|
||||
</span><span class="w"> </span>position<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>top<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>left<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
|
||||
</span><span class="w"> </span>height<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
|
||||
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">15</span><span class="w">
|
||||
</span><span class="w"> </span>summary<span class="p">:</span><span class="w"> </span><span class="w">
|
||||
</span><span class="w"> </span>BTC<span class="p">:</span><span class="w">
|
||||
</span><span class="w"> </span>displayName<span class="p">:</span><span class="w"> </span><span class="m">Bitcoin</span><span class="w">
|
||||
</span><span class="w"> </span>market<span class="p">:</span><span class="w"> </span><span class="w">
|
||||
</span><span class="w"> - </span>ETH<span class="p"></span><span class="w">
|
||||
</span><span class="w"> - </span>LTC<span class="p"></span><span class="w">
|
||||
</span><span class="w"> </span>ETH<span class="p"></span>:<span class="w">
|
||||
</span><span class="w"> </span>displayName<span class="p">: </span>Ethereum<span class="w">
|
||||
</span><span class="w"> </span>market<span class="p">: </span><span class="w">
|
||||
</span><span class="w"> - </span>LTC<span class="p"></span><span class="w">
|
||||
</span><span class="w"> </span>colors<span class="p"></span>: <span class="w">
|
||||
</span><span class="w"> </span>base<span class="p"></span>: <span class="w">
|
||||
</span><span class="w"> </span>name<span class="p"></span>: red<span class="w">
|
||||
</span><span class="w"> </span>displayName<span class="p"></span>: grey<span class="w">
|
||||
</span><span class="w"> </span>market<span class="p"></span>:<span class="w">
|
||||
</span><span class="w"> </span>name<span class="p"></span>: red<span class="w">
|
||||
</span><span class="w"> </span>field<span class="p"></span>: coral<span class="w">
|
||||
</span><span class="w"> </span>value<span class="p"></span>: white<span class="w">
|
||||
</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<h3 id="attributes">Attributes</h3>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<code>enabled</code>
|
||||
<br /> Determines whether or not this module is executed and if its data displayed onscreen.
|
||||
<br /> Values:
|
||||
<code>true</code>,
|
||||
<code>false</code>.</p>
|
||||
|
||||
<p>
|
||||
<code>position</code>
|
||||
<br /> Defines where in the grid this module’s widget will be displayed.
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>updateInterval</code>
|
||||
<br /> How often, in seconds, this module will update its data.
|
||||
<br /> Values: A positive integer
|
||||
<br/> Default Value: 10</p>
|
||||
|
||||
<p>
|
||||
<code>colors</code>
|
||||
<br /> Sets color of texts.
|
||||
<br /> Values: A valid color
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
6
wtf.go
6
wtf.go
@ -13,6 +13,7 @@ import (
|
||||
"github.com/senorprogrammer/wtf/bamboohr"
|
||||
"github.com/senorprogrammer/wtf/clocks"
|
||||
"github.com/senorprogrammer/wtf/cmdrunner"
|
||||
"github.com/senorprogrammer/wtf/cryptoexchanges/bittrex"
|
||||
"github.com/senorprogrammer/wtf/cryptoexchanges/cryptolive"
|
||||
"github.com/senorprogrammer/wtf/gcal"
|
||||
"github.com/senorprogrammer/wtf/git"
|
||||
@ -177,6 +178,8 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) {
|
||||
todo.Config = Config
|
||||
weather.Config = Config
|
||||
wtf.Config = Config
|
||||
cryptolive.Config = Config
|
||||
bittrex.Config = Config
|
||||
|
||||
// Always in alphabetical order
|
||||
Widgets = []wtf.Wtfable{
|
||||
@ -199,6 +202,9 @@ func makeWidgets(app *tview.Application, pages *tview.Pages) {
|
||||
textfile.NewWidget(app, pages),
|
||||
todo.NewWidget(app, pages),
|
||||
weather.NewWidget(app, pages),
|
||||
cryptolive.NewWidget(),
|
||||
prettyweather.NewWidget(),
|
||||
bittrex.NewWidget(),
|
||||
}
|
||||
|
||||
FocusTracker = wtf.FocusTracker{
|
||||
|
Loading…
x
Reference in New Issue
Block a user