investgo

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 13 Imported by: 0

README

investgo

investgo is a Golang package to retrieve data from Investing.com, which provides data retrieval from stocks funds, etfs currencies, indices, bonds, commodities, certificates and cryptocurrencies.

Usage

It can be used from command line: go run cmd\main.go -symbolFile system.csv -fromDate "20150101" -toDate "20200209"

the results will be written to CSV files in /CSV

or a search can be made

go run cmd\main.go -search APPL -country USA -assetType bond"

or in code: investgo.GetSymbolHistoricalData(symbol, fromDate, toDate)

or like so:

investgo.SearchSymbolJSON(symbol)

Thanks to

Thanks to investpy for inspiration https://pypi.org/project/investpy/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHistoricalData

func GetHistoricalData(country string, assetType string, symbol string, fromDate string, toDate string) ([][]string, error)

func HistoricalDataToCSV

func HistoricalDataToCSV(country string, assetType string, symbol string, fromDate string, toDate string) error

func SearchJSon

func SearchJSon(symbol string, assetType string, country string) (string, error)

func SearchSymbolJSON

func SearchSymbolJSON(symbol string) (string, error)

Types

type Filter

type Filter struct {
}

type Quote

type Quote struct {
	PairId      int    `json:"pairId"`
	Name        string `json:"name"`
	Flag        string `json:"flag"`
	Link        string `json:"link"`
	Symbol      string `json:"symbol"`
	TypeString  string `json:"type"`
	PairType    string `json:"pair_type"`
	PairTypeRaw string `json:"pair_type_raw"`
	CountryID   int    `json:"countryID"`
	Sector      int    `json:"sector"`
	Region      int    `json:"region"`
	Industry    int    `json:"industry"`
	IsCrypto    bool   `json:"isCrypto"`
	Exchange    string `json:"exchange"`
	ExchangeID  int    `json:"exchangeID"`
}

type Stock

type Stock struct {
	Quotes  []Quote  `json:"quotes"`
	Totals  Total    `json:"total"`
	Filters []Filter `json:"filters"`
}

{"quotes":[{"pairId":1095913,"name":"Apple Inc","flag":"Italy", "link":"\/equities\/apple-computer-inc?cid=1095913", "symbol":"AAPLE","type":"Stock - Milan", "pair_type_raw":"Equities", "pair_type":"equities", "countryID":10,"sector":0,"region":6,"industry":0, "isCrypto":false,"exchange":"Milan","exchangeID":6}], "total":{"quotes":1,"allResults":1}, "filters":[]}

func Search(symbol string) (Stock, error)

type Total

type Total struct {
	Quotes     int `json:"quotes"`
	AllResults int `json:"allResults"`
}

Jump to

Keyboard shortcuts

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