* Fix bitmex order params

* Fix insecure endpoint check

* comment on Title funcs

* tests for Title func

* fix order_test

Co-authored-by: Allie c( ⁰ 〰 ⁰ )੭ <88z@pm.me>
This commit is contained in:
Allie
2020-03-08 15:20:33 -07:00
committed by GitHub
parent 13e7db3565
commit 80f4cf1784
4 changed files with 22 additions and 4 deletions

View File

@@ -437,10 +437,10 @@ func (b *Bitmex) SubmitOrder(s *order.Submit) (order.SubmitResponse, error) {
}
var orderNewParams = OrderNewParams{
OrderType: s.Side.String(),
OrderType: s.Type.Title(),
Symbol: s.Pair.String(),
OrderQuantity: s.Amount,
Side: s.Side.String(),
Side: s.Side.Title(),
}
if s.Type == order.Limit {

View File

@@ -631,7 +631,7 @@ func (e *Base) SetAPIURL() error {
}
checkInsecureEndpoint := func(endpoint string) {
if !strings.Contains(endpoint, "https") {
if strings.Contains(endpoint, "https") {
return
}
log.Warnf(log.ExchangeSys,

View File

@@ -92,7 +92,11 @@ func TestOrderSides(t *testing.T) {
}
if os.Lower() != "buy" {
t.Errorf("unexpected string %s", os.String())
t.Errorf("unexpected string %s", os.Lower())
}
if os.Title() != "Buy" {
t.Errorf("unexpected string %s", os.Title())
}
}
@@ -108,6 +112,10 @@ func TestOrderTypes(t *testing.T) {
if ot.Lower() != "mo'money" {
t.Errorf("unexpected string %s", ot.Lower())
}
if ot.Title() != "Mo'Money" {
t.Errorf("unexpected string %s", ot.Title())
}
}
func TestFilterOrdersByType(t *testing.T) {

View File

@@ -349,6 +349,11 @@ func (t Type) Lower() string {
return strings.ToLower(string(t))
}
// Title returns the type titleized, eg "Limit"
func (t Type) Title() string {
return strings.Title(strings.ToLower(string(t)))
}
// String implements the stringer interface
func (s Side) String() string {
return string(s)
@@ -359,6 +364,11 @@ func (s Side) Lower() string {
return strings.ToLower(string(s))
}
// Title returns the side titleized, eg "Buy"
func (s Side) Title() string {
return strings.Title(strings.ToLower(string(s)))
}
// String implements the stringer interface
func (s Status) String() string {
return string(s)