(BTC Markets): Wrapper SubmitOrder parameter order fix & IsOrderPlaced condition correction (#394)

* corrected param order Side -> Type, also corrected condition check for IsOrderPlaced

* send open status for GetActiveOrders

* GetActiveOrder() changes to include OrderID and status matching

* BTC Markets batch order limit fixes & SplitStringSliceByLimit  method

BTC markets batch end points have limits (20 for cancel 50 for query) adds new method SplitStringSliceByLimit in common to split a slice by limit and return slice of slice

* rm line :D

* Added test for SplitStringSliceByLimit and moved to const

* ntp client reworked to not return error if no valid time servers are found but default to system

* clean up

* new line added

* use TimeMgr sublogger and wording correction on output

* Moved to DialTimeout() & Removed SetDeadline call

* removed line

* added setdeadline fix

* goimport file

* removed unused error from NTPClient as we now default to system time if no server can be reached

* Added checks for number overflows

* converted to uint as you should not be passing a negative number in

* Increased test cases for NTPClient

* Removed Helper call as no longer outputting any data from function

* removed unused param
This commit is contained in:
Andrew
2019-12-16 14:47:54 +11:00
committed by Adrian Gallagher
parent 25e290563c
commit a727beeb15
9 changed files with 145 additions and 81 deletions

View File

@@ -220,7 +220,7 @@ func (o *orderManager) Submit(exchName string, newOrder *order.Submit) (*orderSu
return nil, err
}
if result.IsOrderPlaced {
if !result.IsOrderPlaced {
return nil, errors.New("order unable to be placed")
}

View File

@@ -110,15 +110,12 @@ func (n *ntpManager) run() {
}
}
func (n *ntpManager) FetchNTPTime() (time.Time, error) {
func (n *ntpManager) FetchNTPTime() time.Time {
return ntpclient.NTPClient(Bot.Config.NTPClient.Pool)
}
func (n *ntpManager) processTime() error {
NTPTime, err := n.FetchNTPTime()
if err != nil {
return err
}
NTPTime := n.FetchNTPTime()
currentTime := time.Now()
NTPcurrentTimeDifference := NTPTime.Sub(currentTime)