mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
* currency: Add pair matching update (cherry-pick) * exchange/currency: Add tests and update func * linter fix, also if using json unmarshal functionality stop usage of string conversion without delimiter * gemini: fix test * currency/manager: potential optimisation * exchanges: purge derive from wrapper cases and add warning comment * glorious: nits * glorious: nits * linter: fix * glorious: nits * whoops * whoops * glorious: nits continued * glorious: diff THANKS! * hitbtc: fix update tradable pairs strings splitting. continue if not enabled tickers update pair. * glorious: nits * linter: fix * Update exchanges/exmo/exmo_wrapper.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * bitstamp: fix test when 32 biterinos architecturinos * capture more strings for speed * swapsies because whos running 32bit \0/? --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
package currency
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
)
|
|
|
|
// PairsManager manages asset pairs
|
|
type PairsManager struct {
|
|
BypassConfigFormatUpgrades bool `json:"bypassConfigFormatUpgrades"`
|
|
RequestFormat *PairFormat `json:"requestFormat,omitempty"`
|
|
ConfigFormat *PairFormat `json:"configFormat,omitempty"`
|
|
UseGlobalFormat bool `json:"useGlobalFormat,omitempty"`
|
|
LastUpdated int64 `json:"lastUpdated,omitempty"`
|
|
Pairs FullStore `json:"pairs"`
|
|
matcher map[key]*Pair
|
|
mutex sync.RWMutex
|
|
}
|
|
|
|
// FullStore holds all supported asset types with the enabled and available
|
|
// pairs for an exchange.
|
|
type FullStore map[asset.Item]*PairStore
|
|
|
|
// PairStore stores a currency pair store
|
|
type PairStore struct {
|
|
AssetEnabled *bool `json:"assetEnabled"`
|
|
Enabled Pairs `json:"enabled"`
|
|
Available Pairs `json:"available"`
|
|
RequestFormat *PairFormat `json:"requestFormat,omitempty"`
|
|
ConfigFormat *PairFormat `json:"configFormat,omitempty"`
|
|
}
|
|
|
|
// PairFormat returns the pair format
|
|
type PairFormat struct {
|
|
Uppercase bool `json:"uppercase"`
|
|
Delimiter string `json:"delimiter,omitempty"`
|
|
Separator string `json:"separator,omitempty"`
|
|
Index string `json:"index,omitempty"`
|
|
}
|
|
|
|
// key is used to store the asset type and symbol in a map
|
|
type key struct {
|
|
Symbol string
|
|
Asset asset.Item
|
|
}
|