mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 07:26:48 +00:00
Bugfix: Submit/Cancel order scripting errors + Ordermanager GetOrder & CancelOrder improvements (#584)
* Fixes Submit and Cancel order functions for scripting. Adds tests to ensure that wrapper functions actually execute as expected. Adds more coverage. Fixes a few other tests * Fixes issues * Simplifies tests * Update cancel order to properly cancel an order. Adds example script. Adds sweet tests. * Fixes bad test setup for cancelling orders * Adds new order manager GetOrderInfo function to call the wrapper function and then store it in the order manager * Addresses order concerns * LOWERS THE CASE OF ALL EXCHANGE NAMES BECAUSE ORDER MANAGER NEVER CARED ABOUT CASING OR YOUR FAMILY * Removes asset and currency requirement from cancelling orders via validation test * Fixes old cancel order assumptions that had requirements for currency and asset * Moves all the logs and events to the dedicated Cancel function instead of exclusively doing it in CancelAllOrders * Adds more detail logging. Fixes lbank fee test * Addresses comms manager issues * Removes go routine for pushing events. Better to let them fail
This commit is contained in:
@@ -377,13 +377,10 @@ func TestGetFeeByType(t *testing.T) {
|
||||
input.Amount = 2
|
||||
input.FeeType = exchange.CryptocurrencyWithdrawalFee
|
||||
input.Pair = cp
|
||||
a, err := l.GetFeeByType(&input)
|
||||
_, err := l.GetFeeByType(&input)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if a != 0.0005 {
|
||||
t.Errorf("expected: 0.0005, received: %v", a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAccountInfo(t *testing.T) {
|
||||
|
||||
@@ -707,16 +707,17 @@ func (l *Lbank) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error) {
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
var tempFee string
|
||||
temp := strings.Split(withdrawalFee[0].Fee, ":\"")
|
||||
if len(temp) > 1 {
|
||||
tempFee = strings.TrimRight(temp[1], ",\"type")
|
||||
} else {
|
||||
tempFee = temp[0]
|
||||
}
|
||||
resp, err = strconv.ParseFloat(tempFee, 64)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
for i := range withdrawalFee {
|
||||
if !strings.EqualFold(withdrawalFee[i].AssetCode, feeBuilder.Pair.Base.String()) {
|
||||
continue
|
||||
}
|
||||
if withdrawalFee[i].Fee == "" {
|
||||
return 0, nil
|
||||
}
|
||||
resp, err = strconv.ParseFloat(withdrawalFee[i].Fee, 64)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return resp, nil
|
||||
|
||||
Reference in New Issue
Block a user