Files
gocryptotrader/common/key/key.go
Scott 70690d9a04 futures: Implement GetLatestFundingRates across exchanges (#1339)
* adds funding rate implementations and improvements

* merge fixes x1

* lint

* kucoin funding rates func make

* migrate sync-manager to keys

* some kucoin work

* adds some kucoin wrapper funcs

* ehhh, todo

* kucoin position

* start of orders

* adds the kucoin tests yay

* multiplier

* nits, EWS includes order limits

* NotYetImplemented, IsPerp improvements, cleaning

* lint, test fix, huobi time

* fixes issues, improves testing

* fixes linters I WRECKED

* local lint but remote lint, lint, lint, lint

* fixes err

* skip CI

* lint

* Supported rates, binance endpoints

* fixes weird mocktest problems

* no, CZ is invalid

* fixes some new EWS test errors
2023-11-03 11:01:32 +11:00

54 lines
1.5 KiB
Go

package key
import (
"strings"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
)
// ExchangePairAsset is a unique map key signature for exchange, currency pair and asset
type ExchangePairAsset struct {
Exchange string
Base *currency.Item
Quote *currency.Item
Asset asset.Item
}
// ExchangeAsset is a unique map key signature for exchange and asset
type ExchangeAsset struct {
Exchange string
Asset asset.Item
}
// PairAsset is a unique map key signature for currency pair and asset
type PairAsset struct {
Base *currency.Item
Quote *currency.Item
Asset asset.Item
}
// SubAccountCurrencyAsset is a unique map key signature for subaccount, currency code and asset
type SubAccountCurrencyAsset struct {
SubAccount string
Currency *currency.Item
Asset asset.Item
}
// MatchesExchangeAsset checks if the key matches the exchange and asset
func (k *ExchangePairAsset) MatchesExchangeAsset(exch string, item asset.Item) bool {
return strings.EqualFold(k.Exchange, exch) && k.Asset == item
}
// MatchesPairAsset checks if the key matches the pair and asset
func (k *ExchangePairAsset) MatchesPairAsset(pair currency.Pair, item asset.Item) bool {
return k.Base == pair.Base.Item &&
k.Quote == pair.Quote.Item &&
k.Asset == item
}
// MatchesExchange checks if the exchange matches
func (k *ExchangePairAsset) MatchesExchange(exch string) bool {
return strings.EqualFold(k.Exchange, exch)
}