Documentation
¶
Index ¶
- type APIKey
- type APIKeyConfig
- type APIType
- type Account
- type AccountConfig
- type Catalog
- func (c *Catalog) GetAccount(accountID int) (*Account, error)
- func (c *Catalog) GetAccountByName(name string) *Account
- func (c *Catalog) GetSymbol(symbolID int) (*Symbol, error)
- func (c *Catalog) GetSymbolByExchangeAndName(exchangeName, symbolName string) (*Symbol, error)
- func (c *Catalog) GetSymbolByUniversalTicker(universalTicker string) (*Symbol, error)
- func (c *Catalog) GetToken(tokenID int) (*Token, error)
- func (c *Catalog) GetTokenIDByName(name string) (int, error)
- func (c *Catalog) GetWalletByName(name string) (*Wallet, error)
- type Config
- type Exchange
- type Product
- type Symbol
- type Token
- type Wallet
- type WalletConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
ID int `json:"id"`
UserID int `json:"user_id"`
ExchID common.Exchange `json:"-"`
UID int `json:"uid"`
Name string `json:"name"`
APIType APIType `json:"api_type"`
Key string `json:"api_key"`
Secret string `json:"api_secret"`
Passphrase string `json:"passphrase"`
ParentUID int `json:"parent_uid"`
CreatedAt string `json:"created_at"`
}
APIKey represents API credentials
type APIKeyConfig ¶
type APIKeyConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // HMAC | RSA | ED25519
Key string `yaml:"key"`
Secret string `yaml:"secret"`
Passphrase string `yaml:"passphrase"`
}
APIKeyConfig defines API credentials in the YAML config. Key, Secret and Passphrase support ${ENV_VAR} expansion.
type Account ¶
type Account struct {
ID int `json:"id"`
UID int `json:"uid"`
ExchID common.Exchange `json:"exch_id"`
Exchange string `json:"exchange"`
Name string `json:"name"`
ParentUID int `json:"parent_uid"`
// contains filtered or unexported fields
}
Account represents an exchange account
func (*Account) GetWallet ¶
GetWallet returns the wallet with the given name, or an error if not found
func (*Account) SetAPIKeys ¶
SetAPIKeys sets the API keys for this account (used by catalog)
func (*Account) SetWallets ¶
SetWallets sets the wallets for this account (used by catalog)
type AccountConfig ¶
type AccountConfig struct {
Name string `yaml:"name"`
Exchange string `yaml:"exchange"` // Binance | Bybit
APIKeys []APIKeyConfig `yaml:"api_keys"`
Wallets []WalletConfig `yaml:"wallets"`
}
AccountConfig defines an exchange account in the YAML config.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func NewCatalog ¶
NewCatalog builds a catalog from a local instruments JSON file and the accounts defined in the configuration.
func (*Catalog) GetAccountByName ¶
GetAccountByName returns the account with the given name, or nil if not found.
func (*Catalog) GetSymbolByExchangeAndName ¶
GetSymbolByExchangeAndName returns the symbol for the given exchange name and symbol name (e.g. "Binance", "BTCUSDT"). Exchange name comparison is case-insensitive. Uses exchangeID -> symbolName -> symbol index for O(1) lookup.
func (*Catalog) GetSymbolByUniversalTicker ¶
type Config ¶
type Config struct {
// Instruments is the path to a JSON file containing the full list of
// tradable symbols (see Symbol for the expected shape).
Instruments string `yaml:"instruments"`
// Accounts defines exchange accounts, their API credentials and wallets.
Accounts []AccountConfig `yaml:"accounts"`
}
Config contains catalog service configuration.
type Symbol ¶
type Symbol struct {
ID int `json:"id"`
Name string `json:"name"`
Exchange Exchange `json:"exchange"`
Product Product `json:"product"`
BaseToken Token `json:"base_token"`
QuoteToken Token `json:"quote_token"`
PricePrecision int `json:"price_precision"`
SizePrecision int `json:"size_precision"`
UniversalTicker string `json:"universal_ticker"`
}
Symbol represents a trading symbol (instrument)
type Wallet ¶
type Wallet struct {
ID int `json:"id"`
Name string `json:"name"`
WalletType common.WalletType `json:"category_id"`
AcctID int `json:"acct_id"`
UserID int `json:"user_id"`
IsActive bool `json:"is_active"`
}
Wallet represents a wallet belonging to an account
type WalletConfig ¶
type WalletConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // spot | umargin | cmargin | leverage | unified
}
WalletConfig defines a wallet in the YAML config.