mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
ItBit: Remove exchange implementation (#1463)
This commit is contained in:
@@ -38,7 +38,6 @@ const (
|
||||
pathBitmex = "https://www.bitmex.com/static/md/en-US/apiChangelog"
|
||||
pathANX = "https://anxv3.docs.apiary.io/"
|
||||
pathPoloniex = "https://docs.poloniex.com/#changelog"
|
||||
pathIbBit = "https://api.itbit.com/docs"
|
||||
pathBTCMarkets = "https://api.btcmarkets.net/openapi/info/index.yaml"
|
||||
pathEXMO = "https://exmo.com/en/api/"
|
||||
pathBitstamp = "https://www.bitstamp.net/api/"
|
||||
@@ -468,8 +467,6 @@ func checkChangeLog(htmlData *HTMLScrapingData) (string, error) {
|
||||
dataStrings, err = htmlScrapeANX(htmlData)
|
||||
case pathPoloniex:
|
||||
dataStrings, err = htmlScrapePoloniex(htmlData)
|
||||
case pathIbBit:
|
||||
dataStrings, err = htmlScrapeItBit(htmlData)
|
||||
case pathBTCMarkets:
|
||||
dataStrings, err = htmlScrapeBTCMarkets(htmlData)
|
||||
case pathEXMO:
|
||||
@@ -963,41 +960,6 @@ loop:
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// htmlScrapeItBit gets the check string for ItBit Exchange
|
||||
func htmlScrapeItBit(htmlData *HTMLScrapingData) ([]string, error) {
|
||||
var resp []string
|
||||
temp, err := sendHTTPGetRequest(htmlData.Path, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer temp.Body.Close()
|
||||
tokenizer := html.NewTokenizer(temp.Body)
|
||||
loop:
|
||||
for {
|
||||
next := tokenizer.Next()
|
||||
switch next {
|
||||
case html.ErrorToken:
|
||||
break loop
|
||||
case html.StartTagToken:
|
||||
token := tokenizer.Token()
|
||||
if token.Data == htmlData.TokenData {
|
||||
for _, z := range token.Attr {
|
||||
if z.Key == htmlData.Key {
|
||||
r, err := regexp.Compile(htmlData.RegExp)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
if r.MatchString(z.Val) {
|
||||
resp = append(resp, z.Val)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// htmlScrapeBitstamp gets the check string for Bitstamp Exchange
|
||||
func htmlScrapeBitstamp(htmlData *HTMLScrapingData) ([]string, error) {
|
||||
temp, err := sendHTTPGetRequest(htmlData.Path, nil)
|
||||
|
||||
@@ -317,21 +317,6 @@ func TestHTMLPoloniex(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTMLItBit(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{TokenData: "a",
|
||||
Key: "href",
|
||||
Val: "changelog",
|
||||
TokenDataEnd: "div",
|
||||
TextTokenData: "h2",
|
||||
DateFormat: "2006-01-02",
|
||||
RegExp: `^https://api.itbit.com/v\d{1}/$`,
|
||||
Path: "https://api.itbit.com/docs"}
|
||||
if _, err := htmlScrapeItBit(&data); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHTMLScrapeExmo(t *testing.T) {
|
||||
t.Parallel()
|
||||
data := HTMLScrapingData{RegExp: `Last updated on [\s\S]*, 20\d{2}`,
|
||||
|
||||
@@ -169,20 +169,6 @@
|
||||
},
|
||||
"Disabled": false
|
||||
},
|
||||
{
|
||||
"Name": "ItBit",
|
||||
"CheckType": "HTML String Check",
|
||||
"Data": {
|
||||
"HTMLData": {
|
||||
"TokenData": "a",
|
||||
"Key": "href",
|
||||
"RegExp": "^https://api.itbit.com/v\\d{1}/$",
|
||||
"CheckString": "https://api.itbit.com/v1/",
|
||||
"Path": "https://api.itbit.com/docs"
|
||||
}
|
||||
},
|
||||
"Disabled": false
|
||||
},
|
||||
{
|
||||
"Name": "Bitmex",
|
||||
"CheckType": "HTML String Check",
|
||||
|
||||
@@ -169,20 +169,6 @@
|
||||
},
|
||||
"Disabled": false
|
||||
},
|
||||
{
|
||||
"Name": "ItBit",
|
||||
"CheckType": "HTML String Check",
|
||||
"Data": {
|
||||
"HTMLData": {
|
||||
"TokenData": "a",
|
||||
"Key": "href",
|
||||
"RegExp": "^https://api.itbit.com/v\\d{1}/$",
|
||||
"CheckString": "https://api.itbit.com/v1/",
|
||||
"Path": "https://api.itbit.com/docs"
|
||||
}
|
||||
},
|
||||
"Disabled": false
|
||||
},
|
||||
{
|
||||
"Name": "Bitmex",
|
||||
"CheckType": "HTML String Check",
|
||||
|
||||
@@ -59,7 +59,6 @@ _b in this context is an `IBotExchange` implemented struct_
|
||||
| Gemini | Yes | Yes | Yes |
|
||||
| HitBTC | Yes | Yes | Yes |
|
||||
| Huobi.Pro | Yes | Yes | No |
|
||||
| ItBit | Yes | NA | No |
|
||||
| Kraken | Yes | Yes | No |
|
||||
| Kucoin | Yes | No | Yes |
|
||||
| Lbank | Yes | No | Yes |
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
{{define "exchanges itbit" -}}
|
||||
{{template "header" .}}
|
||||
## Itbit Exchange
|
||||
|
||||
### Current Features
|
||||
|
||||
+ REST Support
|
||||
|
||||
### How to enable
|
||||
|
||||
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)
|
||||
|
||||
+ Individual package example below:
|
||||
|
||||
```go
|
||||
// Exchanges will be abstracted out in further updates and examples will be
|
||||
// supplied then
|
||||
```
|
||||
|
||||
### How to do REST public/private calls
|
||||
|
||||
+ If enabled via "configuration".json file the exchange will be added to the
|
||||
IBotExchange array in the ```go var bot Bot``` and you will only be able to use
|
||||
the wrapper interface functions for accessing exchange data. View routines.go
|
||||
for an example of integration usage with GoCryptoTrader. Rudimentary example
|
||||
below:
|
||||
|
||||
main.go
|
||||
```go
|
||||
var i exchange.IBotExchange
|
||||
|
||||
for x := range bot.Exchanges {
|
||||
if bot.Exchanges[x].GetName() == "Itbit" {
|
||||
i = bot.Exchanges[x]
|
||||
}
|
||||
}
|
||||
|
||||
// Public calls - wrapper functions
|
||||
|
||||
// Fetches current ticker information
|
||||
tick, err := i.FetchTicker()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Fetches current orderbook information
|
||||
ob, err := i.FetchOrderbook()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
|
||||
// set and AuthenticatedAPISupport is set to true
|
||||
|
||||
// Fetches current account information
|
||||
accountInfo, err := i.GetAccountInfo()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
+ If enabled via individually importing package, rudimentary example below:
|
||||
|
||||
```go
|
||||
// Public calls
|
||||
|
||||
// Fetches current ticker information
|
||||
ticker, err := i.GetTicker()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Fetches current orderbook information
|
||||
ob, err := i.GetOrderBook()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Private calls - make sure your APIKEY and APISECRET are set and
|
||||
// AuthenticatedAPISupport is set to true
|
||||
|
||||
// GetUserInfo returns account info
|
||||
accountInfo, err := i.GetUserInfo(...)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
// Submits an order and the exchange and returns its tradeID
|
||||
tradeID, err := i.Trade(...)
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
### Please click GoDocs chevron above to view current GoDoc information for this package
|
||||
{{template "contributions"}}
|
||||
{{template "donations" .}}
|
||||
{{end}}
|
||||
@@ -37,7 +37,6 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
|
||||
| Gemini | Yes | Yes | No |
|
||||
| HitBTC | Yes | Yes | No |
|
||||
| Huobi.Pro | Yes | Yes | NA |
|
||||
| ItBit | Yes | NA | No |
|
||||
| Kraken | Yes | Yes | NA |
|
||||
| Kucoin | Yes | Yes | NA |
|
||||
| Lbank | Yes | No | NA |
|
||||
|
||||
@@ -34,10 +34,6 @@ func main() {
|
||||
var wg sync.WaitGroup
|
||||
for i := range exchange.Exchanges {
|
||||
name := exchange.Exchanges[i]
|
||||
if name == "ftx" {
|
||||
log.Println("Skipping exchange FTX...")
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
@@ -602,7 +602,6 @@ var unsupportedExchangeNames = []string{
|
||||
"testexch",
|
||||
"alphapoint",
|
||||
"bitflyer", // Bitflyer has many "ErrNotYetImplemented, which is true, but not what we care to test for here
|
||||
"itbit", // itbit has no way of retrieving pair data
|
||||
"btse", // TODO rm once timeout issues resolved
|
||||
"poloniex", // outdated API // TODO rm once updated
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user