engine

package
v0.0.0-...-1ca2487 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 99 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrSubSystemAlreadyStarted message to return when a subsystem is already started
	ErrSubSystemAlreadyStarted = "manager already started"
	// ErrSubSystemAlreadyStopped message to return when a subsystem is already stopped
	ErrSubSystemAlreadyStopped = "already stopped"
	// ErrSubSystemNotStarted message to return when subsystem not started
	ErrSubSystemNotStarted = "not started"

	// ErrScriptFailedValidation message to display when a script fails its validation
	ErrScriptFailedValidation string = "validation failed"
	// MsgSubSystemStarting message to return when subsystem is starting up
	MsgSubSystemStarting = "manager starting..."
	// MsgSubSystemStarted message to return when subsystem has started
	MsgSubSystemStarted = "started."

	// MsgSubSystemShuttingDown message to return when a subsystem is shutting down
	MsgSubSystemShuttingDown = "shutting down..."
	// MsgSubSystemShutdown message to return when a subsystem has shutdown
	MsgSubSystemShutdown = "manager shutdown."

	// MsgStatusOK message to display when status is "OK"
	MsgStatusOK string = "ok"
	// MsgStatusSuccess message to display when status is successful
	MsgStatusSuccess string = "success"
	// MsgStatusError message to display when failure occurs
	MsgStatusError string = "error"
)
View Source
const (
	ItemPrice     = "PRICE"
	ItemOrderbook = "ORDERBOOK"

	ConditionGreaterThan        = ">"
	ConditionGreaterThanOrEqual = ">="
	ConditionLessThan           = "<"
	ConditionLessThanOrEqual    = "<="
	ConditionIsEqual            = "=="

	ActionSMSNotify    = "SMS"
	ActionConsolePrint = "CONSOLE_PRINT"
	ActionTest         = "ACTION_TEST"
)

Event const vars

View Source
const (
	SyncItemTicker = iota
	SyncItemOrderbook
	SyncItemTrade

	DefaultSyncerWorkers = 15
	DefaultSyncerTimeout = time.Second * 15
)

const holds the sync item types

View Source
const (
	// ErrWithdrawRequestNotFound message to display when no record is found
	ErrWithdrawRequestNotFound = "%v not found"
	// ErrRequestCannotbeNil message to display when request is nil
	ErrRequestCannotbeNil = "request cannot be nil"
	// StatusError const for for "error" string
	StatusError = "error"
)
View Source
const (
	WebsocketResponseSuccess = "OK"
)

Const vars for websocket

Variables

View Source
var (
	ErrDepositAddressStoreIsNil = errors.New("deposit address store is nil")
	ErrDepositAddressNotFound   = errors.New("deposit address does not exist")
)

vars related to the deposit address helpers

View Source
var (
	ErrNoExchangesLoaded     = errors.New("no exchanges have been loaded")
	ErrExchangeNotFound      = errors.New("exchange not found")
	ErrExchangeAlreadyLoaded = errors.New("exchange already loaded")
	ErrExchangeFailedToLoad  = errors.New("exchange failed to load")
)

vars related to exchange functions

View Source
var (
	OrderManagerDelay      = time.Second * 10
	ErrOrdersAlreadyExists = errors.New("order already exists")
	ErrOrderNotFound       = errors.New("order does not exist")
)

vars for the fund manager package

View Source
var (
	NTPCheckInterval = time.Second * 30
	NTPRetryLimit    = 3
)

vars related to the NTP manager

View Source
var (
	EventSleepDelay = defaultSleepDelay
)

vars related to events package

View Source
var Events []*Event

Events variable is a pointer array to the event structures that will be appended

View Source
var (
	PortfolioSleepDelay = time.Minute
)

vars for the fund manager package

Functions

func Add

func Add(exchange, item string, condition EventConditionParams, currencyPair currency.Pair, asset asset.Item, action string) (int64, error)

Add adds an event to the Events chain and returns an index/eventID and an error

func BroadcastWebsocketMessage

func BroadcastWebsocketMessage(evt WebsocketEvent) error

BroadcastWebsocketMessage meow

func EventManger

func EventManger()

EventManger is the overarching routine that will iterate through the Events chain

func FormatCurrency

func FormatCurrency(p currency.Pair) currency.Pair

FormatCurrency is a method that formats and returns a currency pair based on the user currency display preferences

func GetAllAvailablePairs

func GetAllAvailablePairs(enabledExchangesOnly bool, assetType asset.Item) currency.Pairs

GetAllAvailablePairs returns a list of all available pairs on either enabled or disabled exchanges

func GetAuthAPISupportedExchanges

func GetAuthAPISupportedExchanges() []string

GetAuthAPISupportedExchanges returns a list of auth api enabled exchanges

func GetAvailableExchanges

func GetAvailableExchanges() []string

GetAvailableExchanges returns a list of enabled exchanges

func GetCollatedExchangeAccountInfoByCoin

func GetCollatedExchangeAccountInfoByCoin(accounts []account.Holdings) map[currency.Code]account.Balance

GetCollatedExchangeAccountInfoByCoin collates individual exchange account information and turns into into a map string of exchange.AccountCurrencyInfo

func GetCryptocurrenciesByExchange

func GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, assetType asset.Item) ([]string, error)

GetCryptocurrenciesByExchange returns a list of cryptocurrencies the exchange supports

func GetCryptocurrencyDepositAddressesByExchange

func GetCryptocurrencyDepositAddressesByExchange(exchName string) (map[string]string, error)

GetCryptocurrencyDepositAddressesByExchange returns the cryptocurrency deposit addresses for a particular exchange

func GetEventCounter

func GetEventCounter() (total, executed int)

GetEventCounter displays the emount of total events on the chain and the events that have been executed.

func GetExchangeByName

func GetExchangeByName(exchName string) exchange.IBotExchange

GetExchangeByName returns an exchange given an exchange name

func GetExchangeCryptocurrencyDepositAddress

func GetExchangeCryptocurrencyDepositAddress(exchName, accountID string, item currency.Code) (string, error)

GetExchangeCryptocurrencyDepositAddress returns the cryptocurrency deposit address for a particular exchange

func GetExchangeCryptocurrencyDepositAddresses

func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string

GetExchangeCryptocurrencyDepositAddresses obtains an exchanges deposit cryptocurrency list

func GetExchangeHighestPriceByCurrencyPair

func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error)

GetExchangeHighestPriceByCurrencyPair returns the exchange with the highest price for a given currency pair and asset type

func GetExchangeLowestPriceByCurrencyPair

func GetExchangeLowestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error)

GetExchangeLowestPriceByCurrencyPair returns the exchange with the lowest price for a given currency pair and asset type

func GetExchangeNames

func GetExchangeNames(enabledOnly bool) []string

GetExchangeNames returns a list of enabled or disabled exchanges

func GetExchangeNamesByCurrency

func GetExchangeNamesByCurrency(p currency.Pair, enabled bool, assetType asset.Item) []string

GetExchangeNamesByCurrency returns a list of exchanges supporting a currency pair based on whether the exchange is enabled or not

func GetExchangeOTPs

func GetExchangeOTPs() (map[string]string, error)

GetExchangeOTPs returns OTP codes for all exchanges which have a otpsecret stored

func GetExchangeoOTPByName

func GetExchangeoOTPByName(exchName string) (string, error)

GetExchangeoOTPByName returns a OTP code for the desired exchange if it exists

func GetExchanges

func GetExchanges() []exchange.IBotExchange

GetExchanges retrieves the loaded exchanges

func GetRPCEndpoints

func GetRPCEndpoints() map[string]RPCEndpoint

GetRPCEndpoints returns a list of RPC endpoints and their listen addrs

func GetRelatableCryptocurrencies

func GetRelatableCryptocurrencies(p currency.Pair) currency.Pairs

GetRelatableCryptocurrencies returns a list of currency pairs if it can find any relatable currencies (e.g ETHBTC -> ETHLTC -> ETHUSDT -> ETHREP)

func GetRelatableCurrencies

func GetRelatableCurrencies(p currency.Pair, incOrig, incUSDT bool) currency.Pairs

GetRelatableCurrencies returns a list of currency pairs if it can find any relatable currencies (e.g BTCUSD -> BTC USDT -> XBT USDT -> XBT USD) incOrig includes the supplied pair if desired

func GetRelatableFiatCurrencies

func GetRelatableFiatCurrencies(p currency.Pair) currency.Pairs

GetRelatableFiatCurrencies returns a list of currency pairs if it can find any relatable currencies (e.g ETHUSD -> ETHAUD -> ETHGBP -> ETHJPY)

func GetSpecificAvailablePairs

func GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, assetType asset.Item) currency.Pairs

GetSpecificAvailablePairs returns a list of supported pairs based on specific parameters

func GetSpecificOrderbook

func GetSpecificOrderbook(p currency.Pair, exchangeName string, assetType asset.Item) (*orderbook.Base, error)

GetSpecificOrderbook returns a specific orderbook given the currency, exchangeName and assetType

func GetSpecificTicker

func GetSpecificTicker(p currency.Pair, exchangeName string, assetType asset.Item) (*ticker.Price, error)

GetSpecificTicker returns a specific ticker given the currency, exchangeName and assetType

func GetSubsystemsStatus

func GetSubsystemsStatus() map[string]bool

GetSubsystemsStatus returns the status of various subsystems

func IsOnline

func IsOnline() bool

IsOnline returns whether or not the engine has Internet connectivity

func IsRelatablePairs

func IsRelatablePairs(p1, p2 currency.Pair, includeUSDT bool) bool

IsRelatablePairs checks to see if the two pairs are relatable

func IsValidAction

func IsValidAction(action string) bool

IsValidAction validates passed in action

func IsValidCondition

func IsValidCondition(condition string) bool

IsValidCondition validates passed in condition

func IsValidEvent

func IsValidEvent(exchange, item string, condition EventConditionParams, action string) error

IsValidEvent checks the actions to be taken and returns an error if incorrect

func IsValidExchange

func IsValidExchange(exchangeName string) bool

IsValidExchange validates the exchange

func IsValidItem

func IsValidItem(item string) bool

IsValidItem validates passed in Item

func LoadExchange

func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error

LoadExchange loads an exchange by name

func MapCurrenciesByExchange

func MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetType asset.Item) map[string]currency.Pairs

MapCurrenciesByExchange returns a list of currency pairs mapped to an exchange

func PrintSettings

func PrintSettings(s *Settings)

PrintSettings returns the engine settings

func RESTGetAllActiveOrderbooks

func RESTGetAllActiveOrderbooks(w http.ResponseWriter, r *http.Request)

RESTGetAllActiveOrderbooks returns all enabled exchange orderbooks

func RESTGetAllActiveTickers

func RESTGetAllActiveTickers(w http.ResponseWriter, r *http.Request)

RESTGetAllActiveTickers returns all active tickers

func RESTGetAllEnabledAccountInfo

func RESTGetAllEnabledAccountInfo(w http.ResponseWriter, r *http.Request)

RESTGetAllEnabledAccountInfo via get request returns JSON response of account info

func RESTGetAllSettings

func RESTGetAllSettings(w http.ResponseWriter, r *http.Request)

RESTGetAllSettings replies to a request with an encoded JSON response about the trading Bots configuration.

func RESTGetPortfolio

func RESTGetPortfolio(w http.ResponseWriter, r *http.Request)

RESTGetPortfolio returns the Bot portfolio

func RESTLogger

func RESTLogger(inner http.Handler, name string) http.Handler

RESTLogger logs the requests internally

func RESTSaveAllSettings

func RESTSaveAllSettings(w http.ResponseWriter, r *http.Request)

RESTSaveAllSettings saves all current settings from request body as a JSON document then reloads state and returns the settings

func RESTfulError

func RESTfulError(method string, err error)

RESTfulError prints the REST method and error

func RESTfulJSONResponse

func RESTfulJSONResponse(w http.ResponseWriter, response interface{}) error

RESTfulJSONResponse outputs a JSON response of the response interface

func Remove

func Remove(eventID int64) bool

Remove deletes and event by its ID

func SeedExchangeAccountInfo

func SeedExchangeAccountInfo(accounts []account.Holdings)

SeedExchangeAccountInfo seeds account info

func SetSubsystem

func SetSubsystem(subsys string, enable bool) error

SetSubsystem enables or disables an engine subsystem

func SetupExchanges

func SetupExchanges()

SetupExchanges sets up the exchanges used by the Bot

func StartRESTServer

func StartRESTServer()

StartRESTServer starts a REST server

func StartRPCRESTProxy

func StartRPCRESTProxy()

StartRPCRESTProxy starts a gRPC proxy

func StartRPCServer

func StartRPCServer()

StartRPCServer starts a gRPC server with TLS auth

func StartWebsocketHandler

func StartWebsocketHandler()

StartWebsocketHandler starts the websocket hub and routine which handles clients

func StartWebsocketServer

func StartWebsocketServer()

StartWebsocketServer starts a Websocket server

func SubmitWithdrawal

func SubmitWithdrawal(exchName string, req *withdraw.Request) (*withdraw.Response, error)

SubmitWithdrawal preforms validation and submits a new withdraw request to exchange

func UnloadExchange

func UnloadExchange(exchName string) error

UnloadExchange unloads an exchange by name

func ValidateSettings

func ValidateSettings(b *Engine, s *Settings)

ValidateSettings validates and sets all bot settings

func WebsocketClientHandler

func WebsocketClientHandler(w http.ResponseWriter, r *http.Request)

WebsocketClientHandler upgrades the HTTP connection to a websocket compatible one

func WebsocketDataHandler

func WebsocketDataHandler(exchName string, data interface{}) error

WebsocketDataHandler is a central point for exchange websocket implementations to send processed data. WebsocketDataHandler will then pass that to an appropriate handler

func WebsocketDataReceiver

func WebsocketDataReceiver(ws *wshandler.Websocket)

WebsocketDataReceiver handles websocket data coming from a websocket feed associated with an exchange

func WebsocketRoutine

func WebsocketRoutine()

WebsocketRoutine Initial routine management system for websocket

func WithdrawEventByDate

func WithdrawEventByDate(exchange string, start, end time.Time, limit int) ([]*withdraw.Response, error)

WithdrawEventByDate returns a withdrawal request by ID

func WithdrawalEventByExchange

func WithdrawalEventByExchange(exchange string, limit int) ([]*withdraw.Response, error)

WithdrawalEventByExchange returns a withdrawal request by ID

func WithdrawalEventByExchangeID

func WithdrawalEventByExchangeID(exchange, id string) (*withdraw.Response, error)

WithdrawalEventByExchangeID returns a withdrawal request by Exchange ID

func WithdrawalEventByID

func WithdrawalEventByID(id string) (*withdraw.Response, error)

WithdrawalEventByID returns a withdrawal request by ID

Types

type AllEnabledExchangeAccounts

type AllEnabledExchangeAccounts struct {
	Data []account.Holdings `json:"data"`
}

AllEnabledExchangeAccounts holds all enabled accounts info

func GetAllEnabledExchangeAccountInfo

func GetAllEnabledExchangeAccountInfo() AllEnabledExchangeAccounts

GetAllEnabledExchangeAccountInfo returns all the current enabled exchanges

type AllEnabledExchangeCurrencies

type AllEnabledExchangeCurrencies struct {
	Data []EnabledExchangeCurrencies `json:"data"`
}

AllEnabledExchangeCurrencies holds the enabled exchange currencies

type AllEnabledExchangeOrderbooks

type AllEnabledExchangeOrderbooks struct {
	Data []EnabledExchangeOrderbooks `json:"data"`
}

AllEnabledExchangeOrderbooks holds the enabled exchange orderbooks

type CurrencyPairSyncAgent

type CurrencyPairSyncAgent struct {
	Created   time.Time
	Exchange  string
	AssetType asset.Item
	Pair      currency.Pair
	Ticker    SyncBase
	Orderbook SyncBase
	Trade     SyncBase
}

CurrencyPairSyncAgent stores the sync agent info

type CurrencyPairSyncerConfig

type CurrencyPairSyncerConfig struct {
	SyncTicker       bool
	SyncOrderbook    bool
	SyncTrades       bool
	SyncContinuously bool
	SyncTimeout      time.Duration
	NumWorkers       int
	Verbose          bool
}

CurrencyPairSyncerConfig stores the currency pair config

type DepositAddressManager

type DepositAddressManager struct {
	Store DepositAddressStore
}

DepositAddressManager manages the exchange deposit address store

func (*DepositAddressManager) GetDepositAddressByExchange

func (d *DepositAddressManager) GetDepositAddressByExchange(exchName string, currencyItem currency.Code) (string, error)

GetDepositAddressByExchange returns a deposit address for the specified exchange and cryptocurrency if it exists

func (*DepositAddressManager) GetDepositAddressesByExchange

func (d *DepositAddressManager) GetDepositAddressesByExchange(exchName string) (map[string]string, error)

GetDepositAddressesByExchange returns a list of cryptocurrency addresses for the specified exchange if they exist

func (*DepositAddressManager) Sync

func (d *DepositAddressManager) Sync()

Sync synchronises all deposit addresses

type DepositAddressStore

type DepositAddressStore struct {
	Store map[string]map[string]string
	// contains filtered or unexported fields
}

DepositAddressStore stores a list of exchange deposit addresses

func (*DepositAddressStore) GetDepositAddress

func (d *DepositAddressStore) GetDepositAddress(exchName string, item currency.Code) (string, error)

GetDepositAddress returns a deposit address based on the specified item

func (*DepositAddressStore) GetDepositAddresses

func (d *DepositAddressStore) GetDepositAddresses(exchName string) (map[string]string, error)

GetDepositAddresses returns a list of stored deposit addresses

func (*DepositAddressStore) Seed

func (d *DepositAddressStore) Seed(coinData map[string]map[string]string)

Seed seeds the deposit address store

type EnabledExchangeCurrencies

type EnabledExchangeCurrencies struct {
	ExchangeName   string         `json:"exchangeName"`
	ExchangeValues []ticker.Price `json:"exchangeValues"`
}

EnabledExchangeCurrencies is a sub type for singular exchanges and respective currencies

func GetAllActiveTickers

func GetAllActiveTickers() []EnabledExchangeCurrencies

GetAllActiveTickers returns all enabled exchange tickers

type EnabledExchangeOrderbooks

type EnabledExchangeOrderbooks struct {
	ExchangeName   string           `json:"exchangeName"`
	ExchangeValues []orderbook.Base `json:"exchangeValues"`
}

EnabledExchangeOrderbooks is a sub type for singular exchanges and respective orderbooks

func GetAllActiveOrderbooks

func GetAllActiveOrderbooks() []EnabledExchangeOrderbooks

GetAllActiveOrderbooks returns all enabled exchanges orderbooks

type Engine

type Engine struct {
	Config                      *config.Config
	Portfolio                   *portfolio.Base
	ExchangeCurrencyPairManager *ExchangeCurrencyPairSyncer
	NTPManager                  ntpManager
	ConnectionManager           connectionManager
	DatabaseManager             databaseManager
	GctScriptManager            gctScriptManager
	OrderManager                orderManager
	PortfolioManager            portfolioManager
	CommsManager                commsManager

	DepositAddressManager *DepositAddressManager
	Settings              Settings
	Uptime                time.Time
	ServicesWG            sync.WaitGroup
	// contains filtered or unexported fields
}

Engine contains configuration, portfolio, exchange & ticker data and is the overarching type across this code base.

var (
	Bot *Engine
)

Vars for engine

func New

func New() (*Engine, error)

New starts a new engine

func NewFromSettings

func NewFromSettings(settings *Settings) (*Engine, error)

NewFromSettings starts a new engine based on supplied settings

func (*Engine) Start

func (e *Engine) Start() error

Start starts the engine

func (*Engine) Stop

func (e *Engine) Stop()

Stop correctly shuts down engine saving configuration files

type Event

type Event struct {
	ID        int64
	Exchange  string
	Item      string
	Condition EventConditionParams
	Pair      currency.Pair
	Asset     asset.Item
	Action    string
	Executed  bool
}

Event struct holds the event variables

func (*Event) CheckEventCondition

func (e *Event) CheckEventCondition() bool

CheckEventCondition will check the event structure to see if there is a condition met

func (*Event) ExecuteAction

func (e *Event) ExecuteAction() bool

ExecuteAction will execute the action pending on the chain

func (*Event) String

func (e *Event) String() string

String turns the structure event into a string

type EventConditionParams

type EventConditionParams struct {
	Condition string
	Price     float64

	CheckBids        bool
	CheckBidsAndAsks bool
	OrderbookAmount  float64
}

EventConditionParams holds the event condition variables

type ExchangeCurrencyPairSyncer

type ExchangeCurrencyPairSyncer struct {
	Cfg           CurrencyPairSyncerConfig
	CurrencyPairs []CurrencyPairSyncAgent
	// contains filtered or unexported fields
}

ExchangeCurrencyPairSyncer stores the exchange currency pair syncer object

func NewCurrencyPairSyncer

func NewCurrencyPairSyncer(c CurrencyPairSyncerConfig) (*ExchangeCurrencyPairSyncer, error)

NewCurrencyPairSyncer starts a new CurrencyPairSyncer

func (*ExchangeCurrencyPairSyncer) Start

func (e *ExchangeCurrencyPairSyncer) Start()

Start starts an exchange currency pair syncer

func (*ExchangeCurrencyPairSyncer) Stop

func (e *ExchangeCurrencyPairSyncer) Stop()

Stop shuts down the exchange currency pair syncer

type ExchangeSyncerConfig

type ExchangeSyncerConfig struct {
	SyncDepositAddresses bool
	SyncOrders           bool
}

ExchangeSyncerConfig stores the exchange syncer config

type RPCEndpoint

type RPCEndpoint struct {
	Started    bool
	ListenAddr string
}

RPCEndpoint stores an RPC endpoint status and addr

type RPCServer

type RPCServer struct{}

RPCServer struct

func (*RPCServer) AddEvent

AddEvent adds an event

func (*RPCServer) AddPortfolioAddress

AddPortfolioAddress adds an address to the portfolio manager

func (*RPCServer) CancelAllOrders

CancelAllOrders cancels all orders, filterable by exchange

func (*RPCServer) CancelOrder

CancelOrder cancels an order specified by exchange, currency pair and asset type

func (*RPCServer) DisableExchange

DisableExchange disables an exchange

func (*RPCServer) DisableExchangePair

DisableExchangePair disables the specified pair on an exchange

func (*RPCServer) DisableSubsystem

DisableSubsystem disables a engine subsytem

func (*RPCServer) EnableExchange

EnableExchange enables an exchange

func (*RPCServer) EnableExchangePair

EnableExchangePair enables the specified pair on an exchange

func (*RPCServer) EnableSubsystem

EnableSubsystem enables a engine subsytem

func (*RPCServer) GCTScriptAutoLoadToggle

GCTScriptAutoLoadToggle adds or removes an entry to the autoload list

func (*RPCServer) GCTScriptExecute

GCTScriptExecute execute a script

func (*RPCServer) GCTScriptListAll

GCTScriptListAll lists all scripts inside the default script path

func (*RPCServer) GCTScriptQuery

GCTScriptQuery queries a running script and returns script running information

func (*RPCServer) GCTScriptReadScript

GCTScriptReadScript read a script and return contents

func (*RPCServer) GCTScriptStatus

GCTScriptStatus returns a slice of current running scripts that includes next run time and uuid

func (*RPCServer) GCTScriptStop

GCTScriptStop terminate a running script

func (*RPCServer) GCTScriptStopAll

GCTScriptStopAll stops all running scripts

func (*RPCServer) GCTScriptUpload

GCTScriptUpload upload a new script to ScriptPath

func (*RPCServer) GetAccountInfo

GetAccountInfo returns an account balance for a specific exchange

func (*RPCServer) GetAccountInfoStream

GetAccountInfoStream streams an account balance for a specific exchange

func (*RPCServer) GetAuditEvent

GetAuditEvent returns matching audit events from database

func (*RPCServer) GetCommunicationRelayers

GetCommunicationRelayers returns the status of the engines communication relayers

func (*RPCServer) GetConfig

GetConfig returns the bots config

func (*RPCServer) GetCryptocurrencyDepositAddress

GetCryptocurrencyDepositAddress returns a cryptocurrency deposit address specified by exchange and cryptocurrency

func (*RPCServer) GetCryptocurrencyDepositAddresses

GetCryptocurrencyDepositAddresses returns a list of cryptocurrency deposit addresses specified by an exchange

func (*RPCServer) GetEvents

GetEvents returns the stored events list

func (*RPCServer) GetExchangeInfo

GetExchangeInfo gets info for a specific exchange

func (*RPCServer) GetExchangeOTPCode

GetExchangeOTPCode retrieves an exchanges OTP code

func (*RPCServer) GetExchangeOTPCodes

GetExchangeOTPCodes retrieves OTP codes for all exchanges which have an OTP secret installed

func (*RPCServer) GetExchangeOrderbookStream

GetExchangeOrderbookStream streams all orderbooks associated with an exchange

func (*RPCServer) GetExchangePairs

GetExchangePairs returns a list of exchange supported assets and related pairs

func (*RPCServer) GetExchangeTickerStream

GetExchangeTickerStream streams all tickers associated with an exchange

func (*RPCServer) GetExchanges

GetExchanges returns a list of exchanges Param is whether or not you wish to list enabled exchanges

func (*RPCServer) GetForexProviders

GetForexProviders returns a list of available forex providers

func (*RPCServer) GetForexRates

GetForexRates returns a list of forex rates

func (*RPCServer) GetHistoricCandles

GetHistoricCandles returns historical candles for a given exchange

func (*RPCServer) GetInfo

GetInfo returns info about the current GoCryptoTrader session

func (*RPCServer) GetLoggerDetails

GetLoggerDetails returns a loggers details

func (*RPCServer) GetOrder

GetOrder returns order information based on exchange and order ID

func (*RPCServer) GetOrderbook

GetOrderbook returns an orderbook for a specific exchange, currency pair and asset type

func (*RPCServer) GetOrderbookStream

GetOrderbookStream streams the requested updated orderbook

func (*RPCServer) GetOrderbooks

GetOrderbooks returns a list of orderbooks for all enabled exchanges and all enabled currency pairs

func (*RPCServer) GetOrders

GetOrders returns all open orders, filtered by exchange, currency pair or asset type

func (*RPCServer) GetPortfolio

GetPortfolio returns the portfolio details

func (*RPCServer) GetPortfolioSummary

GetPortfolioSummary returns the portfolio summary

func (*RPCServer) GetRPCEndpoints

GetRPCEndpoints returns a list of API endpoints

func (*RPCServer) GetSubsystems

GetSubsystems returns a list of subsystems and their status

func (*RPCServer) GetTicker

GetTicker returns the ticker for a specified exchange, currency pair and asset type

func (*RPCServer) GetTickerStream

GetTickerStream streams the requested updated ticker

func (*RPCServer) GetTickers

GetTickers returns a list of tickers for all enabled exchanges and all enabled currency pairs

func (*RPCServer) RemoveEvent

RemoveEvent removes an event, specified by an event ID

func (*RPCServer) RemovePortfolioAddress

RemovePortfolioAddress removes an address from the portfolio manager

func (*RPCServer) SetLoggerDetails

SetLoggerDetails sets a loggers details

func (*RPCServer) SimulateOrder

SimulateOrder simulates an order specified by exchange, currency pair and asset type

func (*RPCServer) SubmitOrder

SubmitOrder submits an order specified by exchange, currency pair and asset type

func (*RPCServer) WhaleBomb

WhaleBomb finds the amount required to reach a specific price target for a given exchange, pair and asset type

func (*RPCServer) WithdrawCryptocurrencyFunds

func (s *RPCServer) WithdrawCryptocurrencyFunds(ctx context.Context, r *gctrpc.WithdrawCryptoRequest) (*gctrpc.WithdrawResponse, error)

WithdrawCryptocurrencyFunds withdraws cryptocurrency funds specified by exchange

func (*RPCServer) WithdrawFiatFunds

func (s *RPCServer) WithdrawFiatFunds(ctx context.Context, r *gctrpc.WithdrawFiatRequest) (*gctrpc.WithdrawResponse, error)

WithdrawFiatFunds withdraws fiat funds specified by exchange

func (*RPCServer) WithdrawalEventByID

WithdrawalEventByID returns previous withdrawal request details

func (*RPCServer) WithdrawalEventsByDate

WithdrawalEventsByDate returns previous withdrawal request details by exchange

func (*RPCServer) WithdrawalEventsByExchange

WithdrawalEventsByExchange returns previous withdrawal request details by exchange

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route is a sub type that holds the request routes

type Settings

type Settings struct {
	ConfigFile            string
	DataDir               string
	MigrationDir          string
	LogFile               string
	GoMaxProcs            int
	CheckParamInteraction bool

	// Core Settings
	EnableDryRun                bool
	EnableAllExchanges          bool
	EnableAllPairs              bool
	EnableCoinmarketcapAnalysis bool
	EnablePortfolioManager      bool
	PortfolioManagerDelay       time.Duration
	EnableGRPC                  bool
	EnableGRPCProxy             bool
	EnableWebsocketRPC          bool
	EnableDeprecatedRPC         bool
	EnableCommsRelayer          bool
	EnableExchangeSyncManager   bool
	EnableDepositAddressManager bool
	EnableEventManager          bool
	EnableOrderManager          bool
	EnableConnectivityMonitor   bool
	EnableDatabaseManager       bool
	EnableGCTScriptManager      bool
	EnableNTPClient             bool
	EnableWebsocketRoutine      bool
	EventManagerDelay           time.Duration
	Verbose                     bool

	// Exchange syncer settings
	EnableTickerSyncing    bool
	EnableOrderbookSyncing bool
	EnableTradeSyncing     bool
	SyncWorkers            int
	SyncContinuously       bool
	SyncTimeout            time.Duration

	// Forex settings
	EnableCurrencyConverter bool
	EnableCurrencyLayer     bool
	EnableFixer             bool
	EnableOpenExchangeRates bool

	// Exchange tuning settings
	EnableExchangeHTTPRateLimiter  bool
	EnableExchangeHTTPDebugging    bool
	EnableExchangeVerbose          bool
	ExchangePurgeCredentials       bool
	EnableExchangeAutoPairUpdates  bool
	DisableExchangeAutoPairUpdates bool
	EnableExchangeRESTSupport      bool
	EnableExchangeWebsocketSupport bool
	MaxHTTPRequestJobsLimit        int
	RequestMaxRetryAttempts        int

	// Global HTTP related settings
	GlobalHTTPTimeout   time.Duration
	GlobalHTTPUserAgent string
	GlobalHTTPProxy     string

	// Exchange HTTP related settings
	HTTPTimeout   time.Duration
	HTTPUserAgent string
	HTTPProxy     string

	// Dispatch system settings
	EnableDispatcher        bool
	DispatchMaxWorkerAmount int
	DispatchJobsLimit       int

	// GCTscript settings
	MaxVirtualMachines uint

	// Withdraw settings
	WithdrawCacheSize uint64
}

Settings stores engine params

type SyncBase

type SyncBase struct {
	IsUsingWebsocket bool
	IsUsingREST      bool
	IsProcessing     bool
	LastUpdated      time.Time
	HaveData         bool
	NumErrors        int
}

SyncBase stores information

type WebsocketAuth

type WebsocketAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

WebsocketAuth is a struct used for

type WebsocketClient

type WebsocketClient struct {
	Hub           *WebsocketHub
	Conn          *websocket.Conn
	Authenticated bool

	Send chan []byte
	// contains filtered or unexported fields
}

WebsocketClient stores information related to the websocket client

func (*WebsocketClient) SendWebsocketMessage

func (c *WebsocketClient) SendWebsocketMessage(evt interface{}) error

SendWebsocketMessage sends a websocket event to the client

type WebsocketEvent

type WebsocketEvent struct {
	Exchange  string `json:"exchange,omitempty"`
	AssetType string `json:"assetType,omitempty"`
	Event     string
	Data      interface{}
}

WebsocketEvent is the struct used for websocket events

type WebsocketEventResponse

type WebsocketEventResponse struct {
	Event string      `json:"event"`
	Data  interface{} `json:"data"`
	Error string      `json:"error"`
}

WebsocketEventResponse is the struct used for websocket event responses

type WebsocketHub

type WebsocketHub struct {
	Clients    map[*WebsocketClient]bool
	Broadcast  chan []byte
	Register   chan *WebsocketClient
	Unregister chan *WebsocketClient
}

WebsocketHub stores the data for managing websocket clients

func NewWebsocketHub

func NewWebsocketHub() *WebsocketHub

NewWebsocketHub Creates a new websocket hub

type WebsocketOrderbookTickerRequest

type WebsocketOrderbookTickerRequest struct {
	Exchange  string `json:"exchangeName"`
	Currency  string `json:"currency"`
	AssetType string `json:"assetType"`
}

WebsocketOrderbookTickerRequest is a struct used for ticker and orderbook requests

Jump to

Keyboard shortcuts

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