diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 10ef811..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,9 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index d7072c2..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,30 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - - -[prune] - go-tests = true - unused-packages = true diff --git a/client.go b/client.go index 85d52b9..51623be 100644 --- a/client.go +++ b/client.go @@ -10,6 +10,7 @@ import ( "net/http" "net/url" "os" + "strconv" "strings" ) @@ -138,6 +139,19 @@ func (c *AllyApi) MarketQuotes(symbols ...string) (resp MarketQuotesResponse) { return } +func (c *AllyApi) MarketNewsSearch(maxhits int, symbols ...string) (resp MarketNewsResponse) { + v := url.Values{ + "symbols": symbols, + "maxhits": []string{strconv.Itoa(maxhits)}, + } + c.marshalWithQuery("market/news/search", v, &resp) + return +} + +func (c *AllyApi) MarketNewsGet(id string) { + +} + func (c *AllyApi) marshalWithQuery(p string, v url.Values, i interface{}) { resp := c.getWithParameters(p, v) _ = xml.Unmarshal(resp, &i) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4d6b3aa --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/jaketothepast/investmentally + +go 1.13 + +require ( + github.com/joho/godotenv v1.3.0 + github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..cf4262f --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM= +github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM= diff --git a/types.go b/types.go index 5d283dd..76e1de6 100644 --- a/types.go +++ b/types.go @@ -192,3 +192,21 @@ type Quote struct { PriorDayLow float64 `xml:"plo"` PriorDayOpen float64 `xml:"popn"` } + +type MarketNewsResponse struct { + XMLName xml.Name `xml:"response"` + Articles []Article `xml:"articles"` +} + +type Article struct { + XMLName xml.Name `xml:"article"` + Date string `xml:"date"` + Headline string `xml:"headline"` + Id string `xml:"id"` + Story string `xml:"story"` +} + +type MarketNewsGetResponse struct { + XMLName xml.Name `xml:"response"` + Article Article `xml:"article"` +}