exchanges: Remove LocalBitcoins and fix Bybit tests (#1142)

This commit is contained in:
Adrian Gallagher
2023-02-22 15:23:18 +11:00
committed by GitHub
parent e94f9bb0a2
commit e44ae3d75f
32 changed files with 14 additions and 10638 deletions

View File

@@ -17,7 +17,6 @@ import (
"time"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/common/crypto"
gctfile "github.com/thrasher-corp/gocryptotrader/common/file"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
@@ -48,7 +47,6 @@ const (
pathKraken = "https://www.kraken.com/features/api"
pathAlphaPoint = "https://alphapoint.github.io/slate/#introduction"
pathYobit = "https://www.yobit.net/en/api/"
pathLocalBitcoins = "https://localbitcoins.com/api-docs/"
pathGetAllLists = "https://api.trello.com/1/boards/%s/lists?cards=none&card_fields=all&filter=open&fields=all&key=%s&token=%s"
pathNewCard = "https://api.trello.com/1/cards?idList=%s&name=%s&key=%s&token=%s"
pathChecklists = "https://api.trello.com/1/checklists/%s/checkItems?%s&key=%s&token=%s"
@@ -488,8 +486,6 @@ func checkChangeLog(htmlData *HTMLScrapingData) (string, error) {
dataStrings, err = htmlScrapeAlphaPoint(htmlData)
case pathYobit:
dataStrings, err = htmlScrapeYobit(htmlData)
case pathLocalBitcoins:
dataStrings, err = htmlScrapeLocalBitcoins(htmlData)
case pathOkCoin:
dataStrings, err = htmlScrapeOk(htmlData)
default:
@@ -1137,32 +1133,6 @@ loop:
return resp, nil
}
// htmlScrapeLocalBitcoins gets the check string for Yobit Exchange
func htmlScrapeLocalBitcoins(htmlData *HTMLScrapingData) ([]string, error) {
temp, err := sendHTTPGetRequest(htmlData.Path, nil)
if err != nil {
return nil, err
}
defer temp.Body.Close()
a, err := io.ReadAll(temp.Body)
if err != nil {
return nil, err
}
r, err := regexp.Compile(htmlData.RegExp)
if err != nil {
return nil, err
}
str := r.FindString(string(a))
sha, err := crypto.GetSHA256([]byte(str))
if err != nil {
return nil, err
}
var resp []string
resp = append(resp, crypto.HexEncodeToString(sha))
return resp, nil
}
// trelloCreateNewCheck creates a new checklist item within a given checklist from trello
func trelloCreateNewCheck(newCheckName string) error {
newName, err := nameStateChanges(newCheckName, "")

View File

@@ -386,16 +386,6 @@ func TestHTMLYobit(t *testing.T) {
}
}
func TestHTMLScrapeLocalBitcoins(t *testing.T) {
t.Parallel()
data := HTMLScrapingData{TokenData: "div",
RegExp: `col-md-12([\s\S]*?)clearfix`,
Path: "https://localbitcoins.com/api-docs/"}
if _, err := htmlScrapeLocalBitcoins(&data); err != nil {
t.Error(err)
}
}
func TestHTMLScrapeOk(t *testing.T) {
t.Parallel()
data := HTMLScrapingData{TokenData: "a",

View File

@@ -327,21 +327,6 @@
},
"Disabled": false
},
{
"Name": "LocalBitcoins",
"CheckType": "HTML String Check",
"Data": {
"HTMLData": {
"TokenData": "div",
"Key": "class",
"Val": "col-md-12",
"RegExp": "col-md-12([\\s\\S]*?)clearfix",
"CheckString": "37a144dc619776b87c098da5a88bef7fed6c8a7cea2d4b9a38c96750726c93ff",
"Path": "https://localbitcoins.com/api-docs/"
}
},
"Disabled": false
},
{
"Name": "OkCoin International",
"CheckType": "HTML String Check",

View File

@@ -327,21 +327,6 @@
},
"Disabled": false
},
{
"Name": "LocalBitcoins",
"CheckType": "HTML String Check",
"Data": {
"HTMLData": {
"TokenData": "div",
"Key": "class",
"Val": "col-md-12",
"RegExp": "col-md-12([\\s\\S]*?)clearfix",
"CheckString": "37a144dc619776b87c098da5a88bef7fed6c8a7cea2d4b9a38c96750726c93ff",
"Path": "https://localbitcoins.com/api-docs/"
}
},
"Disabled": false
},
{
"Name": "OkCoin International",
"CheckType": "HTML String Check",

View File

@@ -63,7 +63,6 @@ _b in this context is an `IBotExchange` implemented struct_
| ItBit | Yes | NA | No |
| Kraken | Yes | Yes | No |
| Lbank | Yes | No | Yes |
| LocalBitcoins | Yes | NA | No |
| OKCoin International | Yes | Yes | No |
| Okx | Yes | Yes | Yes |
| Poloniex | Yes | Yes | Yes |

View File

@@ -1,98 +0,0 @@
{{define "exchanges localbitcoins" -}}
{{template "header" .}}
## LocalBitcoins 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 l exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "LocalBitcoins" {
l = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := l.FetchTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := l.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 := l.GetAccountInfo()
if err != nil {
// Handle error
}
```
+ If enabled via individually importing package, rudimentary example below:
```go
// Public calls
// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := l.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 := l.GetUserInfo(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
// Handle error
}
```
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations" .}}
{{end}}

View File

@@ -41,7 +41,6 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| ItBit | Yes | NA | No |
| Kraken | Yes | Yes | NA |
| Lbank | Yes | No | NA |
| LocalBitcoins | Yes | NA | NA |
| OKCoin International | Yes | Yes | No |
| Okx | Yes | Yes | NA |
| Poloniex | Yes | Yes | NA |

View File

@@ -141,11 +141,6 @@
"secret": "Secret",
"otpSecret": "-"
},
"localbitcoins": {
"key": "Key",
"secret": "Secret",
"otpSecret": "-"
},
"okcoin international": {
"key": "Key",
"secret": "Secret",