config

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvLive  = "live"
	EnvPaper = "paper"
)

Variables

This section is empty.

Functions

func DeleteProfile

func DeleteProfile(name string) error

func Dir

func Dir() string

func ListProfiles

func ListProfiles() ([]string, error)

func ResolveBaseURL

func ResolveBaseURL(value string) string

ResolveBaseURL takes a value that is either a well-known alias ("paper", "live") or a full URL, and returns a URL. Empty string defaults to the paper trading URL.

func SaveGlobalConfig

func SaveGlobalConfig(cfg *Config) error

func SaveProfile

func SaveProfile(name string, p *Profile) error

Types

type Config

type Config struct {
	DefaultProfile string `yaml:"default_profile"`
	Output         string `yaml:"output"`
	Color          string `yaml:"color"`
}

type Profile

type Profile struct {
	APIKey      string `yaml:"api_key"`
	SecretKey   string `yaml:"secret_key"`
	AccessToken string `yaml:"access_token,omitempty"`
	Scopes      string `yaml:"scopes,omitempty"`
	BaseURL     string `yaml:"base_url"`
	DataURL     string `yaml:"data_url"`
	// Deprecated: kept for backwards compat with existing profile files.
	// New profiles store base_url directly.
	Environment string `yaml:"environment,omitempty"`
}

func LoadProfileByName

func LoadProfileByName(name string) *Profile

type Resolved

type Resolved struct {
	APIKey      string
	SecretKey   string
	AccessToken string
	Scopes      string
	BaseURL     string
	DataURL     string
	Output      string
	Color       string
	ProfileName string
}

func Load

func Load(profileFlag, outputFlag string) (*Resolved, error)

func (*Resolved) HasCredentials

func (r *Resolved) HasCredentials() bool

func (*Resolved) HasScope

func (r *Resolved) HasScope(s string) bool

func (*Resolved) IsOAuth

func (r *Resolved) IsOAuth() bool

func (*Resolved) Validate

func (r *Resolved) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL