Switching to go modules.

This commit is contained in:
Jacob Windle 2020-01-21 19:11:29 -05:00
parent 39acd7d5fe
commit 5b916d7738
6 changed files with 44 additions and 39 deletions

9
Gopkg.lock generated
View File

@ -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

View File

@ -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

View File

@ -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)

8
go.mod Normal file
View File

@ -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
)

4
go.sum Normal file
View File

@ -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=

View File

@ -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"`
}