Files
gocryptotrader/currency/currency_types.go
Ryan O'Hara-Reid f843b7d277 exchange: upgrade UpdatePair method (#991)
* exchange: upgrade update pair

* exchanges: Add enabled string matching and format handling if discrepency is found.

* linter: fixes

* bithumb: fix tests

* BTSE: api change fix ordering

* huobi: fix tests

* gloriousnits: stage 1

* gloriousnits: stage 2

* currency: more nits

* bitmex: add spot and process pairs before currency package call.

* bitmex: finished correct orderbook matching and other implementations

* linter: fix issue

* currency: Fix linter

* currency: segregate and protect pair store, update tests

* currency/manager: clean code, rm log output

* currency: Add store method and make sure formatting stays nil if not stored.

* gct: check errors

* engine/websocketroutineman: fix tests

* bybit: fix duplication bug

* huobi: fix test

* btse: fix tests?

* ob/buffer: fix tests

* Update currency/manager.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* glorious: nits strikes again.

* exchange: add bypassConfigFormatUpgrades to stop formatting

* GLORIOUS LINTER

* Update exchanges/bithumb/bithumb_wrapper.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* exchange: fix pair upgrade issue when duplications are in both avail and enabled pairs

* linter: fix shadow dec

* config: fix test

* Update currency/pair_test.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
2022-09-16 08:59:27 +10:00

92 lines
2.7 KiB
Go

package currency
import (
"time"
"github.com/thrasher-corp/gocryptotrader/currency/coinmarketcap"
)
// Config holds all the information needed for currency related manipulation
type Config struct {
ForexProviders AllFXSettings `json:"forexProviders"`
CryptocurrencyProvider Provider `json:"cryptocurrencyProvider"`
CurrencyPairFormat *PairFormat `json:"currencyPairFormat"`
FiatDisplayCurrency Code `json:"fiatDisplayCurrency"`
CurrencyFileUpdateDuration time.Duration `json:"currencyFileUpdateDuration"`
ForeignExchangeUpdateDuration time.Duration `json:"foreignExchangeUpdateDuration"`
}
// Provider defines coinmarketcap tools
type Provider struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Verbose bool `json:"verbose"`
APIKey string `json:"apiKey"`
AccountPlan string `json:"accountPlan"`
}
// BotOverrides defines a bot overriding factor for quick running currency
// subsystems
type BotOverrides struct {
Coinmarketcap bool
CurrencyConverter bool
CurrencyLayer bool
ExchangeRates bool
Fixer bool
OpenExchangeRates bool
ExchangeRateHost bool
}
// CoinmarketcapSettings refers to settings
type CoinmarketcapSettings coinmarketcap.Settings
// SystemsSettings defines incoming system settings
type SystemsSettings struct {
Coinmarketcap coinmarketcap.Settings
Currencyconverter FXSettings
Currencylayer FXSettings
Fixer FXSettings
Openexchangerates FXSettings
}
// AllFXSettings defines all the foreign exchange settings
type AllFXSettings []FXSettings
// FXSettings defines foreign exchange requester settings
type FXSettings struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Verbose bool `json:"verbose"`
APIKey string `json:"apiKey"`
APIKeyLvl int `json:"apiKeyLvl"`
PrimaryProvider bool `json:"primaryProvider"`
}
// File defines a full currency file generated by the currency storage
// analysis system
type File struct {
LastMainUpdate interface{} `json:"lastMainUpdate"`
Cryptocurrency []*Item `json:"cryptocurrencies"`
FiatCurrency []*Item `json:"fiatCurrencies"`
UnsetCurrency []*Item `json:"unsetCurrencies"`
Contracts []*Item `json:"contracts"`
Token []*Item `json:"tokens"`
Stable []*Item `json:"stableCurrencies"`
}
// Const here are packaged defined delimiters
const (
UnderscoreDelimiter = "_"
DashDelimiter = "-"
ForwardSlashDelimiter = "/"
ColonDelimiter = ":"
)
// delimiters is a delimiter list
var delimiters = []string{
DashDelimiter,
UnderscoreDelimiter,
ForwardSlashDelimiter,
ColonDelimiter,
}