Documentation ¶
Index ¶
- Constants
- Variables
- func Add(exchange, item string, condition EventConditionParams, ...) (int64, error)
- func BroadcastWebsocketMessage(evt WebsocketEvent) error
- func EventManger()
- func FormatCurrency(p currency.Pair) currency.Pair
- func GetAllAvailablePairs(enabledExchangesOnly bool, assetType asset.Item) currency.Pairs
- func GetAuthAPISupportedExchanges() []string
- func GetAvailableExchanges() []string
- func GetCollatedExchangeAccountInfoByCoin(accounts []account.Holdings) map[currency.Code]account.Balance
- func GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, ...) ([]string, error)
- func GetCryptocurrencyDepositAddressesByExchange(exchName string) (map[string]string, error)
- func GetEventCounter() (total, executed int)
- func GetExchangeByName(exchName string) exchange.IBotExchange
- func GetExchangeCryptocurrencyDepositAddress(exchName, accountID string, item currency.Code) (string, error)
- func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string
- func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error)
- func GetExchangeLowestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error)
- func GetExchangeNames(enabledOnly bool) []string
- func GetExchangeNamesByCurrency(p currency.Pair, enabled bool, assetType asset.Item) []string
- func GetExchangeOTPs() (map[string]string, error)
- func GetExchangeoOTPByName(exchName string) (string, error)
- func GetExchanges() []exchange.IBotExchange
- func GetRPCEndpoints() map[string]RPCEndpoint
- func GetRelatableCryptocurrencies(p currency.Pair) currency.Pairs
- func GetRelatableCurrencies(p currency.Pair, incOrig, incUSDT bool) currency.Pairs
- func GetRelatableFiatCurrencies(p currency.Pair) currency.Pairs
- func GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, ...) currency.Pairs
- func GetSpecificOrderbook(p currency.Pair, exchangeName string, assetType asset.Item) (*orderbook.Base, error)
- func GetSpecificTicker(p currency.Pair, exchangeName string, assetType asset.Item) (*ticker.Price, error)
- func GetSubsystemsStatus() map[string]bool
- func IsOnline() bool
- func IsRelatablePairs(p1, p2 currency.Pair, includeUSDT bool) bool
- func IsValidAction(action string) bool
- func IsValidCondition(condition string) bool
- func IsValidEvent(exchange, item string, condition EventConditionParams, action string) error
- func IsValidExchange(exchangeName string) bool
- func IsValidItem(item string) bool
- func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error
- func MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetType asset.Item) map[string]currency.Pairs
- func PrintSettings(s *Settings)
- func RESTGetAllActiveOrderbooks(w http.ResponseWriter, r *http.Request)
- func RESTGetAllActiveTickers(w http.ResponseWriter, r *http.Request)
- func RESTGetAllEnabledAccountInfo(w http.ResponseWriter, r *http.Request)
- func RESTGetAllSettings(w http.ResponseWriter, r *http.Request)
- func RESTGetPortfolio(w http.ResponseWriter, r *http.Request)
- func RESTLogger(inner http.Handler, name string) http.Handler
- func RESTSaveAllSettings(w http.ResponseWriter, r *http.Request)
- func RESTfulError(method string, err error)
- func RESTfulJSONResponse(w http.ResponseWriter, response interface{}) error
- func Remove(eventID int64) bool
- func SeedExchangeAccountInfo(accounts []account.Holdings)
- func SetSubsystem(subsys string, enable bool) error
- func SetupExchanges()
- func StartRESTServer()
- func StartRPCRESTProxy()
- func StartRPCServer()
- func StartWebsocketHandler()
- func StartWebsocketServer()
- func SubmitWithdrawal(exchName string, req *withdraw.Request) (*withdraw.Response, error)
- func UnloadExchange(exchName string) error
- func ValidateSettings(b *Engine, s *Settings)
- func WebsocketClientHandler(w http.ResponseWriter, r *http.Request)
- func WebsocketDataHandler(exchName string, data interface{}) error
- func WebsocketDataReceiver(ws *wshandler.Websocket)
- func WebsocketRoutine()
- func WithdrawEventByDate(exchange string, start, end time.Time, limit int) ([]*withdraw.Response, error)
- func WithdrawalEventByExchange(exchange string, limit int) ([]*withdraw.Response, error)
- func WithdrawalEventByExchangeID(exchange, id string) (*withdraw.Response, error)
- func WithdrawalEventByID(id string) (*withdraw.Response, error)
- type AllEnabledExchangeAccounts
- type AllEnabledExchangeCurrencies
- type AllEnabledExchangeOrderbooks
- type CurrencyPairSyncAgent
- type CurrencyPairSyncerConfig
- type DepositAddressManager
- type DepositAddressStore
- type EnabledExchangeCurrencies
- type EnabledExchangeOrderbooks
- type Engine
- type Event
- type EventConditionParams
- type ExchangeCurrencyPairSyncer
- type ExchangeSyncerConfig
- type RPCEndpoint
- type RPCServer
- func (s *RPCServer) AddEvent(ctx context.Context, r *gctrpc.AddEventRequest) (*gctrpc.AddEventResponse, error)
- func (s *RPCServer) AddPortfolioAddress(ctx context.Context, r *gctrpc.AddPortfolioAddressRequest) (*gctrpc.AddPortfolioAddressResponse, error)
- func (s *RPCServer) CancelAllOrders(ctx context.Context, r *gctrpc.CancelAllOrdersRequest) (*gctrpc.CancelAllOrdersResponse, error)
- func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderRequest) (*gctrpc.CancelOrderResponse, error)
- func (s *RPCServer) DisableExchange(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericExchangeNameResponse, error)
- func (s *RPCServer) DisableExchangePair(ctx context.Context, r *gctrpc.ExchangePairRequest) (*gctrpc.GenericExchangeNameResponse, error)
- func (s *RPCServer) DisableSubsystem(ctx context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericSubsystemResponse, error)
- func (s *RPCServer) EnableExchange(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericExchangeNameResponse, error)
- func (s *RPCServer) EnableExchangePair(ctx context.Context, r *gctrpc.ExchangePairRequest) (*gctrpc.GenericExchangeNameResponse, error)
- func (s *RPCServer) EnableSubsystem(ctx context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericSubsystemResponse, error)
- func (s *RPCServer) GCTScriptAutoLoadToggle(ctx context.Context, r *gctrpc.GCTScriptAutoLoadRequest) (*gctrpc.GCTScriptGenericResponse, error)
- func (s *RPCServer) GCTScriptExecute(ctx context.Context, r *gctrpc.GCTScriptExecuteRequest) (*gctrpc.GCTScriptGenericResponse, error)
- func (s *RPCServer) GCTScriptListAll(context.Context, *gctrpc.GCTScriptListAllRequest) (*gctrpc.GCTScriptStatusResponse, error)
- func (s *RPCServer) GCTScriptQuery(ctx context.Context, r *gctrpc.GCTScriptQueryRequest) (*gctrpc.GCTScriptQueryResponse, error)
- func (s *RPCServer) GCTScriptReadScript(ctx context.Context, r *gctrpc.GCTScriptReadScriptRequest) (*gctrpc.GCTScriptQueryResponse, error)
- func (s *RPCServer) GCTScriptStatus(ctx context.Context, r *gctrpc.GCTScriptStatusRequest) (*gctrpc.GCTScriptStatusResponse, error)
- func (s *RPCServer) GCTScriptStop(ctx context.Context, r *gctrpc.GCTScriptStopRequest) (*gctrpc.GCTScriptGenericResponse, error)
- func (s *RPCServer) GCTScriptStopAll(context.Context, *gctrpc.GCTScriptStopAllRequest) (*gctrpc.GCTScriptGenericResponse, error)
- func (s *RPCServer) GCTScriptUpload(ctx context.Context, r *gctrpc.GCTScriptUploadRequest) (*gctrpc.GCTScriptGenericResponse, error)
- func (s *RPCServer) GetAccountInfo(ctx context.Context, r *gctrpc.GetAccountInfoRequest) (*gctrpc.GetAccountInfoResponse, error)
- func (s *RPCServer) GetAccountInfoStream(r *gctrpc.GetAccountInfoRequest, ...) error
- func (s *RPCServer) GetAuditEvent(ctx context.Context, r *gctrpc.GetAuditEventRequest) (*gctrpc.GetAuditEventResponse, error)
- func (s *RPCServer) GetCommunicationRelayers(ctx context.Context, r *gctrpc.GetCommunicationRelayersRequest) (*gctrpc.GetCommunicationRelayersResponse, error)
- func (s *RPCServer) GetConfig(ctx context.Context, r *gctrpc.GetConfigRequest) (*gctrpc.GetConfigResponse, error)
- func (s *RPCServer) GetCryptocurrencyDepositAddress(ctx context.Context, r *gctrpc.GetCryptocurrencyDepositAddressRequest) (*gctrpc.GetCryptocurrencyDepositAddressResponse, error)
- func (s *RPCServer) GetCryptocurrencyDepositAddresses(ctx context.Context, r *gctrpc.GetCryptocurrencyDepositAddressesRequest) (*gctrpc.GetCryptocurrencyDepositAddressesResponse, error)
- func (s *RPCServer) GetEvents(ctx context.Context, r *gctrpc.GetEventsRequest) (*gctrpc.GetEventsResponse, error)
- func (s *RPCServer) GetExchangeInfo(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeInfoResponse, error)
- func (s *RPCServer) GetExchangeOTPCode(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeOTPReponse, error)
- func (s *RPCServer) GetExchangeOTPCodes(ctx context.Context, r *gctrpc.GetExchangeOTPsRequest) (*gctrpc.GetExchangeOTPsResponse, error)
- func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStreamRequest, ...) error
- func (s *RPCServer) GetExchangePairs(ctx context.Context, r *gctrpc.GetExchangePairsRequest) (*gctrpc.GetExchangePairsResponse, error)
- func (s *RPCServer) GetExchangeTickerStream(r *gctrpc.GetExchangeTickerStreamRequest, ...) error
- func (s *RPCServer) GetExchanges(ctx context.Context, r *gctrpc.GetExchangesRequest) (*gctrpc.GetExchangesResponse, error)
- func (s *RPCServer) GetForexProviders(ctx context.Context, r *gctrpc.GetForexProvidersRequest) (*gctrpc.GetForexProvidersResponse, error)
- func (s *RPCServer) GetForexRates(ctx context.Context, r *gctrpc.GetForexRatesRequest) (*gctrpc.GetForexRatesResponse, error)
- func (s *RPCServer) GetHistoricCandles(ctx context.Context, req *gctrpc.GetHistoricCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
- func (s *RPCServer) GetInfo(ctx context.Context, r *gctrpc.GetInfoRequest) (*gctrpc.GetInfoResponse, error)
- func (s *RPCServer) GetLoggerDetails(ctx context.Context, r *gctrpc.GetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
- func (s *RPCServer) GetOrder(ctx context.Context, r *gctrpc.GetOrderRequest) (*gctrpc.OrderDetails, error)
- func (s *RPCServer) GetOrderbook(ctx context.Context, r *gctrpc.GetOrderbookRequest) (*gctrpc.OrderbookResponse, error)
- func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, ...) error
- func (s *RPCServer) GetOrderbooks(ctx context.Context, r *gctrpc.GetOrderbooksRequest) (*gctrpc.GetOrderbooksResponse, error)
- func (s *RPCServer) GetOrders(ctx context.Context, r *gctrpc.GetOrdersRequest) (*gctrpc.GetOrdersResponse, error)
- func (s *RPCServer) GetPortfolio(ctx context.Context, r *gctrpc.GetPortfolioRequest) (*gctrpc.GetPortfolioResponse, error)
- func (s *RPCServer) GetPortfolioSummary(ctx context.Context, r *gctrpc.GetPortfolioSummaryRequest) (*gctrpc.GetPortfolioSummaryResponse, error)
- func (s *RPCServer) GetRPCEndpoints(ctx context.Context, r *gctrpc.GetRPCEndpointsRequest) (*gctrpc.GetRPCEndpointsResponse, error)
- func (s *RPCServer) GetSubsystems(ctx context.Context, r *gctrpc.GetSubsystemsRequest) (*gctrpc.GetSusbsytemsResponse, error)
- func (s *RPCServer) GetTicker(ctx context.Context, r *gctrpc.GetTickerRequest) (*gctrpc.TickerResponse, error)
- func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, ...) error
- func (s *RPCServer) GetTickers(ctx context.Context, r *gctrpc.GetTickersRequest) (*gctrpc.GetTickersResponse, error)
- func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.RemoveEventResponse, error)
- func (s *RPCServer) RemovePortfolioAddress(ctx context.Context, r *gctrpc.RemovePortfolioAddressRequest) (*gctrpc.RemovePortfolioAddressResponse, error)
- func (s *RPCServer) SetLoggerDetails(ctx context.Context, r *gctrpc.SetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
- func (s *RPCServer) SimulateOrder(ctx context.Context, r *gctrpc.SimulateOrderRequest) (*gctrpc.SimulateOrderResponse, error)
- func (s *RPCServer) SubmitOrder(ctx context.Context, r *gctrpc.SubmitOrderRequest) (*gctrpc.SubmitOrderResponse, error)
- func (s *RPCServer) WhaleBomb(ctx context.Context, r *gctrpc.WhaleBombRequest) (*gctrpc.SimulateOrderResponse, error)
- func (s *RPCServer) WithdrawCryptocurrencyFunds(ctx context.Context, r *gctrpc.WithdrawCryptoRequest) (*gctrpc.WithdrawResponse, error)
- func (s *RPCServer) WithdrawFiatFunds(ctx context.Context, r *gctrpc.WithdrawFiatRequest) (*gctrpc.WithdrawResponse, error)
- func (s *RPCServer) WithdrawalEventByID(ctx context.Context, r *gctrpc.WithdrawalEventByIDRequest) (*gctrpc.WithdrawalEventByIDResponse, error)
- func (s *RPCServer) WithdrawalEventsByDate(ctx context.Context, r *gctrpc.WithdrawalEventsByDateRequest) (*gctrpc.WithdrawalEventsByExchangeResponse, error)
- func (s *RPCServer) WithdrawalEventsByExchange(ctx context.Context, r *gctrpc.WithdrawalEventsByExchangeRequest) (*gctrpc.WithdrawalEventsByExchangeResponse, error)
- type Route
- type Settings
- type SyncBase
- type WebsocketAuth
- type WebsocketClient
- type WebsocketEvent
- type WebsocketEventResponse
- type WebsocketHub
- type WebsocketOrderbookTickerRequest
Constants ¶
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" )
const ( ItemPrice = "PRICE" ItemOrderbook = "ORDERBOOK" ConditionGreaterThan = ">" ConditionGreaterThanOrEqual = ">=" ConditionLessThan = "<" ConditionLessThanOrEqual = "<=" ConditionIsEqual = "==" ActionSMSNotify = "SMS" ActionConsolePrint = "CONSOLE_PRINT" ActionTest = "ACTION_TEST" )
Event const vars
const ( SyncItemTicker = iota SyncItemOrderbook SyncItemTrade DefaultSyncerWorkers = 15 DefaultSyncerTimeout = time.Second * 15 )
const holds the sync item types
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" )
const (
WebsocketResponseSuccess = "OK"
)
Const vars for websocket
Variables ¶
var ( ErrDepositAddressStoreIsNil = errors.New("deposit address store is nil") ErrDepositAddressNotFound = errors.New("deposit address does not exist") )
vars related to the deposit address helpers
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
var ( OrderManagerDelay = time.Second * 10 ErrOrdersAlreadyExists = errors.New("order already exists") ErrOrderNotFound = errors.New("order does not exist") )
vars for the fund manager package
var ( NTPCheckInterval = time.Second * 30 NTPRetryLimit = 3 )
vars related to the NTP manager
var (
EventSleepDelay = defaultSleepDelay
)
vars related to events package
var Events []*Event
Events variable is a pointer array to the event structures that will be appended
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 ¶
FormatCurrency is a method that formats and returns a currency pair based on the user currency display preferences
func GetAllAvailablePairs ¶
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 ¶
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 ¶
GetExchangeCryptocurrencyDepositAddresses obtains an exchanges deposit cryptocurrency list
func GetExchangeHighestPriceByCurrencyPair ¶
GetExchangeHighestPriceByCurrencyPair returns the exchange with the highest price for a given currency pair and asset type
func GetExchangeLowestPriceByCurrencyPair ¶
GetExchangeLowestPriceByCurrencyPair returns the exchange with the lowest price for a given currency pair and asset type
func GetExchangeNames ¶
GetExchangeNames returns a list of enabled or disabled exchanges
func GetExchangeNamesByCurrency ¶
GetExchangeNamesByCurrency returns a list of exchanges supporting a currency pair based on whether the exchange is enabled or not
func GetExchangeOTPs ¶
GetExchangeOTPs returns OTP codes for all exchanges which have a otpsecret stored
func GetExchangeoOTPByName ¶
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 ¶
GetRelatableCryptocurrencies returns a list of currency pairs if it can find any relatable currencies (e.g ETHBTC -> ETHLTC -> ETHUSDT -> ETHREP)
func GetRelatableCurrencies ¶
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 ¶
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 ¶
GetSubsystemsStatus returns the status of various subsystems
func IsOnline ¶
func IsOnline() bool
IsOnline returns whether or not the engine has Internet connectivity
func IsRelatablePairs ¶
IsRelatablePairs checks to see if the two pairs are relatable
func IsValidAction ¶
IsValidAction validates passed in action
func IsValidCondition ¶
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 ¶
IsValidExchange validates the exchange
func LoadExchange ¶
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 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 ¶
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 ¶
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 SeedExchangeAccountInfo ¶
SeedExchangeAccountInfo seeds account info
func SetSubsystem ¶
SetSubsystem enables or disables an engine subsystem
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 ¶
SubmitWithdrawal preforms validation and submits a new withdraw request to exchange
func UnloadExchange ¶
UnloadExchange unloads an exchange by name
func ValidateSettings ¶
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 ¶
WebsocketDataHandler is a central point for exchange websocket implementations to send processed data. WebsocketDataHandler will then pass that to an appropriate handler
func WebsocketDataReceiver ¶
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 ¶
WithdrawalEventByExchange returns a withdrawal request by ID
func WithdrawalEventByExchangeID ¶
WithdrawalEventByExchangeID returns a withdrawal request by Exchange ID
Types ¶
type AllEnabledExchangeAccounts ¶
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
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 NewFromSettings ¶
NewFromSettings starts a new engine based on supplied settings
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 ¶
CheckEventCondition will check the event structure to see if there is a condition met
func (*Event) ExecuteAction ¶
ExecuteAction will execute the action pending on the chain
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 ¶
ExchangeSyncerConfig stores the exchange syncer config
type RPCEndpoint ¶
RPCEndpoint stores an RPC endpoint status and addr
type RPCServer ¶
type RPCServer struct{}
RPCServer struct
func (*RPCServer) AddEvent ¶
func (s *RPCServer) AddEvent(ctx context.Context, r *gctrpc.AddEventRequest) (*gctrpc.AddEventResponse, error)
AddEvent adds an event
func (*RPCServer) AddPortfolioAddress ¶
func (s *RPCServer) AddPortfolioAddress(ctx context.Context, r *gctrpc.AddPortfolioAddressRequest) (*gctrpc.AddPortfolioAddressResponse, error)
AddPortfolioAddress adds an address to the portfolio manager
func (*RPCServer) CancelAllOrders ¶
func (s *RPCServer) CancelAllOrders(ctx context.Context, r *gctrpc.CancelAllOrdersRequest) (*gctrpc.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders, filterable by exchange
func (*RPCServer) CancelOrder ¶
func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderRequest) (*gctrpc.CancelOrderResponse, error)
CancelOrder cancels an order specified by exchange, currency pair and asset type
func (*RPCServer) DisableExchange ¶
func (s *RPCServer) DisableExchange(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericExchangeNameResponse, error)
DisableExchange disables an exchange
func (*RPCServer) DisableExchangePair ¶
func (s *RPCServer) DisableExchangePair(ctx context.Context, r *gctrpc.ExchangePairRequest) (*gctrpc.GenericExchangeNameResponse, error)
DisableExchangePair disables the specified pair on an exchange
func (*RPCServer) DisableSubsystem ¶
func (s *RPCServer) DisableSubsystem(ctx context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericSubsystemResponse, error)
DisableSubsystem disables a engine subsytem
func (*RPCServer) EnableExchange ¶
func (s *RPCServer) EnableExchange(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericExchangeNameResponse, error)
EnableExchange enables an exchange
func (*RPCServer) EnableExchangePair ¶
func (s *RPCServer) EnableExchangePair(ctx context.Context, r *gctrpc.ExchangePairRequest) (*gctrpc.GenericExchangeNameResponse, error)
EnableExchangePair enables the specified pair on an exchange
func (*RPCServer) EnableSubsystem ¶
func (s *RPCServer) EnableSubsystem(ctx context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericSubsystemResponse, error)
EnableSubsystem enables a engine subsytem
func (*RPCServer) GCTScriptAutoLoadToggle ¶
func (s *RPCServer) GCTScriptAutoLoadToggle(ctx context.Context, r *gctrpc.GCTScriptAutoLoadRequest) (*gctrpc.GCTScriptGenericResponse, error)
GCTScriptAutoLoadToggle adds or removes an entry to the autoload list
func (*RPCServer) GCTScriptExecute ¶
func (s *RPCServer) GCTScriptExecute(ctx context.Context, r *gctrpc.GCTScriptExecuteRequest) (*gctrpc.GCTScriptGenericResponse, error)
GCTScriptExecute execute a script
func (*RPCServer) GCTScriptListAll ¶
func (s *RPCServer) GCTScriptListAll(context.Context, *gctrpc.GCTScriptListAllRequest) (*gctrpc.GCTScriptStatusResponse, error)
GCTScriptListAll lists all scripts inside the default script path
func (*RPCServer) GCTScriptQuery ¶
func (s *RPCServer) GCTScriptQuery(ctx context.Context, r *gctrpc.GCTScriptQueryRequest) (*gctrpc.GCTScriptQueryResponse, error)
GCTScriptQuery queries a running script and returns script running information
func (*RPCServer) GCTScriptReadScript ¶
func (s *RPCServer) GCTScriptReadScript(ctx context.Context, r *gctrpc.GCTScriptReadScriptRequest) (*gctrpc.GCTScriptQueryResponse, error)
GCTScriptReadScript read a script and return contents
func (*RPCServer) GCTScriptStatus ¶
func (s *RPCServer) GCTScriptStatus(ctx context.Context, r *gctrpc.GCTScriptStatusRequest) (*gctrpc.GCTScriptStatusResponse, error)
GCTScriptStatus returns a slice of current running scripts that includes next run time and uuid
func (*RPCServer) GCTScriptStop ¶
func (s *RPCServer) GCTScriptStop(ctx context.Context, r *gctrpc.GCTScriptStopRequest) (*gctrpc.GCTScriptGenericResponse, error)
GCTScriptStop terminate a running script
func (*RPCServer) GCTScriptStopAll ¶
func (s *RPCServer) GCTScriptStopAll(context.Context, *gctrpc.GCTScriptStopAllRequest) (*gctrpc.GCTScriptGenericResponse, error)
GCTScriptStopAll stops all running scripts
func (*RPCServer) GCTScriptUpload ¶
func (s *RPCServer) GCTScriptUpload(ctx context.Context, r *gctrpc.GCTScriptUploadRequest) (*gctrpc.GCTScriptGenericResponse, error)
GCTScriptUpload upload a new script to ScriptPath
func (*RPCServer) GetAccountInfo ¶
func (s *RPCServer) GetAccountInfo(ctx context.Context, r *gctrpc.GetAccountInfoRequest) (*gctrpc.GetAccountInfoResponse, error)
GetAccountInfo returns an account balance for a specific exchange
func (*RPCServer) GetAccountInfoStream ¶
func (s *RPCServer) GetAccountInfoStream(r *gctrpc.GetAccountInfoRequest, stream gctrpc.GoCryptoTrader_GetAccountInfoStreamServer) error
GetAccountInfoStream streams an account balance for a specific exchange
func (*RPCServer) GetAuditEvent ¶
func (s *RPCServer) GetAuditEvent(ctx context.Context, r *gctrpc.GetAuditEventRequest) (*gctrpc.GetAuditEventResponse, error)
GetAuditEvent returns matching audit events from database
func (*RPCServer) GetCommunicationRelayers ¶
func (s *RPCServer) GetCommunicationRelayers(ctx context.Context, r *gctrpc.GetCommunicationRelayersRequest) (*gctrpc.GetCommunicationRelayersResponse, error)
GetCommunicationRelayers returns the status of the engines communication relayers
func (*RPCServer) GetConfig ¶
func (s *RPCServer) GetConfig(ctx context.Context, r *gctrpc.GetConfigRequest) (*gctrpc.GetConfigResponse, error)
GetConfig returns the bots config
func (*RPCServer) GetCryptocurrencyDepositAddress ¶
func (s *RPCServer) GetCryptocurrencyDepositAddress(ctx context.Context, r *gctrpc.GetCryptocurrencyDepositAddressRequest) (*gctrpc.GetCryptocurrencyDepositAddressResponse, error)
GetCryptocurrencyDepositAddress returns a cryptocurrency deposit address specified by exchange and cryptocurrency
func (*RPCServer) GetCryptocurrencyDepositAddresses ¶
func (s *RPCServer) GetCryptocurrencyDepositAddresses(ctx context.Context, r *gctrpc.GetCryptocurrencyDepositAddressesRequest) (*gctrpc.GetCryptocurrencyDepositAddressesResponse, error)
GetCryptocurrencyDepositAddresses returns a list of cryptocurrency deposit addresses specified by an exchange
func (*RPCServer) GetEvents ¶
func (s *RPCServer) GetEvents(ctx context.Context, r *gctrpc.GetEventsRequest) (*gctrpc.GetEventsResponse, error)
GetEvents returns the stored events list
func (*RPCServer) GetExchangeInfo ¶
func (s *RPCServer) GetExchangeInfo(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeInfoResponse, error)
GetExchangeInfo gets info for a specific exchange
func (*RPCServer) GetExchangeOTPCode ¶
func (s *RPCServer) GetExchangeOTPCode(ctx context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeOTPReponse, error)
GetExchangeOTPCode retrieves an exchanges OTP code
func (*RPCServer) GetExchangeOTPCodes ¶
func (s *RPCServer) GetExchangeOTPCodes(ctx context.Context, r *gctrpc.GetExchangeOTPsRequest) (*gctrpc.GetExchangeOTPsResponse, error)
GetExchangeOTPCodes retrieves OTP codes for all exchanges which have an OTP secret installed
func (*RPCServer) GetExchangeOrderbookStream ¶
func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStreamRequest, stream gctrpc.GoCryptoTrader_GetExchangeOrderbookStreamServer) error
GetExchangeOrderbookStream streams all orderbooks associated with an exchange
func (*RPCServer) GetExchangePairs ¶
func (s *RPCServer) GetExchangePairs(ctx context.Context, r *gctrpc.GetExchangePairsRequest) (*gctrpc.GetExchangePairsResponse, error)
GetExchangePairs returns a list of exchange supported assets and related pairs
func (*RPCServer) GetExchangeTickerStream ¶
func (s *RPCServer) GetExchangeTickerStream(r *gctrpc.GetExchangeTickerStreamRequest, stream gctrpc.GoCryptoTrader_GetExchangeTickerStreamServer) error
GetExchangeTickerStream streams all tickers associated with an exchange
func (*RPCServer) GetExchanges ¶
func (s *RPCServer) GetExchanges(ctx context.Context, r *gctrpc.GetExchangesRequest) (*gctrpc.GetExchangesResponse, error)
GetExchanges returns a list of exchanges Param is whether or not you wish to list enabled exchanges
func (*RPCServer) GetForexProviders ¶
func (s *RPCServer) GetForexProviders(ctx context.Context, r *gctrpc.GetForexProvidersRequest) (*gctrpc.GetForexProvidersResponse, error)
GetForexProviders returns a list of available forex providers
func (*RPCServer) GetForexRates ¶
func (s *RPCServer) GetForexRates(ctx context.Context, r *gctrpc.GetForexRatesRequest) (*gctrpc.GetForexRatesResponse, error)
GetForexRates returns a list of forex rates
func (*RPCServer) GetHistoricCandles ¶
func (s *RPCServer) GetHistoricCandles(ctx context.Context, req *gctrpc.GetHistoricCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
GetHistoricCandles returns historical candles for a given exchange
func (*RPCServer) GetInfo ¶
func (s *RPCServer) GetInfo(ctx context.Context, r *gctrpc.GetInfoRequest) (*gctrpc.GetInfoResponse, error)
GetInfo returns info about the current GoCryptoTrader session
func (*RPCServer) GetLoggerDetails ¶
func (s *RPCServer) GetLoggerDetails(ctx context.Context, r *gctrpc.GetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
GetLoggerDetails returns a loggers details
func (*RPCServer) GetOrder ¶
func (s *RPCServer) GetOrder(ctx context.Context, r *gctrpc.GetOrderRequest) (*gctrpc.OrderDetails, error)
GetOrder returns order information based on exchange and order ID
func (*RPCServer) GetOrderbook ¶
func (s *RPCServer) GetOrderbook(ctx context.Context, r *gctrpc.GetOrderbookRequest) (*gctrpc.OrderbookResponse, error)
GetOrderbook returns an orderbook for a specific exchange, currency pair and asset type
func (*RPCServer) GetOrderbookStream ¶
func (s *RPCServer) GetOrderbookStream(r *gctrpc.GetOrderbookStreamRequest, stream gctrpc.GoCryptoTrader_GetOrderbookStreamServer) error
GetOrderbookStream streams the requested updated orderbook
func (*RPCServer) GetOrderbooks ¶
func (s *RPCServer) GetOrderbooks(ctx context.Context, r *gctrpc.GetOrderbooksRequest) (*gctrpc.GetOrderbooksResponse, error)
GetOrderbooks returns a list of orderbooks for all enabled exchanges and all enabled currency pairs
func (*RPCServer) GetOrders ¶
func (s *RPCServer) GetOrders(ctx context.Context, r *gctrpc.GetOrdersRequest) (*gctrpc.GetOrdersResponse, error)
GetOrders returns all open orders, filtered by exchange, currency pair or asset type
func (*RPCServer) GetPortfolio ¶
func (s *RPCServer) GetPortfolio(ctx context.Context, r *gctrpc.GetPortfolioRequest) (*gctrpc.GetPortfolioResponse, error)
GetPortfolio returns the portfolio details
func (*RPCServer) GetPortfolioSummary ¶
func (s *RPCServer) GetPortfolioSummary(ctx context.Context, r *gctrpc.GetPortfolioSummaryRequest) (*gctrpc.GetPortfolioSummaryResponse, error)
GetPortfolioSummary returns the portfolio summary
func (*RPCServer) GetRPCEndpoints ¶
func (s *RPCServer) GetRPCEndpoints(ctx context.Context, r *gctrpc.GetRPCEndpointsRequest) (*gctrpc.GetRPCEndpointsResponse, error)
GetRPCEndpoints returns a list of API endpoints
func (*RPCServer) GetSubsystems ¶
func (s *RPCServer) GetSubsystems(ctx context.Context, r *gctrpc.GetSubsystemsRequest) (*gctrpc.GetSusbsytemsResponse, error)
GetSubsystems returns a list of subsystems and their status
func (*RPCServer) GetTicker ¶
func (s *RPCServer) GetTicker(ctx context.Context, r *gctrpc.GetTickerRequest) (*gctrpc.TickerResponse, error)
GetTicker returns the ticker for a specified exchange, currency pair and asset type
func (*RPCServer) GetTickerStream ¶
func (s *RPCServer) GetTickerStream(r *gctrpc.GetTickerStreamRequest, stream gctrpc.GoCryptoTrader_GetTickerStreamServer) error
GetTickerStream streams the requested updated ticker
func (*RPCServer) GetTickers ¶
func (s *RPCServer) GetTickers(ctx context.Context, r *gctrpc.GetTickersRequest) (*gctrpc.GetTickersResponse, error)
GetTickers returns a list of tickers for all enabled exchanges and all enabled currency pairs
func (*RPCServer) RemoveEvent ¶
func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.RemoveEventResponse, error)
RemoveEvent removes an event, specified by an event ID
func (*RPCServer) RemovePortfolioAddress ¶
func (s *RPCServer) RemovePortfolioAddress(ctx context.Context, r *gctrpc.RemovePortfolioAddressRequest) (*gctrpc.RemovePortfolioAddressResponse, error)
RemovePortfolioAddress removes an address from the portfolio manager
func (*RPCServer) SetLoggerDetails ¶
func (s *RPCServer) SetLoggerDetails(ctx context.Context, r *gctrpc.SetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
SetLoggerDetails sets a loggers details
func (*RPCServer) SimulateOrder ¶
func (s *RPCServer) SimulateOrder(ctx context.Context, r *gctrpc.SimulateOrderRequest) (*gctrpc.SimulateOrderResponse, error)
SimulateOrder simulates an order specified by exchange, currency pair and asset type
func (*RPCServer) SubmitOrder ¶
func (s *RPCServer) SubmitOrder(ctx context.Context, r *gctrpc.SubmitOrderRequest) (*gctrpc.SubmitOrderResponse, error)
SubmitOrder submits an order specified by exchange, currency pair and asset type
func (*RPCServer) WhaleBomb ¶
func (s *RPCServer) WhaleBomb(ctx context.Context, r *gctrpc.WhaleBombRequest) (*gctrpc.SimulateOrderResponse, error)
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 ¶
func (s *RPCServer) WithdrawalEventByID(ctx context.Context, r *gctrpc.WithdrawalEventByIDRequest) (*gctrpc.WithdrawalEventByIDResponse, error)
WithdrawalEventByID returns previous withdrawal request details
func (*RPCServer) WithdrawalEventsByDate ¶
func (s *RPCServer) WithdrawalEventsByDate(ctx context.Context, r *gctrpc.WithdrawalEventsByDateRequest) (*gctrpc.WithdrawalEventsByExchangeResponse, error)
WithdrawalEventsByDate returns previous withdrawal request details by exchange
func (*RPCServer) WithdrawalEventsByExchange ¶
func (s *RPCServer) WithdrawalEventsByExchange(ctx context.Context, r *gctrpc.WithdrawalEventsByExchangeRequest) (*gctrpc.WithdrawalEventsByExchangeResponse, error)
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 ¶
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
Source Files ¶
- addr_helpers.go
- comms_relayer.go
- connection.go
- database.go
- engine.go
- engine_types.go
- events.go
- exchange.go
- gctscript.go
- helpers.go
- orders.go
- orders_types.go
- portfolio.go
- restful_router.go
- restful_server.go
- restful_types.go
- routines.go
- rpcserver.go
- syncer.go
- syncer_types.go
- timekeeper.go
- websocket.go
- websocket_types.go
- withdraw.go