trader

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const XLM = "XLM"

XLM is a constant for XLM

Variables

This section is empty.

Functions

This section is empty.

Types

type BotConfig

type BotConfig struct {
	SourceSecretSeed                   string     `valid:"-" toml:"SOURCE_SECRET_SEED"`
	TradingSecretSeed                  string     `valid:"-" toml:"TRADING_SECRET_SEED"`
	AssetCodeA                         string     `valid:"-" toml:"ASSET_CODE_A"`
	IssuerA                            string     `valid:"-" toml:"ISSUER_A"`
	AssetCodeB                         string     `valid:"-" toml:"ASSET_CODE_B"`
	IssuerB                            string     `valid:"-" toml:"ISSUER_B"`
	TickIntervalSeconds                int32      `valid:"-" toml:"TICK_INTERVAL_SECONDS"`
	MaxTickDelayMillis                 int64      `valid:"-" toml:"MAX_TICK_DELAY_MILLIS"`
	DeleteCyclesThreshold              int64      `valid:"-" toml:"DELETE_CYCLES_THRESHOLD"`
	SubmitMode                         string     `valid:"-" toml:"SUBMIT_MODE"`
	FillTrackerSleepMillis             uint32     `valid:"-" toml:"FILL_TRACKER_SLEEP_MILLIS"`
	FillTrackerDeleteCyclesThreshold   int64      `valid:"-" toml:"FILL_TRACKER_DELETE_CYCLES_THRESHOLD"`
	HorizonURL                         string     `valid:"-" toml:"HORIZON_URL"`
	Fee                                *FeeConfig `valid:"-" toml:"FEE"`
	CentralizedPricePrecisionOverride  *int8      `valid:"-" toml:"CENTRALIZED_PRICE_PRECISION_OVERRIDE"`
	CentralizedVolumePrecisionOverride *int8      `valid:"-" toml:"CENTRALIZED_VOLUME_PRECISION_OVERRIDE"`
	// Deprecated: use CENTRALIZED_MIN_BASE_VOLUME_OVERRIDE instead
	MinCentralizedBaseVolumeDeprecated *float64 `valid:"-" toml:"MIN_CENTRALIZED_BASE_VOLUME" deprecated:"true"`
	CentralizedMinBaseVolumeOverride   *float64 `valid:"-" toml:"CENTRALIZED_MIN_BASE_VOLUME_OVERRIDE"`
	CentralizedMinQuoteVolumeOverride  *float64 `valid:"-" toml:"CENTRALIZED_MIN_QUOTE_VOLUME_OVERRIDE"`
	AlertType                          string   `valid:"-" toml:"ALERT_TYPE"`
	AlertAPIKey                        string   `valid:"-" toml:"ALERT_API_KEY"`
	MonitoringPort                     uint16   `valid:"-" toml:"MONITORING_PORT"`
	MonitoringTLSCert                  string   `valid:"-" toml:"MONITORING_TLS_CERT"`
	MonitoringTLSKey                   string   `valid:"-" toml:"MONITORING_TLS_KEY"`
	GoogleClientID                     string   `valid:"-" toml:"GOOGLE_CLIENT_ID"`
	GoogleClientSecret                 string   `valid:"-" toml:"GOOGLE_CLIENT_SECRET"`
	AcceptableEmails                   string   `valid:"-" toml:"ACCEPTABLE_GOOGLE_EMAILS"`
	TradingExchange                    string   `valid:"-" toml:"TRADING_EXCHANGE"`
	ExchangeAPIKeys                    []struct {
		Key    string `valid:"-" toml:"KEY"`
		Secret string `valid:"-" toml:"SECRET"`
	} `valid:"-" toml:"EXCHANGE_API_KEYS"`
	ExchangeParams []struct {
		Param string `valid:"-" toml:"PARAM"`
		Value string `valid:"-" toml:"VALUE"`
	} `valid:"-" toml:"EXCHANGE_PARAMS"`
	ExchangeHeaders []struct {
		Header string `valid:"-" toml:"HEADER"`
		Value  string `valid:"-" toml:"VALUE"`
	} `valid:"-" toml:"EXCHANGE_HEADERS"`
	// contains filtered or unexported fields
}

BotConfig represents the configuration params for the bot

func (*BotConfig) AssetBase

func (b *BotConfig) AssetBase() horizon.Asset

AssetBase returns the config's assetBase

func (*BotConfig) AssetQuote

func (b *BotConfig) AssetQuote() horizon.Asset

AssetQuote returns the config's assetQuote

func (*BotConfig) Init

func (b *BotConfig) Init() error

Init initializes this config

func (*BotConfig) IsTradingSdex added in v1.6.0

func (b *BotConfig) IsTradingSdex() bool

IsTradingSdex returns whether the config is set to trade on SDEX

func (*BotConfig) SourceAccount

func (b *BotConfig) SourceAccount() string

SourceAccount returns the config's source account

func (BotConfig) String

func (b BotConfig) String() string

String impl.

func (*BotConfig) TradingAccount

func (b *BotConfig) TradingAccount() string

TradingAccount returns the config's trading account

type FeeConfig added in v1.5.0

type FeeConfig struct {
	CapacityTrigger float64 `valid:"-" toml:"CAPACITY_TRIGGER"`   // trigger when "ledger_capacity_usage" in /fee_stats is >= this value
	Percentile      uint8   `valid:"-" toml:"PERCENTILE"`         // percentile computation to use from /fee_stats (10, 20, ..., 90, 95, 99)
	MaxOpFeeStroops uint64  `valid:"-" toml:"MAX_OP_FEE_STROOPS"` // max fee in stroops per operation to use
}

FeeConfig represents input data for how to deal with network fees

type Trader

type Trader struct {
	// contains filtered or unexported fields
}

Trader represents a market making bot, which is composed of various parts include the strategy and various APIs.

func MakeBot

func MakeBot(
	api *horizon.Client,
	ieif *plugins.IEIF,
	assetBase horizon.Asset,
	assetQuote horizon.Asset,
	tradingPair *model.TradingPair,
	tradingAccount string,
	sdex *plugins.SDEX,
	exchangeShim api.ExchangeShim,
	strategy api.Strategy,
	timeController api.TimeController,
	deleteCyclesThreshold int64,
	submitMode api.SubmitMode,
	threadTracker *multithreading.ThreadTracker,
	fixedIterations *uint64,
	dataKey *model.BotKey,
	alert api.Alert,
) *Trader

MakeBot is the factory method for the Trader struct

func (*Trader) Start

func (t *Trader) Start()

Start starts the bot with the injected strategy

Jump to

Keyboard shortcuts

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