BTSE: Various fixes (#1550)

* Common: DriveBy sanitisation of vars

* BTSE: Unify to exchange OrderLimits

* BTSE: Remove SeedAssets and test GetOrderExcutionLimit

* BTSE: Fix handling for K_* pairs

In addition to the M_ pairs we previously handled, BTSE has now
introduced K_* pairs (K_SATS-USD*).

This change moves the handling over to look for an exponent, and moves
the filtering to happen on all market data.
The original MarketSummary is still availiable, but I can't see any of
our current use-cases wanting to get the unfiltered list

* BTSE: Fix marketSummary futures field

BTSE returns no futures field for futures api marketInfo, and the documentation for the futures api shows returning false.
When we know we asked for futures, it makes the data flow much saner if
we can trust this field and not have to track what asset we asked for

* BTSE: Abstract marketPair.Pair()

* BTSE: Fix UpdateTicker symbol format
This commit is contained in:
Gareth Kirwan
2024-06-14 10:09:19 +07:00
committed by GitHub
parent 4c4b6935be
commit 98f025e38f
7 changed files with 223 additions and 269 deletions

View File

@@ -50,37 +50,28 @@ var (
_HTTPClient *http.Client
_HTTPUserAgent string
m sync.RWMutex
// ErrNotYetImplemented defines a common error across the code base that
// alerts of a function that has not been completed or tied into main code
ErrNotYetImplemented = errors.New("not yet implemented")
// ErrFunctionNotSupported defines a standardised error for an unsupported
// wrapper function by an API
ErrFunctionNotSupported = errors.New("unsupported wrapper function")
errInvalidCryptoCurrency = errors.New("invalid crypto currency")
// ErrDateUnset is an error for start end check calculations
ErrDateUnset = errors.New("date unset")
// ErrStartAfterEnd is an error for start end check calculations
ErrStartAfterEnd = errors.New("start date after end date")
// ErrStartEqualsEnd is an error for start end check calculations
ErrStartEqualsEnd = errors.New("start date equals end date")
// ErrStartAfterTimeNow is an error for start end check calculations
ErrStartAfterTimeNow = errors.New("start date is after current time")
// ErrNilPointer defines an error for a nil pointer
ErrNilPointer = errors.New("nil pointer")
// ErrCannotCalculateOffline is returned when a request wishes to calculate
// something offline, but has an online requirement
ErrCannotCalculateOffline = errors.New("cannot calculate offline, unsupported")
// ErrNoResponse is returned when a response has no entries/is empty
// when one is expected
ErrNoResponse = errors.New("no response")
zeroValueUnix = time.Unix(0, 0)
)
// Public common Errors
var (
ErrNotYetImplemented = errors.New("not yet implemented")
ErrFunctionNotSupported = errors.New("unsupported wrapper function")
errInvalidCryptoCurrency = errors.New("invalid crypto currency")
ErrDateUnset = errors.New("date unset")
ErrStartAfterEnd = errors.New("start date after end date")
ErrStartEqualsEnd = errors.New("start date equals end date")
ErrStartAfterTimeNow = errors.New("start date is after current time")
ErrNilPointer = errors.New("nil pointer")
ErrCannotCalculateOffline = errors.New("cannot calculate offline, unsupported")
ErrNoResponse = errors.New("no response")
ErrTypeAssertFailure = errors.New("type assert failure")
)
var (
errCannotSetInvalidTimeout = errors.New("cannot set new HTTP client with timeout that is equal or less than 0")
errUserAgentInvalid = errors.New("cannot set invalid user agent")
errHTTPClientInvalid = errors.New("custom http client cannot be nil")
zeroValueUnix = time.Unix(0, 0)
// ErrTypeAssertFailure defines an error when type assertion fails
ErrTypeAssertFailure = errors.New("type assert failure")
)
// MatchesEmailPattern ensures that the string is an email address by regexp check