mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
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:
@@ -142,9 +142,9 @@ Binaries will be published once the codebase reaches a stable condition.
|
||||
|User|Contribution Amount|
|
||||
|--|--|
|
||||
| [thrasher-](https://github.com/thrasher-) | 643 |
|
||||
| [shazbert](https://github.com/shazbert) | 195 |
|
||||
| [shazbert](https://github.com/shazbert) | 196 |
|
||||
| [gloriousCode](https://github.com/gloriousCode) | 170 |
|
||||
| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 68 |
|
||||
| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 69 |
|
||||
| [xtda](https://github.com/xtda) | 47 |
|
||||
| [ermalguni](https://github.com/ermalguni) | 14 |
|
||||
| [vadimzhukck](https://github.com/vadimzhukck) | 10 |
|
||||
|
||||
@@ -62,18 +62,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,7 +85,7 @@ func TestAdd(t *testing.T) {
|
||||
err := Add("Lbank", github, fmt.Sprintf(githubPath, data.Repo), data, false, &configData)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
}}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"}}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
177
cmd/documentation/exchanges_templates/exchanges_mock_readme.tmpl
Normal file
177
cmd/documentation/exchanges_templates/exchanges_mock_readme.tmpl
Normal 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}}
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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"}}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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"}}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"}}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
// Please supply your own keys here to do authenticated endpoint testing
|
||||
const (
|
||||
apiKey = ""
|
||||
apiSecret = ""
|
||||
canManipulateRealOrders = false
|
||||
apiKey = ""
|
||||
apiSecret = ""
|
||||
canManipulateRealOrders = false
|
||||
)
|
||||
|
||||
var {{.Variable}} {{.CapitalName}}
|
||||
|
||||
@@ -227,7 +227,7 @@ func ({{.Variable}} *{{.CapitalName}}) UpdateTradablePairs(forceUpdate bool) err
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error) {
|
||||
// NOTE: EXAMPLE FOR GETTING TICKER PRICE
|
||||
// NOTE: EXAMPLE FOR GETTING TICKER PRICE
|
||||
/*
|
||||
tickerPrice := new(ticker.Price)
|
||||
tick, err := {{.Variable}}.GetTicker(p.String())
|
||||
@@ -235,13 +235,13 @@ func ({{.Variable}} *{{.CapitalName}}) UpdateTicker(p currency.Pair, assetType a
|
||||
return tickerPrice, err
|
||||
}
|
||||
tickerPrice = &ticker.Price{
|
||||
High: tick.High,
|
||||
Low: tick.Low,
|
||||
Bid: tick.Bid,
|
||||
Ask: tick.Ask,
|
||||
Open: tick.Open,
|
||||
Close: tick.Close,
|
||||
Pair: p,
|
||||
High: tick.High,
|
||||
Low: tick.Low,
|
||||
Bid: tick.Bid,
|
||||
Ask: tick.Ask,
|
||||
Open: tick.Open,
|
||||
Close: tick.Close,
|
||||
Pair: p,
|
||||
}
|
||||
err = ticker.ProcessTicker({{.Variable}}.Name, tickerPrice, assetType)
|
||||
if err != nil {
|
||||
@@ -272,7 +272,7 @@ func ({{.Variable}} *{{.CapitalName}}) FetchOrderbook(currency currency.Pair, as
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
|
||||
orderBook := new(orderbook.Base)
|
||||
// NOTE: UPDATE ORDERBOOK EXAMPLE
|
||||
// NOTE: UPDATE ORDERBOOK EXAMPLE
|
||||
/*
|
||||
orderbookNew, err := {{.Variable}}.GetOrderBook(exchange.FormatExchangeCurrency({{.Variable}}.Name, p).String(), 1000)
|
||||
if err != nil {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -80,8 +80,9 @@ func TestZip(t *testing.T) {
|
||||
if filepath.Base(o[0]) != "binance.json" || filepath.Base(o[4]) != "localbitcoins.json" {
|
||||
t.Fatal("unexpected archive result received")
|
||||
}
|
||||
if len(o) != 6 {
|
||||
t.Fatalf("expected 2 files to be extracted received: %v ", len(o))
|
||||
expected := 7
|
||||
if len(o) != expected {
|
||||
t.Fatalf("expected %v files to be extracted received: %v ", expected, len(o))
|
||||
}
|
||||
|
||||
folder = filepath.Join("..", "..", "..", "testdata", "invalid_file.json")
|
||||
|
||||
@@ -29,7 +29,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
|
||||
|
||||
@@ -46,10 +46,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",
|
||||
}}
|
||||
|
||||
|
||||
@@ -44,12 +44,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)
|
||||
|
||||
@@ -29,42 +29,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
|
||||
|
||||
@@ -24,21 +24,21 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
|
||||
+ 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
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
## Current Features for currency
|
||||
|
||||
+ 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
|
||||
|
||||
|
||||
@@ -37,13 +37,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)
|
||||
|
||||
@@ -37,13 +37,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)
|
||||
|
||||
@@ -37,13 +37,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)
|
||||
|
||||
@@ -37,13 +37,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)
|
||||
|
||||
@@ -37,13 +37,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)
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -817,7 +817,7 @@ func (b *Binance) GetHistoricCandles(pair currency.Pair, a asset.Item, start, en
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: candles[x].OpenTime,
|
||||
Open: candles[x].Open,
|
||||
High: candles[x].Close,
|
||||
High: candles[x].High,
|
||||
Low: candles[x].Low,
|
||||
Close: candles[x].Close,
|
||||
Volume: candles[x].Volume,
|
||||
@@ -865,7 +865,7 @@ func (b *Binance) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, s
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: candles[i].OpenTime,
|
||||
Open: candles[i].Open,
|
||||
High: candles[i].Close,
|
||||
High: candles[i].High,
|
||||
Low: candles[i].Low,
|
||||
Close: candles[i].Close,
|
||||
Volume: candles[i].Volume,
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -883,7 +883,7 @@ func (b *Bitfinex) GetHistoricCandles(pair currency.Pair, a asset.Item, start, e
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: candles[x].Timestamp,
|
||||
Open: candles[x].Open,
|
||||
High: candles[x].Close,
|
||||
High: candles[x].High,
|
||||
Low: candles[x].Low,
|
||||
Close: candles[x].Close,
|
||||
Volume: candles[x].Volume,
|
||||
@@ -925,7 +925,7 @@ func (b *Bitfinex) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item,
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: candles[i].Timestamp,
|
||||
Open: candles[i].Open,
|
||||
High: candles[i].Close,
|
||||
High: candles[i].High,
|
||||
Low: candles[i].Low,
|
||||
Close: candles[i].Close,
|
||||
Volume: candles[i].Volume,
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,21 +100,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
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,13 +101,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := b.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,13 +101,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := c.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := c.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := c.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := e.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := f.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,13 +101,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := g.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,21 +100,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
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := g.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := h.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := h.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,21 +100,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
|
||||
|
||||
@@ -1045,7 +1045,7 @@ func (h *HUOBI) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: time.Unix(candles[x].ID, 0),
|
||||
Open: candles[x].Open,
|
||||
High: candles[x].Close,
|
||||
High: candles[x].High,
|
||||
Low: candles[x].Low,
|
||||
Close: candles[x].Close,
|
||||
Volume: candles[x].Volume,
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := i.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := k.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -912,7 +912,7 @@ func (k *Kraken) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: timeValue,
|
||||
Open: candles[x].Open,
|
||||
High: candles[x].Close,
|
||||
High: candles[x].High,
|
||||
Low: candles[x].Low,
|
||||
Close: candles[x].Close,
|
||||
Volume: candles[x].Volume,
|
||||
@@ -955,7 +955,7 @@ func (k *Kraken) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, st
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: timeValue,
|
||||
Open: candles[i].Open,
|
||||
High: candles[i].Close,
|
||||
High: candles[i].High,
|
||||
Low: candles[i].Low,
|
||||
Close: candles[i].Close,
|
||||
Volume: candles[i].Volume,
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := l.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,13 +101,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := l.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := l.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
[](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
|
||||
|
||||
|
||||
This Mock package is part of the GoCryptoTrader codebase.
|
||||
This mock package is part of the GoCryptoTrader codebase.
|
||||
|
||||
## This is still in active development
|
||||
|
||||
@@ -20,16 +20,17 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
|
||||
## Mock Testing Suite
|
||||
|
||||
### Current Features
|
||||
|
||||
+ REST recording service
|
||||
## Current Features for mock
|
||||
+ REST recording service
|
||||
+ REST mock response server
|
||||
|
||||
### How to enable
|
||||
|
||||
+ Mock testing is enabled by default in some exchanges; to disable and run live endpoint testing parse -tags=mock_test_off as a go test param.
|
||||
+ 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.
|
||||
|
||||
+ To record a live endpoint create two files for an exchange.
|
||||
## Mock test setup
|
||||
|
||||
+ Create two additional test files for the exchange. Examples are below:
|
||||
|
||||
### file one - your_current_exchange_name_live_test.go
|
||||
|
||||
@@ -58,12 +59,12 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
log.Fatal("your_current_exchange_name Setup() init error", err)
|
||||
}
|
||||
your_current_exchange_nameConfig.AuthenticatedAPISupport = true
|
||||
your_current_exchange_nameConfig.APIKey = apiKey
|
||||
your_current_exchange_nameConfig.APISecret = apiSecret
|
||||
l.SetDefaults()
|
||||
l.Setup(&your_current_exchange_nameConfig)
|
||||
log.Printf(sharedtestvalues.LiveTesting, l.Name, l.APIUrl)
|
||||
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())
|
||||
}
|
||||
```
|
||||
@@ -98,59 +99,96 @@ func TestMain(m *testing.M) {
|
||||
if err != nil {
|
||||
log.Fatal("your_current_exchange_name Setup() init error", err)
|
||||
}
|
||||
your_current_exchange_nameConfig.AuthenticatedAPISupport = true
|
||||
your_current_exchange_nameConfig.APIKey = apiKey
|
||||
your_current_exchange_nameConfig.APISecret = apiSecret
|
||||
l.SetDefaults()
|
||||
l.Setup(&your_current_exchange_nameConfig)
|
||||
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)
|
||||
}
|
||||
|
||||
g.HTTPClient = newClient
|
||||
g.APIUrl = serverDetails
|
||||
s.HTTPClient = newClient
|
||||
s.API.Endpoints.URL = serverDetails
|
||||
|
||||
log.Printf(sharedtestvalues.MockTesting, l.Name, l.APIUrl)
|
||||
log.Printf(sharedtestvalues.MockTesting, s.Name, s.API.Endpoints.URL)
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
+ Once those files are completed go through each invidual test function and add
|
||||
## 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.APIURL = exchangeDefaultURL // This will overwrite the current mock url at localhost
|
||||
s.Verbose = true // This will show you some fancy debug output
|
||||
s.HTTPRecording = true // This will record the request and response payloads
|
||||
|
||||
err := s.SomeExchangeEndpointFunction()
|
||||
// check error
|
||||
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
|
||||
}
|
||||
```
|
||||
|
||||
+ After this is completed it should populate a new mocktest.json file for you with the relavent payloads in testdata
|
||||
+ 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.APIURL = exchangeDefaultURL // This will overwrite the current mock url at localhost
|
||||
s.Verbose = true // This will show you some fancy debug output
|
||||
// s.HTTPRecording = true // This will record the request and response payloads
|
||||
|
||||
err := s.SomeExchangeEndpointFunction()
|
||||
// check error
|
||||
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
|
||||
|
||||
## Contribution
|
||||
@@ -171,4 +209,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:
|
||||
|
||||
***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc***
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := o.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -31,8 +31,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -48,9 +48,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
|
||||
@@ -58,13 +58,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
|
||||
@@ -73,7 +73,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := o.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,13 +85,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
|
||||
@@ -100,13 +100,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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
|
||||
+ 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
|
||||
@@ -36,7 +36,7 @@ Examples below:
|
||||
```go
|
||||
ob, err := yobitExchange.FetchOrderbook()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Find total asks which also returns total orderbook value
|
||||
@@ -49,7 +49,7 @@ the package itself.
|
||||
```go
|
||||
ob, err := orderbook.Get(...)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
+ 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
|
||||
@@ -49,9 +49,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
|
||||
@@ -59,13 +59,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
|
||||
@@ -74,7 +74,7 @@ if err != nil {
|
||||
// Fetches current account information
|
||||
accountInfo, err := p.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
@@ -86,13 +86,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
|
||||
@@ -101,21 +101,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
|
||||
|
||||
@@ -713,7 +713,7 @@ func (p *Poloniex) GetHistoricCandles(pair currency.Pair, a asset.Item, start, e
|
||||
ret.Candles = append(ret.Candles, kline.Candle{
|
||||
Time: time.Unix(candles[x].Date, 0),
|
||||
Open: candles[x].Open,
|
||||
High: candles[x].Close,
|
||||
High: candles[x].High,
|
||||
Low: candles[x].Low,
|
||||
Close: candles[x].Close,
|
||||
Volume: candles[x].Volume,
|
||||
|
||||
@@ -21,7 +21,7 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
## Current Features for request
|
||||
|
||||
+ 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
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
|
||||
+ 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
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user