diff --git a/exchanges/bitmex/bitmex_wrapper.go b/exchanges/bitmex/bitmex_wrapper.go index b4e5a6ee..96cdc678 100644 --- a/exchanges/bitmex/bitmex_wrapper.go +++ b/exchanges/bitmex/bitmex_wrapper.go @@ -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 { diff --git a/exchanges/exchange.go b/exchanges/exchange.go index b4026650..2f218583 100644 --- a/exchanges/exchange.go +++ b/exchanges/exchange.go @@ -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, diff --git a/exchanges/order/order_test.go b/exchanges/order/order_test.go index 7971c9e2..3e83148f 100644 --- a/exchanges/order/order_test.go +++ b/exchanges/order/order_test.go @@ -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) { diff --git a/exchanges/order/orders.go b/exchanges/order/orders.go index 6bc2c4ec..cab3812f 100644 --- a/exchanges/order/orders.go +++ b/exchanges/order/orders.go @@ -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)