Add directories to exclusion list && change default repo string (#387)

* Add directories to exclusion list && change default repo string

* Add in .idea folder to directory exclusion list

* cleaned

* Added support for calling the tool outside of its file

* fix formatting

* changed strings
This commit is contained in:
Ryan O'Hara-Reid
2019-11-29 11:14:19 +11:00
committed by Adrian Gallagher
parent d636882310
commit 24bddcc090
65 changed files with 482 additions and 163 deletions

View File

@@ -95,4 +95,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -1,4 +1,4 @@
{{define "currency forexprovider currencyconverter" -}}
{{define "currency forexprovider currencyconverterapi" -}}
{{template "header" .}}
## Current Features for {{.Name}}
@@ -11,15 +11,15 @@
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverter"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverter"
)
c := currencyconverter.CurrencyConverter{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyConverter",
Name: "CurrencyConverter",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,

View File

@@ -11,15 +11,15 @@
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencylayer"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencylayer"
)
c := currencylayer.CurrencyLayer{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyLayer",
Name: "CurrencyLayer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,

View File

@@ -0,0 +1,40 @@
{{define "currency forexprovider exchangeratesapi.io" -}}
{{template "header" .}}
## Current Features for {{.Name}}
+ Fetches up to date curency data from [Exchange rates API]("http://exchangeratesapi.io")
### How to enable
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-currency-via-config-example)
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/exchangerates"
)
c := exchangerates.ExchangeRates{}
// Define configuration
newSettings := base.Settings{
Name: "ExchangeRates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)
mapstringfloat, err := c.GetRates("USD", "EUR,CHY")
// Handle error
```
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{- end}}

View File

@@ -1,4 +1,4 @@
{{define "currency forexprovider fixer" -}}
{{define "currency forexprovider fixer.io" -}}
{{template "header" .}}
## Current Features for {{.Name}}
@@ -11,15 +11,15 @@
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer.io"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer.io"
)
c := fixer.Fixer{}
// Define configuration
newSettings := base.Settings{
Name: "Fixer",
Name: "Fixer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,

View File

@@ -11,15 +11,15 @@
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/openexchangerates"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/openexchangerates"
)
c := openexchangerates.OXR{}
// Define configuration
newSettings := base.Settings{
Name: "openexchangerates",
Name: "openexchangerates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,

View File

@@ -19,7 +19,7 @@ import (
const (
// DefaultRepo is the main example repository
DefaultRepo = "https://api.github.com/repos/[REPO ADDRESS HERE]"
DefaultRepo = "https://api.github.com/repos/thrasher-corp/gocryptotrader"
// GithubAPIEndpoint allows the program to query your repository
// contributor list
@@ -32,6 +32,39 @@ const (
ContributorFile = "CONTRIBUTORS"
)
var (
// DefaultExcludedDirectories defines the basic directory exclusion list for GCT
DefaultExcludedDirectories = []string{".github",
".git",
"node_modules",
".vscode",
".idea",
"cmd_templates",
"common_templates",
"communications_templates",
"config_templates",
"currency_templates",
"events_templates",
"exchanges_templates",
"portfolio_templates",
"root_templates",
"sub_templates",
"testdata_templates",
"tools_templates",
"web_templates",
}
// global flag for verbosity
verbose bool
// current tool directory to specify working templates
toolDir string
// exposes root directory if outside of document tool directory
repoDir string
// is a broken down version of the documentation tool dir for cross platform
// checking
ref = []string{"gocryptotrader", "cmd", "documentation"}
)
// Contributor defines an account associated with this code base by doing
// contributions
type Contributor struct {
@@ -43,12 +76,11 @@ type Contributor struct {
// Config defines the running config to deploy documentation across a github
// repository including exclusion lists for files and directories
type Config struct {
GithubRepo string `json:"githubRepo"`
Exclusions Exclusions `json:"exclusionList"`
RootReadme bool `json:"rootReadmeActive"`
LicenseFile bool `json:"licenseFileActive"`
ContributorFile bool `json:"contributorFileActive"`
ReferencePathToRepo string `json:"referencePathToRepo"`
GithubRepo string `json:"githubRepo"`
Exclusions Exclusions `json:"exclusionList"`
RootReadme bool `json:"rootReadmeActive"`
LicenseFile bool `json:"licenseFileActive"`
ContributorFile bool `json:"contributorFileActive"`
}
// Exclusions defines the exclusion list so documents are not generated
@@ -62,7 +94,6 @@ type DocumentationDetails struct {
Directories []string
Tmpl *template.Template
Contributors []Contributor
Verbose bool
Config *Config
}
@@ -77,15 +108,33 @@ type Attributes struct {
}
func main() {
verbose := flag.Bool("v", false, "Verbose output")
flag.BoolVar(&verbose, "v", false, "Verbose output")
flag.StringVar(&toolDir, "tooldir", "", "Pass in the documentation tool directory if outside tool folder")
flag.Parse()
wd, err := os.Getwd()
if err != nil {
fmt.Println("Documentation tool error cannot get working dir:", err)
os.Exit(1)
}
if strings.Contains(wd, filepath.Join(ref...)) {
rootdir := filepath.Dir(filepath.Dir(wd))
repoDir = rootdir
toolDir = wd
} else {
if toolDir == "" {
fmt.Println("Please set documentation tool directory via the tooldir flag if working outside of tool directory")
os.Exit(1)
}
repoDir = wd
}
fmt.Println(core.Banner)
fmt.Println("This will update and regenerate documentation for the different packages in your repo.")
fmt.Println()
if *verbose {
if verbose {
fmt.Println("Fetching configuration...")
}
@@ -95,11 +144,11 @@ func main() {
err)
}
if *verbose {
if verbose {
fmt.Println("Fetching project directory tree...")
}
dirList, err := GetProjectDirectoryTree(&config, *verbose)
dirList, err := GetProjectDirectoryTree(&config)
if err != nil {
log.Fatalf("Documentation Generation Tool - GetProjectDirectoryTree error %s",
err)
@@ -107,7 +156,7 @@ func main() {
var contributors []Contributor
if config.ContributorFile {
if *verbose {
if verbose {
fmt.Println("Fetching repository contributor list...")
}
contributors, err = GetContributorList(config.GithubRepo)
@@ -116,16 +165,15 @@ func main() {
err)
}
// idoall's contributors were forked and merged, so his contributions
// aren't automatically retrievable
contributors = append(contributors, Contributor{
Login: "idoall",
URL: "https://github.com/idoall",
Contributions: 1,
})
// Github API missing contributors
missingAPIContributors := []Contributor{
contributors = append(contributors, []Contributor{
// idoall's contributors were forked and merged, so his contributions
// aren't automatically retrievable
{
Login: "idoall",
URL: "https://github.com/idoall",
Contributions: 1,
},
{
Login: "mattkanwisher",
URL: "https://github.com/mattkanwisher",
@@ -151,10 +199,9 @@ func main() {
URL: "https://github.com/zeldrinn",
Contributions: 1,
},
}
contributors = append(contributors, missingAPIContributors...)
}...)
if *verbose {
if verbose {
fmt.Println("Contributor List Fetched")
for i := range contributors {
fmt.Println(contributors[i].Login)
@@ -164,7 +211,7 @@ func main() {
fmt.Println("Contributor list file disabled skipping fetching details")
}
if *verbose {
if verbose {
fmt.Println("Fetching template files...")
}
@@ -174,7 +221,7 @@ func main() {
err)
}
if *verbose {
if verbose {
fmt.Println("All core systems fetched, updating documentation...")
}
@@ -182,7 +229,6 @@ func main() {
dirList,
tmpl,
contributors,
*verbose,
&config})
if err != nil {
log.Fatalf("Documentation Generation Tool - UpdateDocumentation error %s",
@@ -195,11 +241,12 @@ func main() {
// GetConfiguration retrieves the documentation configuration
func GetConfiguration() (Config, error) {
var c Config
file, err := os.OpenFile("config.json", os.O_RDWR, os.ModePerm)
configFilePath := filepath.Join([]string{toolDir, "config.json"}...)
file, err := os.OpenFile(configFilePath, os.O_RDWR, os.ModePerm)
if err != nil {
fmt.Println("Creating configuration file, please add github repository path and preferences")
fmt.Println("Creating configuration file, please check to add a different github repository path and change preferences")
file, err = os.Create("config.json")
file, err = os.Create(configFilePath)
if err != nil {
return c, err
}
@@ -209,8 +256,7 @@ func GetConfiguration() (Config, error) {
c.ContributorFile = true
c.LicenseFile = true
c.RootReadme = true
c.ReferencePathToRepo = "../../"
c.Exclusions.Directories = []string{".github"}
c.Exclusions.Directories = DefaultExcludedDirectories
data, mErr := json.MarshalIndent(c, "", " ")
if mErr != nil {
@@ -235,21 +281,17 @@ func GetConfiguration() (Config, error) {
return c, err
}
if c.GithubRepo == "" || c.GithubRepo == DefaultRepo {
if c.GithubRepo == "" {
return c, errors.New("repository not set in config.json file, please change")
}
if c.ReferencePathToRepo == "" {
return c, errors.New("reference path not set in the config.json file, please set")
}
return c, nil
}
// IsExcluded returns if the file path is included in the exclusion list
func IsExcluded(path string, exclusion []string) bool {
for _, data := range exclusion {
if strings.Contains(path, data) {
for i := range exclusion {
if path == exclusion[i] {
return true
}
}
@@ -258,18 +300,18 @@ func IsExcluded(path string, exclusion []string) bool {
// GetProjectDirectoryTree uses filepath walk functions to get each individual
// directory name and path to match templates with
func GetProjectDirectoryTree(c *Config, verbose bool) ([]string, error) {
func GetProjectDirectoryTree(c *Config) ([]string, error) {
var directoryData []string
if c.RootReadme { // Projects root README.md
directoryData = append(directoryData, c.ReferencePathToRepo)
directoryData = append(directoryData, repoDir)
}
if c.LicenseFile { // Standard license file
directoryData = append(directoryData, c.ReferencePathToRepo+LicenseFile)
directoryData = append(directoryData, filepath.Join(repoDir, LicenseFile))
}
if c.ContributorFile { // Standard contributor file
directoryData = append(directoryData, c.ReferencePathToRepo+ContributorFile)
directoryData = append(directoryData, filepath.Join(repoDir, ContributorFile))
}
walkfn := func(path string, info os.FileInfo, err error) error {
@@ -293,7 +335,7 @@ func GetProjectDirectoryTree(c *Config, verbose bool) ([]string, error) {
return nil
}
return directoryData, filepath.Walk(c.ReferencePathToRepo, walkfn)
return directoryData, filepath.Walk(repoDir, walkfn)
}
// GetTemplateFiles parses and returns all template files in the documentation
@@ -313,6 +355,9 @@ func GetTemplateFiles() (*template.Template, error) {
var parseError error
tmpl, parseError = tmpl.ParseGlob(filepath.Join(path, "*.tmpl"))
if parseError != nil {
if strings.Contains(parseError.Error(), "pattern matches no files") {
return nil
}
return parseError
}
return filepath.SkipDir
@@ -320,7 +365,7 @@ func GetTemplateFiles() (*template.Template, error) {
return nil
}
return tmpl, filepath.Walk(".", walkfn)
return tmpl, filepath.Walk(toolDir, walkfn)
}
// GetContributorList fetches a list of contributors from the github api
@@ -371,18 +416,23 @@ func GetGoDocURL(name string) string {
// UpdateDocumentation generates or updates readme/documentation files across
// the codebase
func UpdateDocumentation(details DocumentationDetails) error {
for _, path := range details.Directories {
data := strings.Split(path, "/")
for i := range details.Directories {
cutset := details.Directories[i][len(repoDir):]
if cutset != "" && cutset[0] == os.PathSeparator {
cutset = cutset[1:]
}
data := strings.Split(cutset, string(os.PathSeparator))
var temp []string
for _, d := range data {
if d == ".." {
for x := range data {
if data[x] == ".." {
continue
}
if d == "" {
if data[x] == "" {
break
}
temp = append(temp, d)
temp = append(temp, data[x])
}
var name string
@@ -393,7 +443,7 @@ func UpdateDocumentation(details DocumentationDetails) error {
}
if IsExcluded(name, details.Config.Exclusions.Files) {
if details.Verbose {
if verbose {
fmt.Println("Excluding file:", name)
}
continue
@@ -401,20 +451,21 @@ func UpdateDocumentation(details DocumentationDetails) error {
if details.Tmpl.Lookup(name) == nil {
fmt.Printf("Template not found for path %s create new template with {{define \"%s\" -}} TEMPLATE HERE {{end}}\n",
path,
details.Directories[i],
name)
continue
}
var mainPath string
if name == LicenseFile || name == ContributorFile {
mainPath = path
mainPath = details.Directories[i]
} else {
mainPath = filepath.Join(path, "README.md")
mainPath = filepath.Join(details.Directories[i], "README.md")
}
err := os.Remove(mainPath)
if err != nil && !strings.Contains(err.Error(), "no such file or directory") {
if err != nil && !(strings.Contains(err.Error(), "no such file or directory") ||
strings.Contains(err.Error(), "The system cannot find the file specified.")) {
return err
}
@@ -422,14 +473,15 @@ func UpdateDocumentation(details DocumentationDetails) error {
if err != nil {
return err
}
defer file.Close()
attr := GetDocumentationAttributes(name, details.Contributors)
err = details.Tmpl.ExecuteTemplate(file, name, attr)
if err != nil {
file.Close()
return err
}
file.Close()
}
return nil
}

View File

@@ -5,6 +5,7 @@
### Current Features
+ REST Support
+ Websocket Support
### How to enable

View File

@@ -0,0 +1,99 @@
{{define "exchanges btse" -}}
{{template "header" .}}
## BTCMarkets Exchange
### Current Features
+ REST Support
+ Websocket Support
### How to enable
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
+ If enabled via "configuration".json file the exchange will be added to the
IBotExchange array in the ```go var bot Bot``` and you will only be able to use
the wrapper interface functions for accessing exchange data. View routines.go
for an example of integration usage with GoCryptoTrader. Rudimentary example
below:
main.go
```go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "BTSE" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
}
```
+ If enabled via individually importing package, rudimentary example below:
```go
// Public calls
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
}
```
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{end}}

View File

@@ -3,4 +3,4 @@ Thanks to the following contributors:
{{range $contributor := .Contributors -}}
{{$contributor.Login}} | {{$contributor.URL}}
{{end}}
{{end}}
{{- end}}

View File

@@ -133,4 +133,4 @@ If this framework helped you in any way, or you would like to support the develo
Binaries will be published once the codebase reaches a stable condition.
{{template "contributors" .}}
{{end}}
{{- end}}

View File

@@ -5,7 +5,7 @@
|User|Contribution Amount|
|--|--|
{{- range $contributor := .Contributors -}}
{{range $contributor := .Contributors -}}
| [{{$contributor.Login}}]({{$contributor.URL}}) | {{$contributor.Contributions}} |
{{end}}
{{end}}
{{- end}}

View File

@@ -6,4 +6,4 @@
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***
{{end}}
{{- end}}

View File

@@ -55,4 +55,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -44,4 +44,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -92,4 +92,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -77,4 +77,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -92,4 +92,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -249,4 +249,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -46,4 +46,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -45,4 +45,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -43,4 +43,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -5,7 +5,7 @@
[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader)
[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverter)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverterapi)
[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
@@ -29,15 +29,15 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverter"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencyconverter"
)
c := currencyconverter.CurrencyConverter{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyConverter",
Name: "CurrencyConverter",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
@@ -72,4 +72,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -29,15 +29,15 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencylayer"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/currencylayer"
)
c := currencylayer.CurrencyLayer{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyLayer",
Name: "CurrencyLayer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
@@ -72,4 +72,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -0,0 +1,74 @@
# GoCryptoTrader package Forexprovider
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/page-logo.png?raw=true" width="350px" height="350px" hspace="70">
[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader)
[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/currency/forexprovider/exchangeratesapi.io)
[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
This forexprovider package is part of the GoCryptoTrader codebase.
## This is still in active development
You can track ideas, planned features and what's in progresss on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader).
Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk)
## Current Features for forexprovider
+ Fetches up to date curency data from [Exchange rates API]("http://exchangeratesapi.io")
### How to enable
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-currency-via-config-example)
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/exchangerates"
)
c := exchangerates.ExchangeRates{}
// Define configuration
newSettings := base.Settings{
Name: "ExchangeRates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)
mapstringfloat, err := c.GetRates("USD", "EUR,CHY")
// Handle error
```
### Please click GoDocs chevron above to view current GoDoc information for this package
## Contribution
Please feel free to submit any pull requests or suggest any desired features to be added.
When submitting a PR, please abide by our coding guidelines:
+ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
+ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
+ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md).
+ Pull requests need to be based on and opened against the `master` branch.
## Donations
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/donate.png?raw=true" hspace="70">
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -5,7 +5,7 @@
[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader)
[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer.io)
[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
@@ -29,15 +29,15 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer.io"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/fixer.io"
)
c := fixer.Fixer{}
// Define configuration
newSettings := base.Settings{
Name: "Fixer",
Name: "Fixer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
@@ -72,4 +72,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -29,15 +29,15 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/openexchangerates"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/base"
"github.com/thrasher-corp/gocryptotrader/currency/forexprovider/openexchangerates"
)
c := openexchangerates.OXR{}
// Define configuration
newSettings := base.Settings{
Name: "openexchangerates",
Name: "openexchangerates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
@@ -72,4 +72,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -45,4 +45,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -46,4 +46,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -141,4 +141,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -137,4 +137,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -23,6 +23,7 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
### Current Features
+ REST Support
+ Websocket Support
### How to enable
@@ -130,4 +131,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -1,30 +1,133 @@
# GoCryptoTrader Btse Exchange Wrapper
# GoCryptoTrader package Btse
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/page-logo.png?raw=true" width="350px" height="350px" hspace="70">
An exchange interface wrapper for the GoCryptoTrader application.
[![Build Status](https://travis-ci.org/thrasher-corp/gocryptotrader.svg?branch=master)](https://travis-ci.org/thrasher-corp/gocryptotrader)
[![Software License](https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square)](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/thrasher-corp/gocryptotrader?status.svg)](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges/btse)
[![Coverage Status](http://codecov.io/github/thrasher-corp/gocryptotrader/coverage.svg?branch=master)](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/thrasher-corp/gocryptotrader)](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
This btse package is part of the GoCryptoTrader codebase.
## This is still in active development
You can track ideas, planned features and what's in progresss on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader).
You can track ideas, planned features and what's in progresss on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader).
## Current Btse Exchange Features
Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk)
+ REST Support
+ Websocket Support
## BTCMarkets Exchange
+ Can be used as a package
### Current Features
## Notes
+ REST Support
+ Websocket Support
+ Please add notes here with any production issues
+ Please provide link to exchange website and API documentation
### How to enable
## Contributors
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)
+ Please add your information
+ Individual package example below:
|User|Github|Contribution|
|--|--|--|
|AliasGoesHere|https://github.com/AliasGoesHere |WHAT-YOU-DID|
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
+ If enabled via "configuration".json file the exchange will be added to the
IBotExchange array in the ```go var bot Bot``` and you will only be able to use
the wrapper interface functions for accessing exchange data. View routines.go
for an example of integration usage with GoCryptoTrader. Rudimentary example
below:
main.go
```go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "BTSE" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
}
```
+ If enabled via individually importing package, rudimentary example below:
```go
// Public calls
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
}
```
### Please click GoDocs chevron above to view current GoDoc information for this package
## Contribution
Please feel free to submit any pull requests or suggest any desired features to be added.
When submitting a PR, please abide by our coding guidelines:
+ Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
+ Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.
+ Code must adhere to our [coding style](https://github.com/thrasher-corp/gocryptotrader/blob/master/doc/coding_style.md).
+ Pull requests need to be based on and opened against the `master` branch.
## Donations
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/donate.png?raw=true" hspace="70">
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -90,7 +90,7 @@ if err != nil {
}
// Fetches current orderbook information
ob, err := c.GetOrderBook()
ob, err := c.GetOrderbook()
if err != nil {
// Handle error
}
@@ -105,7 +105,7 @@ if err != nil {
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := c.Trade(...)
resp, err := c.SubmitOrder(...)
if err != nil {
// Handle error
}
@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -137,4 +137,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -137,4 +137,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -131,4 +131,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -42,4 +42,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -73,4 +73,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -138,4 +138,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -43,4 +43,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -46,4 +46,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -74,4 +74,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -130,4 +130,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -137,4 +137,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -42,4 +42,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

3
testdata/README.md vendored
View File

@@ -41,5 +41,4 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***

View File

@@ -98,4 +98,3 @@ When submitting a PR, please abide by our coding guidelines:
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***