tvscanner

package
v0.0.0-...-b99aa39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 10 Imported by: 0

README

go-tvscanner

TradingView scanner api client

Thx to :

Usage

package main

import (
	scanner "github.com/bluejedi/go-tvscanner"

	"fmt"
)


func main() {
	fmt.Println("Starting")
	cl := scanner.New()
	cl.GetAnalysis("crypto", "BITTREX", "BTCUSD", "1h")
}

Documentation

Index

Constants

View Source
const (
	Buy        = "BUY"
	StrongBuy  = "STRONG_BUY"
	Sell       = "SELL"
	StrongSell = "STRONG_SELL"
	Neutral    = "NEUTRAL"
	Error      = "ERROR"
)
View Source
const (
	API_URL          = "https://scanner.tradingview.com/"
	DEFAULT_SCREENER = "crypto"
	API_POSTFIX      = "scan"
	//
	INTERVAL_1_MINUTE   = "1m"
	INTERVAL_5_MINUTES  = "5m"
	INTERVAL_15_MINUTES = "15m"
	INTERVAL_1_HOUR     = "1h"
	INTERVAL_4_HOURS    = "4h"
	INTERVAL_1_DAY      = "1d"
	INTERVAL_1_WEEK     = "1W"
	INTERVAL_1_MONTH    = "1M"
)

Variables

View Source
var (
	ContextLogger = logrus.WithFields(logrus.Fields{
		"client_name": "tvscanner",
	})
)

Functions

func NewClient

func NewClient() (c *client)

NewClient return a new Scanner HTTP client

func NewClientWithCustomHttpConfig

func NewClientWithCustomHttpConfig(httpClient *http.Client) (c *client)

NewClientWithCustomHttpConfig returns a new Scanner HTTP client using the predefined http client

Types

type Data

type Data struct {
	Symbols struct {
		Tickers []string `json:"tickers"`
		Query   struct {
			Types []string `json:"types"`
		} `json:"query"`
	} `json:"symbols"`
	Columns []string `json:"columns"`
}

type DataResponse

type DataResponse struct {
	Data []struct {
		Symbol string    `json:"s"`
		Data   []float64 `json:"d"`
	} `json:"data"`
	TotalCount int `json:"totalCount"`
}

type Recommend

type Recommend struct {
	Summary        string
	Oscillators    string
	MovingAverages string
}

type RecommendSummary

type RecommendSummary struct {
	Recommend    Recommend
	BuyCount     int
	SellCount    int
	NeutralCount int
	Ocsillators  DataResponse
	Pivot        DataResponse
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner represent a Scanner client

func New

func New() *Scanner

New returns an instantiated Scanner struct

func NewWithCustomHttpClient

func NewWithCustomHttpClient(httpClient *http.Client) *Scanner

NewWithCustomHttpClient returns an instantiated Scanner struct with custom http client

func (*Scanner) ComputeADX

func (c *Scanner) ComputeADX(adx, adxpdi, adxndi, adxpdi1, adxndi1 float64) string

ComputeADX

func (*Scanner) ComputeAO

func (c *Scanner) ComputeAO(ao, ao1 float64) string

ComputeAO

func (*Scanner) ComputeBBBuy

func (c *Scanner) ComputeBBBuy(close, bblower float64) string

ComputeBBBuy

func (*Scanner) ComputeBBSell

func (c *Scanner) ComputeBBSell(close, bbupper float64) string

ComputeBBSell

func (*Scanner) ComputeCCI20

func (c *Scanner) ComputeCCI20(cci20, cci201 float64) string

ComputeCCI20

func (*Scanner) ComputeMA

func (c *Scanner) ComputeMA(ma, close float64) string

ComputeMA

func (*Scanner) ComputeMACD

func (c *Scanner) ComputeMACD(macd, signal float64) string

ComputeMACD

func (*Scanner) ComputeMOM

func (c *Scanner) ComputeMOM(mom, mom1 float64) string

ComputeMOM

func (*Scanner) ComputePSAR

func (c *Scanner) ComputePSAR(psar, open float64) string

ComputePSAR

func (*Scanner) ComputeRSI

func (c *Scanner) ComputeRSI(rsi, rsi1 float64) string

ComputeRSI

func (*Scanner) ComputeRecommend

func (c *Scanner) ComputeRecommend(value float64) (string, error)

ComputeRecommend return "STRONG_BUY", "BUY", "NEUTRAL", "SELL", "STRONG_SELL", or "ERROR"

func (*Scanner) ComputeSimple

func (c *Scanner) ComputeSimple(value float64) string

ComputeSimple return "BUY", "SELL", or "NEUTRAL"

func (*Scanner) ComputeStoch

func (c *Scanner) ComputeStoch(k, d, k1, d1 float64) string

ComputeStoch

func (*Scanner) GetAnalysis

func (c *Scanner) GetAnalysis(screener, exchange, symbol, interval string) (RecommendSummary, error)

func (*Scanner) GetIchimoku

func (c *Scanner) GetIchimoku(screener, exchange, symbol, interval string) (Ichimoku string, value float64, err error)

func (*Scanner) GetRecommendations

func (c *Scanner) GetRecommendations(screener, exchange, symbol, interval string) (RecommendSummary, error)

func (*Scanner) PrepareData

func (c *Scanner) PrepareData(symbol, interval string, indicators []string) ([]byte, error)

PrepareData prepare payload for request

func (*Scanner) PrepareRecommendations

func (c *Scanner) PrepareRecommendations() (err error)

func (*Scanner) SetDebug

func (c *Scanner) SetDebug(enable bool)

set enable/disable http request/response dump

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL