Exchanges: Include format pair in wrapper functions and test for formatting issues via tool wrapper issues (#582)

* Adds formatting of pair within binance wrapper, adds return of error from cli.ShowCommmandHelp

* Add formatting function to submit order wrapper functions

* Remove superfluous functionality

* Updated exchange wrapper issues to create a disruptive pair to see which exchanges require attention, updates currency code generation and matching

* reinstated format check, fixed tests

* fixed niterinos

* fix test

* fix spelling mistake

* make html file more aesthetic

* Add missing format pairs

* add formatting to pair for BTC Markets func

* fix spelling
This commit is contained in:
Ryan O'Hara-Reid
2020-10-26 16:54:51 +11:00
committed by GitHub
parent 8a241c2efa
commit 220245c5a8
32 changed files with 429 additions and 199 deletions

View File

@@ -144,23 +144,17 @@ func (b *BaseCodes) UpdateCurrency(fullName, symbol, blockchain string, id int,
// Register registers a currency from a string and returns a currency code
func (b *BaseCodes) Register(c string) Code {
NewUpperCode := c
lower := true
for _, r := range c {
if !unicode.IsLower(r) {
lower = false
break
}
var format bool
if c != "" {
format = unicode.IsUpper(rune(c[0]))
}
if lower {
NewUpperCode = strings.ToUpper(c)
}
format := strings.Contains(c, NewUpperCode)
// Force upper string storage and matching
c = strings.ToUpper(c)
b.mtx.Lock()
defer b.mtx.Unlock()
for i := range b.Items {
if b.Items[i].Symbol == NewUpperCode {
if b.Items[i].Symbol == c {
return Code{
Item: b.Items[i],
UpperCase: format,
@@ -168,7 +162,7 @@ func (b *BaseCodes) Register(c string) Code {
}
}
newItem := &Item{Symbol: NewUpperCode}
newItem := &Item{Symbol: c}
b.Items = append(b.Items, newItem)
return Code{
@@ -240,7 +234,7 @@ func (c Code) String() string {
}
if c.UpperCase {
return c.Item.Symbol
return strings.ToUpper(c.Item.Symbol)
}
return strings.ToLower(c.Item.Symbol)
}