Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
artlevitan committed Oct 24, 2023
1 parent e7e5796 commit 52395a8
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,44 @@ const (
package main

import (
"fmt"
"fmt"

tradingview "github.com/artlevitan/go-tradingview-ta"
tradingview "github.com/artlevitan/go-tradingview-ta"
)

func main() {
var ta tradingview.TradingView
err := ta.Get("BINANCE:BTCUSDT", tradingview.Interval4hour)
if err != nil {
fmt.Println(err)
}
fmt.Printf("%#v\n", ta) // Full Data

// Get the value by key
recSummary := ta.Recommend.Summary // Summary
fmt.Println(recSummary)

recOsc := ta.Recommend.Oscillators // Oscillators
fmt.Println(recOsc)

recMA := ta.Recommend.MA // Moving Averages
fmt.Println(recMA)

// Text recommendation
switch recSummary {
case tradingview.SignalStrongSell:
fmt.Println("STRONG_SELL")
case tradingview.SignalSell:
fmt.Println("SELL")
case tradingview.SignalNeutral:
fmt.Println("NEUTRAL")
case tradingview.SignalBuy:
fmt.Println("BUY")
case tradingview.SignalStrongBuy:
fmt.Println("STRONG_BUY")
default:
fmt.Println("An error has occurred")
}
var ta tradingview.TradingView
err := ta.Get("BINANCE:BTCUSDT", tradingview.Interval4hour)
if err != nil {
fmt.Println(err)
}
fmt.Printf("%#v\n", ta) // Full Data

// Get the value by key
recSummary := ta.Recommend.Summary // Summary
fmt.Println(recSummary)

recOsc := ta.Recommend.Oscillators // Oscillators
fmt.Println(recOsc)

recMA := ta.Recommend.MA // Moving Averages
fmt.Println(recMA)

// Text recommendation
switch recSummary {
case tradingview.SignalStrongSell:
fmt.Println("STRONG_SELL")
case tradingview.SignalSell:
fmt.Println("SELL")
case tradingview.SignalNeutral:
fmt.Println("NEUTRAL")
case tradingview.SignalBuy:
fmt.Println("BUY")
case tradingview.SignalStrongBuy:
fmt.Println("STRONG_BUY")
default:
fmt.Println("An error has occurred")
}
}

```
Expand Down

0 comments on commit 52395a8

Please sign in to comment.