Feature: Add mock testing to ZB (#569)

* Adds mock testing to ZB

* STEALS improved time validation code from the original STOLEN validation code :D

* Mini fixes from review

* happy fun comment stealing

* Moves the loop checker earlier to ensure no double appendages

* Fixes sneaky test

* Fixes the important part where mock tests work instead of live tests

* Skips authenticated endpoints for mock testing.

* lint

* Updates candle wrapper functions to respect design

* basic linting fix

* Reverts configtest.json, updates readme to be way better, adds coverage to validateCandlesRequest

* Tiniest grammatical fix

* Fixes more outdated code references

* Closing out a high

* Fixes spacing

* Replaces all instances of 4 spaces in tmpl files with a tab

* fixes spacing and tab related readme issues once and for all 🤞

* tidy

* indentation violation identification situation
This commit is contained in:
Scott
2020-10-07 11:59:08 +11:00
committed by GitHub
parent d9e27cd3d8
commit 0da62b7fbf
112 changed files with 4957 additions and 1304 deletions

View File

@@ -22,7 +22,7 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
#### This tool allows for the generation of new documentation through templating
From the `gocryptotrader/cmd/documentation/` folder, using the go command: **go run documentation.go** this will auto-generate and regenerate documentation across the **GoCryptoTrader** code base.
From the `gocryptotrader/cmd/documentation/` folder, using the go command: **go run documentation.go** this will auto-generate and regenerate documentation across the **GoCryptoTrader** code base.
>Using the -v command will, ie **go run documentation.go -v** put the tool into verbose mode allowing you to see what is happening with a little more depth.
Be aware, this tool will:
@@ -36,19 +36,19 @@ Be aware, this tool will:
```json
{
"githubRepo": "https://api.github.com/repos/thrasher-corp/gocryptotrader", This is your current repo
"exclusionList": { This allows for excluded directories and files
"Files": null,
"Directories": [
"_templates",
".git",
"web"
]
},
"rootReadmeActive": true, allows a root directory README.md
"licenseFileActive": true, allows for a license file to be generated
"contributorFileActive": true, fetches a new contributor list
"referencePathToRepo": "../../"
"githubRepo": "https://api.github.com/repos/thrasher-corp/gocryptotrader", This is your current repo
"exclusionList": { This allows for excluded directories and files
"Files": null,
"Directories": [
"_templates",
".git",
"web"
]
},
"rootReadmeActive": true, allows a root directory README.md
"licenseFileActive": true, allows for a license file to be generated
"contributorFileActive": true, fetches a new contributor list
"referencePathToRepo": "../../"
}
```
### Template example

View File

@@ -44,18 +44,18 @@ HTMLScrapingData is a struct which contains the necessary information to scrape
func TestAdd(t *testing.T) {
t.Parallel()
data := HTMLScrapingData{TokenData: "h1",
Key: "id",
Val: "revision-history",
TokenDataEnd: "table",
TextTokenData: "td",
DateFormat: "2006/01/02",
RegExp: "^20(\\d){2}/(\\d){2}/(\\d){2}$",
CheckString: "2019/11/15",
Path: "https://docs.gemini.com/rest-api/#revision-history"}
Key: "id",
Val: "revision-history",
TokenDataEnd: "table",
TextTokenData: "td",
DateFormat: "2006/01/02",
RegExp: "^20(\\d){2}/(\\d){2}/(\\d){2}$",
CheckString: "2019/11/15",
Path: "https://docs.gemini.com/rest-api/#revision-history"}
err := Add("Gemini", htmlScrape, data.Path, data, true, &testConfigData)
if err != nil {
t.Error(err)
}
}
}
```
@@ -67,7 +67,7 @@ func TestAdd(t *testing.T) {
err := Add("Lbank", github, fmt.Sprintf(githubPath, data.Repo), data, false, &configData)
if err != nil {
t.Error(err)
}
}
}
```

View File

@@ -4,7 +4,7 @@
#### This tool allows for the generation of new documentation through templating
From the `gocryptotrader/cmd/documentation/` folder, using the go command: **go run documentation.go** this will auto-generate and regenerate documentation across the **GoCryptoTrader** code base.
From the `gocryptotrader/cmd/documentation/` folder, using the go command: **go run documentation.go** this will auto-generate and regenerate documentation across the **GoCryptoTrader** code base.
>Using the -v command will, ie **go run documentation.go -v** put the tool into verbose mode allowing you to see what is happening with a little more depth.
Be aware, this tool will:
@@ -18,19 +18,19 @@ Be aware, this tool will:
```json
{
"githubRepo": "https://api.github.com/repos/thrasher-corp/gocryptotrader", This is your current repo
"exclusionList": { This allows for excluded directories and files
"Files": null,
"Directories": [
"_templates",
".git",
"web"
]
},
"rootReadmeActive": true, allows a root directory README.md
"licenseFileActive": true, allows for a license file to be generated
"contributorFileActive": true, fetches a new contributor list
"referencePathToRepo": "../../"
"githubRepo": "https://api.github.com/repos/thrasher-corp/gocryptotrader", This is your current repo
"exclusionList": { This allows for excluded directories and files
"Files": null,
"Directories": [
"_templates",
".git",
"web"
]
},
"rootReadmeActive": true, allows a root directory README.md
"licenseFileActive": true, allows for a license file to be generated
"contributorFileActive": true, fetches a new contributor list
"referencePathToRepo": "../../"
}
```
### Template example

View File

@@ -11,7 +11,7 @@ app and share different types of data
### Current Features
+ Basic communication to your slack channel information includes:
- Working status of bot
- Working status of bot
### How to enable
@@ -28,10 +28,10 @@ s := new(slack.Slack)
// Define slack configuration
commsConfig := config.CommunicationsConfig{SlackConfig: config.SlackConfig{
Name: "Slack",
Enabled: true,
Verbose: false,
TargetChannel: "targetChan",
Name: "Slack",
Enabled: true,
Verbose: false,
TargetChannel: "targetChan",
VerificationToken: "slackGeneratedToken",
}}

View File

@@ -26,12 +26,12 @@ s := new(smsglobal.SMSGlobal)
// Define SMSGlobal configuration
commsConfig := config.CommunicationsConfig{SMSGlobalConfig: config.SMSGlobalConfig{
Name: "SMSGlobal",
Enabled: true,
Verbose: false,
Name: "SMSGlobal",
Enabled: true,
Verbose: false,
Username: "username",
Password: "password",
Contacts: []config.SMSContact{}
Contacts: []config.SMSContact{}
}}
s.Setup(commsConfig)

View File

@@ -26,14 +26,14 @@ s := new(smtpservice.SMTPservice)
// Define SMTPservice configuration
commsConfig := config.CommunicationsConfig{SMTPservice: config.SMTPConfig{
Name: "SMTPservice",
Enabled: true,
Verbose: false,
Host: "host",
Port: "port",
AccountName: "name",
Name: "SMTPservice",
Enabled: true,
Verbose: false,
Host: "host",
Port: "port",
AccountName: "name",
AccountPassword: "password",
RecipientList: "something@something.com,somethingelse@something.com"
RecipientList: "something@something.com,somethingelse@something.com"
}}
s.Setup(commsConfig)

View File

@@ -11,42 +11,42 @@ developed by Telegram Messenger LLP
### Current Features
+ Creation of bot that can retrieve
- Bot status
- Bot status
### How to enable
### How to enable
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-communications-via-config-example)
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-communications-via-config-example)
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/communications/telegram"
"github.com/thrasher-corp/gocryptotrader/config"
)
+ Individual package example below:
```go
import (
"github.com/thrasher-corp/gocryptotrader/communications/telegram"
"github.com/thrasher-corp/gocryptotrader/config"
)
t := new(telegram.Telegram)
t := new(telegram.Telegram)
// Define Telegram configuration
commsConfig := config.CommunicationsConfig{TelegramConfig: config.TelegramConfig{
Name: "Telegram",
Enabled: true,
Verbose: false,
VerificationToken: "token",
}}
// Define Telegram configuration
commsConfig := config.CommunicationsConfig{TelegramConfig: config.TelegramConfig{
Name: "Telegram",
Enabled: true,
Verbose: false,
VerificationToken: "token",
}}
t.Setup(commsConfig)
err := t.Connect
// Handle error
```
t.Setup(commsConfig)
err := t.Connect
// Handle error
```
+ Once the bot has started you can interact with the bot using these commands
via Telegram:
```
/start - Will authenticate your ID
/status - Displays the status of the bot
/help - Displays current command list
/settings - Displays current bot settings
/start - Will authenticate your ID
/status - Displays the status of the bot
/help - Displays current command list
/settings - Displays current bot settings
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -6,21 +6,21 @@
+ Contains configurations for:
- Exchanges for utilisation of a broad or minimal amount of enabled
exchanges [Example](#enable-exchange-via-config-example) for
enabling an exchange.
- Exchanges for utilisation of a broad or minimal amount of enabled
exchanges [Example](#enable-exchange-via-config-example) for
enabling an exchange.
- Bank accounts for withdrawal and depositing FIAT between exchange and
your personal accounts [Example](#enable-bank-accounts-via-config-example).
- Bank accounts for withdrawal and depositing FIAT between exchange and
your personal accounts [Example](#enable-bank-accounts-via-config-example).
- Portfolio to monitor online and offline accounts [Example](#enable-portfolio-via-config-example).
- Portfolio to monitor online and offline accounts [Example](#enable-portfolio-via-config-example).
- Currency configurations to set your foreign exchange provider accounts,
your preferred display currency, suitable FIAT currency and suitable
cryptocurrency [Example](#enable-currency-via-config-example).
- Currency configurations to set your foreign exchange provider accounts,
your preferred display currency, suitable FIAT currency and suitable
cryptocurrency [Example](#enable-currency-via-config-example).
- Communication for utilisation of supported communication mediums e.g.
email events direct to your personal account [Example](#enable-communications-via-config-example).
- Communication for utilisation of supported communication mediums e.g.
email events direct to your personal account [Example](#enable-communications-via-config-example).
# Config Examples

View File

@@ -3,10 +3,10 @@
## Current Features for {{.Name}}
+ Currency package contains a full suite of packages that provide:
- Foreign exchange data fetching for FIAT currencies
- Currency Pair generation
- Symbol mapping
- Translation between currencies that have similar strings e.g. XBT, BTC
- Foreign exchange data fetching for FIAT currencies
- Currency Pair generation
- Symbol mapping
- Translation between currencies that have similar strings e.g. XBT, BTC
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}

View File

@@ -19,13 +19,13 @@ c := currencyconverter.CurrencyConverter{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyConverter",
Enabled: true,
Verbose: false,
Name: "CurrencyConverter",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)

View File

@@ -19,13 +19,13 @@ c := currencylayer.CurrencyLayer{}
// Define configuration
newSettings := base.Settings{
Name: "CurrencyLayer",
Enabled: true,
Verbose: false,
Name: "CurrencyLayer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)

View File

@@ -19,13 +19,13 @@ c := exchangerates.ExchangeRates{}
// Define configuration
newSettings := base.Settings{
Name: "ExchangeRates",
Enabled: true,
Verbose: false,
Name: "ExchangeRates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)

View File

@@ -19,13 +19,13 @@ c := fixer.Fixer{}
// Define configuration
newSettings := base.Settings{
Name: "Fixer",
Enabled: true,
Verbose: false,
Name: "Fixer",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)

View File

@@ -19,13 +19,13 @@ c := openexchangerates.OXR{}
// Define configuration
newSettings := base.Settings{
Name: "openexchangerates",
Enabled: true,
Verbose: false,
Name: "openexchangerates",
Enabled: true,
Verbose: false,
RESTPollingDelay: time.Duration,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
APIKey: "key",
APIKeyLvl: "keylvl",
PrimaryProvider: true,
}
c.Setup(newSettings)

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Binance" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Binance" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bitfinex" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bitfinex" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bitflyer" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bitflyer" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,21 +82,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bithumb" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bithumb" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bitmex" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bitmex" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bitstamp" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bitstamp" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Bittrex" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Bittrex" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "BTCMarkets" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "BTCMarkets" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,13 +83,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var b exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "BTSE" {
b = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "BTSE" {
b = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,13 +83,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var c exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "CoinbasePro" {
c = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "CoinbasePro" {
c = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := c.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := c.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := c.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := c.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := c.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var c exchange.IBotExchange
for i := range Bot.Exchanges {
if Bot.Exchanges[i].GetName() == "Coinbene" {
c = Bot.Exchanges[i]
}
if Bot.Exchanges[i].GetName() == "Coinbene" {
c = Bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range Bot.Exchanges {
// Fetches current ticker information
tick, err := c.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := c.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := c.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.GetOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := c.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
resp, err := c.SubmitOrder(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var c exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Coinut" {
c = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Coinut" {
c = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := c.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := c.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := c.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := c.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := c.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := c.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -0,0 +1,177 @@
{{define "exchanges mock" -}}
{{template "header" .}}
## Mock Testing Suite
## Current Features for {{.Name}}
+ REST recording service
+ REST mock response server
### How to enable
+ Any exchange with mock testing will be enabled by default. This is done using build tags which are highlighted in the examples below via `//+build mock_test_off`. To disable and run live endpoint testing parse `-tags=mock_test_off` as a go test param.
## Mock test setup
+ Create two additional test files for the exchange. Examples are below:
### file one - your_current_exchange_name_live_test.go
```go
//+build mock_test_off
// This will build if build tag mock_test_off is parsed and will do live testing
// using all tests in (exchange)_test.go
package your_current_exchange_name
import (
"os"
"testing"
"log"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
)
var mockTests = false
func TestMain(m *testing.M) {
cfg := config.GetConfig()
cfg.LoadConfig("../../testdata/configtest.json")
your_current_exchange_nameConfig, err := cfg.GetExchangeConfig("your_current_exchange_name")
if err != nil {
log.Fatal("your_current_exchange_name Setup() init error", err)
}
your_current_exchange_nameConfig.API.AuthenticatedSupport = true
your_current_exchange_nameConfig.API.Credentials.Key = apiKey
your_current_exchange_nameConfig.API.Credentials.Secret = apiSecret
s.SetDefaults()
s.Setup(&your_current_exchange_nameConfig)
log.Printf(sharedtestvalues.LiveTesting, s.Name, s.API.Endpoints.URL)
os.Exit(m.Run())
}
```
### file two - your_current_exchange_name_mock_test.go
```go
//+build !mock_test_off
// This will build if build tag mock_test_off is not parsed and will try to mock
// all tests in _test.go
package your_current_exchange_name
import (
"os"
"testing"
"log"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/exchanges/mock"
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
)
const mockfile = "../../testdata/http_mock/your_current_exchange_name/your_current_exchange_name.json"
var mockTests = true
func TestMain(m *testing.M) {
cfg := config.GetConfig()
cfg.LoadConfig("../../testdata/configtest.json")
your_current_exchange_nameConfig, err := cfg.GetExchangeConfig("your_current_exchange_name")
if err != nil {
log.Fatal("your_current_exchange_name Setup() init error", err)
}
your_current_exchange_nameConfig.API.AuthenticatedSupport = true
your_current_exchange_nameConfig.API.Credentials.Key = apiKey
your_current_exchange_nameConfig.API.Credentials.Secret = apiSecret
s.SetDefaults()
s.Setup(&your_current_exchange_nameConfig)
serverDetails, newClient, err := mock.NewVCRServer(mockfile)
if err != nil {
log.Fatalf("Mock server error %s", err)
}
s.HTTPClient = newClient
s.API.Endpoints.URL = serverDetails
log.Printf(sharedtestvalues.MockTesting, s.Name, s.API.Endpoints.URL)
os.Exit(m.Run())
}
```
## Mock test storage
+ Under `testdata/http_mock` create a folder matching the name of your exchange. Then create a JSON file matching the name of your exchange with the following formatting:
```
{
"routes": {
}
}
```
## Recording a test result
+ Once the files `your_current_exchange_name_mock_test.go` and `your_current_exchange_name_live_test.go` along with the JSON file `testdata/http_mock/our_current_exchange_name/our_current_exchange_name.json` are created, go through each individual test function and add
```go
var s SomeExchange
func TestDummyTest(t *testing.T) {
s.Verbose = true // This will show you some fancy debug output
s.HTTPRecording = true // This will record the request and response payloads
s.API.Endpoints.URL = apiURL // This will overwrite the current mock url at localhost
s.API.Endpoints.URLSecondary = secondAPIURL // This is only if your API has multiple endpoints
s.HTTPClient = http.DefaultClient // This will ensure that a real HTTPClient is used to record
err := s.SomeExchangeEndpointFunction()
// check error
}
```
+ This will store the request and results under the freshly created `testdata/http_mock/your_current_exchange/your_current_exchange.json`
## Validating
+ To check if the recording was successful, comment out recording and apiurl changes, then re-run test.
```go
var s SomeExchange
func TestDummyTest(t *testing.T) {
s.Verbose = true // This will show you some fancy debug output
// s.HTTPRecording = true // This will record the request and response payloads
// s.API.Endpoints.URL = apiURL // This will overwrite the current mock url at localhost
// s.API.Endpoints.URLSecondary = secondAPIURL // This is only if your API has multiple endpoints
// s.HTTPClient = http.DefaultClient // This will ensure that a real HTTPClient is used to record
err := s.SomeExchangeEndpointFunction()
// check error
}
```
+ The payload should be the same.
## Considerations
+ Some functions require timestamps. Mock tests _must_ match the same request structure, so `time.Now()` will cause problems for mock testing.
+ To address this, use the boolean variable `mockTests` to create a consistent date. An example is below.
```
startTime := time.Now().Add(-time.Hour * 1)
endTime := time.Now()
if mockTests {
startTime = time.Date(2020, 9, 1, 0, 0, 0, 0, time.UTC)
endTime = time.Date(2020, 9, 2, 0, 0, 0, 0, time.UTC)
}
```
+ Authenticated endpoints will typically require valid API keys and a signature to run successfully. Authenticated endpoints should be skipped. See an example below
```
if mockTests {
t.Skip("skipping authenticated function for mock testing")
}
```
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations" .}}
{{end}}

View File

@@ -4,9 +4,9 @@
+ This package facilitates orderbook generation.
+ Attaches methods to an orderbook
- To Return total Bids
- To Return total Asks
- Update orderbooks
- To Return total Bids
- To Return total Asks
- Update orderbooks
+ Gets a loaded orderbook by exchange, asset type and currency pair.
+ This package is primarily used in conjunction with but not limited to the
@@ -18,7 +18,7 @@ Examples below:
```go
ob, err := yobitExchange.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Find total asks which also returns total orderbook value
@@ -31,7 +31,7 @@ the package itself.
```go
ob, err := orderbook.Get(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -4,9 +4,9 @@
+ This stats package services the exchanges package by providing stats on
enabled exchanges i.e.
- Sort by largest volume
- Sort by best price for currency
- Others will be added soon
- Sort by largest volume
- Sort by best price for currency
- Others will be added soon
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}

View File

@@ -6,7 +6,7 @@
+ This package facilitates ticker generation.
+ Attaches methods to an ticker
- Returns a string of a value
- Returns a string of a value
+ Gets a loaded ticker by exchange, asset type and currency pair.
@@ -19,7 +19,7 @@ Examples below:
```go
tick, err := yobitExchange.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Converts ticker value to string
@@ -32,7 +32,7 @@ the package itself.
```go
tick, err := ticker.GetTicker(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var e exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Exmo" {
e = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Exmo" {
e = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := e.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := e.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := e.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := e.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := e.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := e.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := e.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var f exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "FTX" {
f = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "FTX" {
f = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := f.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := f.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := f.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := f.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := f.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,13 +83,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := f.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := f.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var g exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "GateIO" {
g = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "GateIO" {
g = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := g.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := g.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := g.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := g.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := g.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,21 +82,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := g.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := g.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do LongPolling public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var g exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Gemini" {
g = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Gemini" {
g = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := g.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := g.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := g.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := g.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := g.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := g.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := g.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var h exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "HitBTC" {
h = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "HitBTC" {
h = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := h.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := h.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := h.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := h.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := h.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := h.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var h exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Huobi" {
h = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Huobi" {
h = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := h.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := h.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := h.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := h.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,21 +82,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := h.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := h.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var i exchange.IBotExchange
for x := range bot.Exchanges {
if bot.Exchanges[x].GetName() == "Itbit" {
i = bot.Exchanges[x]
}
if bot.Exchanges[x].GetName() == "Itbit" {
i = bot.Exchanges[x]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for x := range bot.Exchanges {
// Fetches current ticker information
tick, err := i.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := i.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := i.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := i.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := i.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := i.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := i.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var k exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Kraken" {
k = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Kraken" {
k = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := k.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := k.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := k.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := k.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := k.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := k.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := k.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var l exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "LakeBTC" {
l = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "LakeBTC" {
l = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := l.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := l.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,13 +83,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := l.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var l exchange.IBotExchange
for i := range Bot.Exchanges {
if Bot.Exchanges[i].GetName() == "Lbank" {
l = Bot.Exchanges[i]
}
if Bot.Exchanges[i].GetName() == "Lbank" {
l = Bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range Bot.Exchanges {
// Fetches current ticker information
tick, err := l.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := l.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := l.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var l exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "LocalBitcoins" {
l = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "LocalBitcoins" {
l = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := l.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := l.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := l.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := l.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var o exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "OKCoin" {
y = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "OKCoin" {
y = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := o.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := o.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := o.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := o.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := o.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := o.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := o.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var o exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "OKex" {
y = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "OKex" {
y = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := o.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := o.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := o.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := o.GetSpotTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := o.GetSpotMarketDepth()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// GetContractPosition returns contract positioning
accountInfo, err := o.GetContractPosition(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := o.PlaceContractOrders(...)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -3,9 +3,9 @@
## Current Features for {{.Name}}
+ This package services the exchanges package with order handling.
- Creation of order
- Deletion of order
- Order tracking
- Creation of order
- Deletion of order
- Order tracking
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}

View File

@@ -14,8 +14,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -31,9 +31,9 @@ main.go
var p exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Poloniex" {
y = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Poloniex" {
y = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -41,13 +41,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := p.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := p.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -56,7 +56,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := p.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -68,13 +68,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := p.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := p.GetOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -83,21 +83,21 @@ if err != nil {
// Cancels current account order
accountInfo, err := p.CancelOrder()
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := p.PlaceOrder(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package

View File

@@ -3,7 +3,7 @@
## Current Features for {{.Name}}
+ This package services the exchanges package with request handling.
- Throttling of requests for an individual exchange
- Throttling of requests for an individual exchange
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}

View File

@@ -3,8 +3,8 @@
## Current Features for {{.Name}}
+ This package allows for validation options to occur exchange side e.g.
- Checking for ID in an order cancellation struct.
- Determining the correct withdrawal bank details for a specific exchange.
- Checking for ID in an order cancellation struct.
- Determining the correct withdrawal bank details for a specific exchange.
+ Example Usage below:
@@ -14,21 +14,21 @@
// define your data structure across potential exchanges
type Critical struct {
ID string
Person string
Banks string
MoneysUSD float64
ID string
Person string
Banks string
MoneysUSD float64
}
// define validation and add a variadic param
func (supercritcalinfo *Critical) Validate(opt ...validate.Checker) error {
// define base level validation
if supercritcalinfo != nil {
// oh no this is nil, could panic program!
}
// define base level validation
if supercritcalinfo != nil {
// oh no this is nil, could panic program!
}
// range over potential checks coming from individual packages
var errs common.Errors
// range over potential checks coming from individual packages
var errs common.Errors
for _, o := range opt {
err := o.Check()
if err != nil {
@@ -39,18 +39,18 @@ func (supercritcalinfo *Critical) Validate(opt ...validate.Checker) error {
if errs != nil {
return errs
}
return nil
return nil
}
// define an exchange or package level check that returns a validate.Checker
// interface
func (supercritcalinfo *Critical) PleaseDontSendMoneyToParents() validate.Checker {
return validate.Check(func() error {
return validate.Check(func() error {
if supercritcalinfo.Person == "Mother Dearest" ||
supercritcalinfo.Person == "Father Dearest" {
return errors.New("nope")
}
return nil
supercritcalinfo.Person == "Father Dearest" {
return errors.New("nope")
}
return nil
})
}
@@ -61,13 +61,13 @@ d := Critical{Person: "Mother Dearest", MoneysUSD: 1337.30}
// This should not error
err := d.Validate()
if err != nil {
return err
return err
}
// This should error
err := d.Validate(d.PleaseDontSendMoneyToParents())
if err != nil {
return err
return err
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var y exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Yobit" {
y = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "Yobit" {
y = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := y.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := y.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := y.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := y.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := y.GetDepth()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,13 +82,13 @@ if err != nil {
// Fetches current account information
accountInfo, err := y.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := y.Trade("BTCUSD", "MARKET", 1, 2)
if err != nil {
// Handle error
// Handle error
}
```

View File

@@ -13,8 +13,8 @@
+ Individual package example below:
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### How to do REST public/private calls
@@ -30,9 +30,9 @@ main.go
var z exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "ZB" {
z = bot.Exchanges[i]
}
if bot.Exchanges[i].GetName() == "ZB" {
z = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
@@ -40,13 +40,13 @@ for i := range bot.Exchanges {
// Fetches current ticker information
tick, err := z.FetchTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := z.FetchOrderbook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
@@ -55,7 +55,7 @@ if err != nil {
// Fetches current account information
accountInfo, err := z.GetAccountInfo()
if err != nil {
// Handle error
// Handle error
}
```
@@ -67,13 +67,13 @@ if err != nil {
// Fetches current ticker information
ticker, err := z.GetTicker()
if err != nil {
// Handle error
// Handle error
}
// Fetches current orderbook information
ob, err := z.GetOrderBook()
if err != nil {
// Handle error
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
@@ -82,21 +82,21 @@ if err != nil {
// GetUserInfo returns account info
accountInfo, err := z.GetUserInfo(...)
if err != nil {
// Handle error
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := z.Trade(...)
if err != nil {
// Handle error
// Handle error
}
```
### How to do LongPolling public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package