From 139a0415826e948f685aa13e8d029c02e199fc24 Mon Sep 17 00:00:00 2001 From: Arthur Levitan <1@levitan.su> Date: Wed, 11 Jan 2023 20:28:12 +0300 Subject: [PATCH] v1.1.0-beta.1 --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ tradingview.go | 3 +-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 991e542..1611a74 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,53 @@ # go-tradingview-ta [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) An unofficial Go API simple wrapper to retrieve technical analysis from TradingView. +## Example +```go +package main + +import ( + "fmt" + + tradingview "github.com/artlevitan/go-tradingview-ta" +) + +func main() { + var tv tradingview.TVData + err := tv.Get("BINANCE:BTCUSDT", tradingview.Interval4hour) + if err != nil { + fmt.Println(err) + } + fmt.Printf("%#v\n", tv) // Full Data + + // Get the value by key + recSummary := tv.Recommend.Summary // Summary + fmt.Println(recSummary) + + recOsc := tv.Recommend.Oscillators // Oscillators + fmt.Println(recOsc) + + recMA := tv.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") + } +} + +``` + ## License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/tradingview.go b/tradingview.go index 48dc9b7..bd83d08 100644 --- a/tradingview.go +++ b/tradingview.go @@ -1,7 +1,6 @@ // Copyright 2022-2023. All rights reserved. // https://github.com/artlevitan/go-tradingview-ta -// 1.1.0 -// License: MIT +// v1.1.0-beta.1 package tradingview