Documentation ¶
Index ¶
- Constants
- Variables
- func BroadcastWebsocketMessage(evt WebsocketEvent) error
- func GetCollatedExchangeAccountInfoByCoin(accounts []account.Holdings) map[currency.Code]account.Balance
- func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, a asset.Item) (string, error)
- func GetExchangeLowestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error)
- 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 IsRelatablePairs(p1, p2 currency.Pair, includeUSDT bool) bool
- func PrintSettings(s *Settings)
- func StartRPCServer(engine *Engine)
- func StartWebsocketHandler()
- type AllEnabledExchangeAccounts
- type AllEnabledExchangeCurrencies
- type AllEnabledExchangeOrderbooks
- type CommunicationManager
- type Config
- type CurrencyStateManager
- func (c *CurrencyStateManager) CanDepositRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
- func (c *CurrencyStateManager) CanTradePairRPC(exchName string, pair currency.Pair, a asset.Item) (*gctrpc.GenericResponse, error)
- func (c *CurrencyStateManager) CanTradeRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
- func (c *CurrencyStateManager) CanWithdrawRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
- func (c *CurrencyStateManager) GetAllRPC(exchName string) (*gctrpc.CurrencyStateResponse, error)
- func (c *CurrencyStateManager) IsRunning() bool
- func (c *CurrencyStateManager) Start() error
- func (c *CurrencyStateManager) Stop() error
- type CustomExchangeBuilder
- type DataHistoryJob
- type DataHistoryJobResult
- type DataHistoryJobSummary
- type DataHistoryManager
- func (m *DataHistoryManager) CheckCandleIssue(job *DataHistoryJob, multiplier int64, apiData, dbData float64, ...) (issue string, replace bool)
- func (m *DataHistoryManager) GenerateJobSummary(nickname string) (*DataHistoryJobSummary, error)
- func (m *DataHistoryManager) GetActiveJobs() ([]DataHistoryJob, error)
- func (m *DataHistoryManager) GetAllJobStatusBetween(start, end time.Time) ([]*DataHistoryJob, error)
- func (m *DataHistoryManager) GetByID(id uuid.UUID) (*DataHistoryJob, error)
- func (m *DataHistoryManager) GetByNickname(nickname string, fullDetails bool) (*DataHistoryJob, error)
- func (m *DataHistoryManager) IsRunning() bool
- func (m *DataHistoryManager) PrepareJobs() ([]*DataHistoryJob, error)
- func (m *DataHistoryManager) SetJobRelationship(prerequisiteJobNickname, jobNickname string) error
- func (m *DataHistoryManager) SetJobStatus(nickname, id string, status dataHistoryStatus) error
- func (m *DataHistoryManager) Start() error
- func (m *DataHistoryManager) Stop() error
- func (m *DataHistoryManager) UpsertJob(job *DataHistoryJob, insertOnly bool) error
- type DatabaseConnectionManager
- type DepositAddressManager
- func (m *DepositAddressManager) GetDepositAddressByExchangeAndCurrency(exchName, chain string, currencyItem currency.Code) (deposit.Address, error)
- func (m *DepositAddressManager) GetDepositAddressesByExchange(exchName string) (map[string][]deposit.Address, error)
- func (m *DepositAddressManager) IsSynced() bool
- func (m *DepositAddressManager) Sync(addresses map[string]map[string][]deposit.Address) error
- type EnabledExchangeCurrencies
- type EnabledExchangeOrderbooks
- type Engine
- func (bot *Engine) GetAllActiveTickers(ctx context.Context) []EnabledExchangeCurrencies
- func (bot *Engine) GetAllAvailablePairs(enabledExchangesOnly bool, assetType asset.Item) currency.Pairs
- func (bot *Engine) GetAllExchangeCryptocurrencyDepositAddresses() map[string]map[string][]deposit.Address
- func (bot *Engine) GetAuthAPISupportedExchanges() []string
- func (bot *Engine) GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, ...) ([]string, error)
- func (bot *Engine) GetCryptocurrencyDepositAddressesByExchange(exchName string) (map[string][]deposit.Address, error)
- func (bot *Engine) GetExchangeByName(exchName string) (exchange.IBotExchange, error)
- func (bot *Engine) GetExchangeCryptocurrencyDepositAddress(ctx context.Context, exchName, accountID, chain string, item currency.Code, ...) (*deposit.Address, error)
- func (bot *Engine) GetExchangeNames(enabledOnly bool) []string
- func (bot *Engine) GetExchangeNamesByCurrency(p currency.Pair, enabled bool, assetType asset.Item) []string
- func (bot *Engine) GetExchangeOTPByName(exchName string) (string, error)
- func (bot *Engine) GetExchangeOTPs() (map[string]string, error)
- func (bot *Engine) GetExchanges() []exchange.IBotExchange
- func (bot *Engine) GetRPCEndpoints() (map[string]RPCEndpoint, error)
- func (bot *Engine) GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, ...) currency.Pairs
- func (bot *Engine) GetSpecificOrderbook(ctx context.Context, p currency.Pair, exchangeName string, ...) (*orderbook.Base, error)
- func (bot *Engine) GetSpecificTicker(ctx context.Context, p currency.Pair, exchangeName string, ...) (*ticker.Price, error)
- func (bot *Engine) GetSubsystemsStatus() map[string]bool
- func (bot *Engine) IsOnline() bool
- func (bot *Engine) LoadExchange(name string, wg *sync.WaitGroup) error
- func (bot *Engine) MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetType asset.Item) map[string]currency.Pairs
- func (bot *Engine) SetSubsystem(subSystemName string, enable bool) error
- func (bot *Engine) SetupExchanges() error
- func (bot *Engine) Start() error
- func (bot *Engine) Stop()
- func (bot *Engine) UnloadExchange(exchName string) error
- func (bot *Engine) WaitForInitialCurrencySync() error
- type Event
- type EventConditionParams
- type ExchangeManager
- func (m *ExchangeManager) Add(exch exchange.IBotExchange)
- func (m *ExchangeManager) GetExchangeByName(exchangeName string) (exchange.IBotExchange, error)
- func (m *ExchangeManager) GetExchanges() ([]exchange.IBotExchange, error)
- func (m *ExchangeManager) Len() int
- func (m *ExchangeManager) NewExchangeByName(name string) (exchange.IBotExchange, error)
- func (m *ExchangeManager) RemoveExchange(exchName string) error
- type OrderManager
- func (m *OrderManager) Add(o *order.Detail) error
- func (m *OrderManager) Cancel(ctx context.Context, cancel *order.Cancel) error
- func (m *OrderManager) CancelAllOrders(ctx context.Context, exchangeNames []exchange.IBotExchange)
- func (m *OrderManager) Exists(o *order.Detail) bool
- func (m *OrderManager) FetchAndUpdateExchangeOrder(exch exchange.IBotExchange, ord *order.Detail, assetType asset.Item) error
- func (m *OrderManager) GetByExchangeAndID(exchangeName, id string) (*order.Detail, error)
- func (m *OrderManager) GetOrderInfo(ctx context.Context, exchangeName, orderID string, cp currency.Pair, ...) (order.Detail, error)
- func (m *OrderManager) GetOrdersActive(f *order.Filter) ([]order.Detail, error)
- func (m *OrderManager) GetOrdersFiltered(f *order.Filter) ([]order.Detail, error)
- func (m *OrderManager) GetOrdersSnapshot(s order.Status) []order.Detail
- func (m *OrderManager) IsRunning() bool
- func (m *OrderManager) Modify(ctx context.Context, mod *order.Modify) (*order.ModifyResponse, error)
- func (m *OrderManager) Start() error
- func (m *OrderManager) Stop() error
- func (m *OrderManager) Submit(ctx context.Context, newOrder *order.Submit) (*OrderSubmitResponse, error)
- func (m *OrderManager) SubmitFakeOrder(newOrder *order.Submit, resultingOrder order.SubmitResponse, ...) (*OrderSubmitResponse, error)
- func (m *OrderManager) UpdateExistingOrder(od *order.Detail) error
- func (m *OrderManager) UpsertOrder(od *order.Detail) (resp *OrderUpsertResponse, err error)
- type OrderSubmitResponse
- type OrderUpsertResponse
- type RPCEndpoint
- type RPCServer
- func (s *RPCServer) AddEvent(_ context.Context, r *gctrpc.AddEventRequest) (*gctrpc.AddEventResponse, error)
- func (s *RPCServer) AddPortfolioAddress(_ context.Context, r *gctrpc.AddPortfolioAddressRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) CancelAllOrders(ctx context.Context, r *gctrpc.CancelAllOrdersRequest) (*gctrpc.CancelAllOrdersResponse, error)
- func (s *RPCServer) CancelBatchOrders(ctx context.Context, r *gctrpc.CancelBatchOrdersRequest) (*gctrpc.CancelBatchOrdersResponse, error)
- func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) ConvertTradesToCandles(_ context.Context, r *gctrpc.ConvertTradesToCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
- func (s *RPCServer) CurrencyStateDeposit(_ context.Context, r *gctrpc.CurrencyStateDepositRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) CurrencyStateGetAll(_ context.Context, r *gctrpc.CurrencyStateGetAllRequest) (*gctrpc.CurrencyStateResponse, error)
- func (s *RPCServer) CurrencyStateTrading(_ context.Context, r *gctrpc.CurrencyStateTradingRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) CurrencyStateTradingPair(_ context.Context, r *gctrpc.CurrencyStateTradingPairRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) CurrencyStateWithdraw(_ context.Context, r *gctrpc.CurrencyStateWithdrawRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) DisableExchange(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) DisableSubsystem(_ context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) EnableExchange(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) EnableSubsystem(_ context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) FindMissingSavedCandleIntervals(_ context.Context, r *gctrpc.FindMissingCandlePeriodsRequest) (*gctrpc.FindMissingIntervalsResponse, error)
- func (s *RPCServer) FindMissingSavedTradeIntervals(_ context.Context, r *gctrpc.FindMissingTradePeriodsRequest) (*gctrpc.FindMissingIntervalsResponse, error)
- func (s *RPCServer) GCTScriptAutoLoadToggle(_ context.Context, r *gctrpc.GCTScriptAutoLoadRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) GCTScriptExecute(_ context.Context, r *gctrpc.GCTScriptExecuteRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) GCTScriptListAll(context.Context, *gctrpc.GCTScriptListAllRequest) (*gctrpc.GCTScriptStatusResponse, error)
- func (s *RPCServer) GCTScriptQuery(_ context.Context, r *gctrpc.GCTScriptQueryRequest) (*gctrpc.GCTScriptQueryResponse, error)
- func (s *RPCServer) GCTScriptReadScript(_ context.Context, r *gctrpc.GCTScriptReadScriptRequest) (*gctrpc.GCTScriptQueryResponse, error)
- func (s *RPCServer) GCTScriptStatus(_ context.Context, _ *gctrpc.GCTScriptStatusRequest) (*gctrpc.GCTScriptStatusResponse, error)
- func (s *RPCServer) GCTScriptStop(_ context.Context, r *gctrpc.GCTScriptStopRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) GCTScriptStopAll(context.Context, *gctrpc.GCTScriptStopAllRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) GCTScriptUpload(_ context.Context, r *gctrpc.GCTScriptUploadRequest) (*gctrpc.GenericResponse, 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) GetActiveDataHistoryJobs(_ context.Context, _ *gctrpc.GetInfoRequest) (*gctrpc.DataHistoryJobs, error)
- func (s *RPCServer) GetAuditEvent(_ context.Context, r *gctrpc.GetAuditEventRequest) (*gctrpc.GetAuditEventResponse, error)
- func (s *RPCServer) GetAvailableTransferChains(ctx context.Context, r *gctrpc.GetAvailableTransferChainsRequest) (*gctrpc.GetAvailableTransferChainsResponse, error)
- func (s *RPCServer) GetCommunicationRelayers(_ context.Context, _ *gctrpc.GetCommunicationRelayersRequest) (*gctrpc.GetCommunicationRelayersResponse, error)
- func (s *RPCServer) GetConfig(_ context.Context, _ *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) GetDataHistoryJobDetails(_ context.Context, r *gctrpc.GetDataHistoryJobDetailsRequest) (*gctrpc.DataHistoryJob, error)
- func (s *RPCServer) GetDataHistoryJobSummary(_ context.Context, r *gctrpc.GetDataHistoryJobDetailsRequest) (*gctrpc.DataHistoryJob, error)
- func (s *RPCServer) GetDataHistoryJobsBetween(_ context.Context, r *gctrpc.GetDataHistoryJobsBetweenRequest) (*gctrpc.DataHistoryJobs, error)
- func (s *RPCServer) GetEvents(_ context.Context, _ *gctrpc.GetEventsRequest) (*gctrpc.GetEventsResponse, error)
- func (s *RPCServer) GetExchangeAssets(_ context.Context, r *gctrpc.GetExchangeAssetsRequest) (*gctrpc.GetExchangeAssetsResponse, error)
- func (s *RPCServer) GetExchangeInfo(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeInfoResponse, error)
- func (s *RPCServer) GetExchangeOTPCode(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeOTPResponse, error)
- func (s *RPCServer) GetExchangeOTPCodes(_ context.Context, _ *gctrpc.GetExchangeOTPsRequest) (*gctrpc.GetExchangeOTPsResponse, error)
- func (s *RPCServer) GetExchangeOrderbookStream(r *gctrpc.GetExchangeOrderbookStreamRequest, ...) error
- func (s *RPCServer) GetExchangePairs(_ context.Context, r *gctrpc.GetExchangePairsRequest) (*gctrpc.GetExchangePairsResponse, error)
- func (s *RPCServer) GetExchangeTickerStream(r *gctrpc.GetExchangeTickerStreamRequest, ...) error
- func (s *RPCServer) GetExchanges(_ context.Context, r *gctrpc.GetExchangesRequest) (*gctrpc.GetExchangesResponse, error)
- func (s *RPCServer) GetForexProviders(_ context.Context, _ *gctrpc.GetForexProvidersRequest) (*gctrpc.GetForexProvidersResponse, error)
- func (s *RPCServer) GetForexRates(_ context.Context, _ *gctrpc.GetForexRatesRequest) (*gctrpc.GetForexRatesResponse, error)
- func (s *RPCServer) GetHistoricCandles(ctx context.Context, r *gctrpc.GetHistoricCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
- func (s *RPCServer) GetHistoricTrades(r *gctrpc.GetSavedTradesRequest, ...) error
- func (s *RPCServer) GetInfo(_ context.Context, _ *gctrpc.GetInfoRequest) (*gctrpc.GetInfoResponse, error)
- func (s *RPCServer) GetLoggerDetails(_ context.Context, r *gctrpc.GetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
- func (s *RPCServer) GetManagedOrders(_ context.Context, r *gctrpc.GetOrdersRequest) (*gctrpc.GetOrdersResponse, 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, _ *gctrpc.GetOrderbooksRequest) (*gctrpc.GetOrderbooksResponse, error)
- func (s *RPCServer) GetOrders(ctx context.Context, r *gctrpc.GetOrdersRequest) (*gctrpc.GetOrdersResponse, error)
- func (s *RPCServer) GetPortfolio(_ context.Context, _ *gctrpc.GetPortfolioRequest) (*gctrpc.GetPortfolioResponse, error)
- func (s *RPCServer) GetPortfolioSummary(_ context.Context, _ *gctrpc.GetPortfolioSummaryRequest) (*gctrpc.GetPortfolioSummaryResponse, error)
- func (s *RPCServer) GetRPCEndpoints(_ context.Context, _ *gctrpc.GetRPCEndpointsRequest) (*gctrpc.GetRPCEndpointsResponse, error)
- func (s *RPCServer) GetRecentTrades(ctx context.Context, r *gctrpc.GetSavedTradesRequest) (*gctrpc.SavedTradesResponse, error)
- func (s *RPCServer) GetSavedTrades(_ context.Context, r *gctrpc.GetSavedTradesRequest) (*gctrpc.SavedTradesResponse, error)
- func (s *RPCServer) GetSubsystems(_ context.Context, _ *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, _ *gctrpc.GetTickersRequest) (*gctrpc.GetTickersResponse, error)
- func (s *RPCServer) ModifyOrder(ctx context.Context, r *gctrpc.ModifyOrderRequest) (*gctrpc.ModifyOrderResponse, error)
- func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) RemovePortfolioAddress(_ context.Context, r *gctrpc.RemovePortfolioAddressRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetAllExchangePairs(_ context.Context, r *gctrpc.SetExchangeAllPairsRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetDataHistoryJobStatus(_ context.Context, r *gctrpc.SetDataHistoryJobStatusRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetExchangeAsset(_ context.Context, r *gctrpc.SetExchangeAssetRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetExchangePair(_ context.Context, r *gctrpc.SetExchangePairRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetExchangeTradeProcessing(_ context.Context, r *gctrpc.SetExchangeTradeProcessingRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) SetLoggerDetails(_ context.Context, r *gctrpc.SetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
- func (s *RPCServer) SimulateOrder(ctx context.Context, r *gctrpc.SimulateOrderRequest) (*gctrpc.SimulateOrderResponse, error)
- func (s *RPCServer) StartRPCRESTProxy()
- func (s *RPCServer) SubmitOrder(ctx context.Context, r *gctrpc.SubmitOrderRequest) (*gctrpc.SubmitOrderResponse, error)
- func (s *RPCServer) UpdateAccountInfo(ctx context.Context, r *gctrpc.GetAccountInfoRequest) (*gctrpc.GetAccountInfoResponse, error)
- func (s *RPCServer) UpdateDataHistoryJobPrerequisite(_ context.Context, r *gctrpc.UpdateDataHistoryJobPrerequisiteRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) UpdateExchangeSupportedPairs(ctx context.Context, r *gctrpc.UpdateExchangeSupportedPairsRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) UpsertDataHistoryJob(_ context.Context, r *gctrpc.UpsertDataHistoryJobRequest) (*gctrpc.UpsertDataHistoryJobResponse, error)
- func (s *RPCServer) WebsocketGetInfo(_ context.Context, r *gctrpc.WebsocketGetInfoRequest) (*gctrpc.WebsocketGetInfoResponse, error)
- func (s *RPCServer) WebsocketGetSubscriptions(_ context.Context, r *gctrpc.WebsocketGetSubscriptionsRequest) (*gctrpc.WebsocketGetSubscriptionsResponse, error)
- func (s *RPCServer) WebsocketSetEnabled(_ context.Context, r *gctrpc.WebsocketSetEnabledRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) WebsocketSetProxy(_ context.Context, r *gctrpc.WebsocketSetProxyRequest) (*gctrpc.GenericResponse, error)
- func (s *RPCServer) WebsocketSetURL(_ context.Context, r *gctrpc.WebsocketSetURLRequest) (*gctrpc.GenericResponse, 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(_ context.Context, r *gctrpc.WithdrawalEventByIDRequest) (*gctrpc.WithdrawalEventByIDResponse, error)
- func (s *RPCServer) WithdrawalEventsByDate(_ 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 WebsocketAuth
- type WebsocketEvent
- type WebsocketEventResponse
- type WebsocketOrderbookTickerRequest
- type WithdrawManager
- func (m *WithdrawManager) SubmitWithdrawal(ctx context.Context, req *withdraw.Request) (*withdraw.Response, error)
- func (m *WithdrawManager) WithdrawEventByDate(exchange string, start, end time.Time, limit int) ([]*withdraw.Response, error)
- func (m *WithdrawManager) WithdrawalEventByExchange(exchange string, limit int) ([]*withdraw.Response, error)
- func (m *WithdrawManager) WithdrawalEventByExchangeID(exchange, id string) (*withdraw.Response, error)
- func (m *WithdrawManager) WithdrawalEventByID(id string) (*withdraw.Response, error)
Constants ¶
const ( WebsocketResponseSuccess = "OK" DeprecatedName = "deprecated_rpc" WebsocketName = "websocket_rpc" )
Const vars for websocket
const ( // CurrencyStateManagementName defines the manager name string CurrencyStateManagementName = "currency_state_manager" // DefaultStateManagerDelay defines the default duration when the manager // fetches and updates each exchange for its currency state DefaultStateManagerDelay = time.Minute )
const ( // 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 ( // MsgSubSystemStarting message to return when subsystem is starting up MsgSubSystemStarting = "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 = "shutdown." )
const ( SyncItemTicker = iota SyncItemOrderbook SyncItemTrade SyncManagerName = "exchange_syncer" )
const holds the sync item types
const CommunicationsManagerName = "communications"
CommunicationsManagerName is an exported subsystem name
const ConnectionManagerName = "internet_monitor"
ConnectionManagerName is an exported subsystem name
const DatabaseConnectionManagerName = "database"
DatabaseConnectionManagerName is an exported subsystem name
const (
// NTPManagerName is an exported subsystem name
NTPManagerName = "ntp_timekeeper"
)
const OrderManagerName = "orders"
OrderManagerName is an exported subsystem name
const PortfolioManagerName = "portfolio"
PortfolioManagerName is an exported subsystem name
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 ( // ErrOrdersAlreadyExists occurs when the order already exists in the manager ErrOrdersAlreadyExists = errors.New("order already exists") // ErrOrderNotFound occurs when an order is not found in the orderstore ErrOrderNotFound = errors.New("order does not exist") // ErrOrderIDCannotBeEmpty occurs when an order does not have an ID ErrOrderIDCannotBeEmpty = errors.New("orderID cannot be empty") )
vars for the fund manager package
var ( // ErrSubSystemAlreadyStarted message to return when a subsystem is already started ErrSubSystemAlreadyStarted = errors.New("subsystem already started") // ErrSubSystemNotStarted message to return when subsystem not started ErrSubSystemNotStarted = errors.New("subsystem not started") // ErrNilSubsystem is returned when a subsystem hasn't had its Setup() func run ErrNilSubsystem = errors.New("subsystem not setup") )
var ( // DefaultSyncerWorkers limits the number of sync workers DefaultSyncerWorkers = 15 // DefaultSyncerTimeoutREST the default time to switch from REST to websocket protocols without a response DefaultSyncerTimeoutREST = time.Second * 15 // DefaultSyncerTimeoutWebsocket the default time to switch from websocket to REST protocols without a response DefaultSyncerTimeoutWebsocket = time.Minute )
var ( // ErrWebsocketServiceNotRunning occurs when a message is sent to be broadcast via websocket // and its not running ErrWebsocketServiceNotRunning = errors.New("websocket service not started") )
var ( // ErrWithdrawRequestNotFound message to display when no record is found ErrWithdrawRequestNotFound = errors.New("request not found") )
var (
EventSleepDelay = defaultSleepDelay
)
vars related to events package
var ( // PortfolioSleepDelay defines the default sleep time between portfolio manager runs PortfolioSleepDelay = time.Minute )
Functions ¶
func BroadcastWebsocketMessage ¶
func BroadcastWebsocketMessage(evt WebsocketEvent) error
BroadcastWebsocketMessage meow
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 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 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 IsRelatablePairs ¶
IsRelatablePairs checks to see if the two pairs are relatable
func StartRPCServer ¶
func StartRPCServer(engine *Engine)
StartRPCServer starts a gRPC server with TLS auth
func StartWebsocketHandler ¶
func StartWebsocketHandler()
StartWebsocketHandler starts the websocket hub and routine which handles clients
Types ¶
type AllEnabledExchangeAccounts ¶
AllEnabledExchangeAccounts holds all enabled accounts info
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 CommunicationManager ¶
type CommunicationManager struct {
// contains filtered or unexported fields
}
CommunicationManager ensures operations of communications
func SetupCommunicationManager ¶
func SetupCommunicationManager(cfg *base.CommunicationsConfig) (*CommunicationManager, error)
SetupCommunicationManager creates a communications manager
func (*CommunicationManager) GetStatus ¶
func (m *CommunicationManager) GetStatus() (map[string]base.CommsStatus, error)
GetStatus returns the status of communications
func (*CommunicationManager) IsRunning ¶
func (m *CommunicationManager) IsRunning() bool
IsRunning safely checks whether the subsystem is running
func (*CommunicationManager) PushEvent ¶
func (m *CommunicationManager) PushEvent(evt base.Event)
PushEvent pushes an event to the communications relay
func (*CommunicationManager) Start ¶
func (m *CommunicationManager) Start() error
Start runs the subsystem
func (*CommunicationManager) Stop ¶
func (m *CommunicationManager) Stop() error
Stop attempts to shutdown the subsystem
type Config ¶
type Config struct { SyncTicker bool SyncOrderbook bool SyncTrades bool SyncContinuously bool SyncTimeoutREST time.Duration SyncTimeoutWebsocket time.Duration NumWorkers int Verbose bool }
Config stores the currency pair config
type CurrencyStateManager ¶
type CurrencyStateManager struct {
// contains filtered or unexported fields
}
CurrencyStateManager manages currency states
func SetupCurrencyStateManager ¶
func SetupCurrencyStateManager(interval time.Duration, em iExchangeManager) (*CurrencyStateManager, error)
SetupCurrencyStateManager applies configuration parameters before running
func (*CurrencyStateManager) CanDepositRPC ¶
func (c *CurrencyStateManager) CanDepositRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
CanDepositRPC determines if the currency code is operational for depositing to an exchange for RPC
func (*CurrencyStateManager) CanTradePairRPC ¶
func (c *CurrencyStateManager) CanTradePairRPC(exchName string, pair currency.Pair, a asset.Item) (*gctrpc.GenericResponse, error)
CanTradePairRPC determines if the pair is operational for trading for RPC
func (*CurrencyStateManager) CanTradeRPC ¶
func (c *CurrencyStateManager) CanTradeRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
CanTradeRPC determines if the currency code is operational for trading for RPC
func (*CurrencyStateManager) CanWithdrawRPC ¶
func (c *CurrencyStateManager) CanWithdrawRPC(exchName string, cc currency.Code, a asset.Item) (*gctrpc.GenericResponse, error)
CanWithdrawRPC determines if the currency code is operational for withdrawal from an exchange for RPC
func (*CurrencyStateManager) GetAllRPC ¶
func (c *CurrencyStateManager) GetAllRPC(exchName string) (*gctrpc.CurrencyStateResponse, error)
GetAllRPC returns a full snapshot of currency states, whether they are able to be withdrawn, deposited or traded on an exchange for RPC.
func (*CurrencyStateManager) IsRunning ¶
func (c *CurrencyStateManager) IsRunning() bool
IsRunning safely checks whether the subsystem is running
func (*CurrencyStateManager) Start ¶
func (c *CurrencyStateManager) Start() error
Start runs the subsystem
func (*CurrencyStateManager) Stop ¶
func (c *CurrencyStateManager) Stop() error
Stop stops the subsystem
type CustomExchangeBuilder ¶
type CustomExchangeBuilder interface {
NewExchangeByName(name string) (exchange.IBotExchange, error)
}
CustomExchangeBuilder interface allows external applications to create custom/unsupported exchanges that satisfy the IBotExchange interface.
type DataHistoryJob ¶
type DataHistoryJob struct { ID uuid.UUID Nickname string Exchange string Asset asset.Item Pair currency.Pair StartDate time.Time EndDate time.Time Interval kline.Interval RunBatchLimit int64 RequestSizeLimit int64 DataType dataHistoryDataType MaxRetryAttempts int64 Status dataHistoryStatus CreatedDate time.Time Results map[time.Time][]DataHistoryJobResult OverwriteExistingData bool ConversionInterval kline.Interval DecimalPlaceComparison int64 SecondaryExchangeSource string IssueTolerancePercentage float64 ReplaceOnIssue bool // Prerequisites mean this job is paused until the prerequisite job is completed PrerequisiteJobID uuid.UUID PrerequisiteJobNickname string // contains filtered or unexported fields }
DataHistoryJob used to gather candle/trade history and save to the database
type DataHistoryJobResult ¶
type DataHistoryJobResult struct { ID uuid.UUID JobID uuid.UUID IntervalStartDate time.Time IntervalEndDate time.Time Status dataHistoryStatus Result string Date time.Time }
DataHistoryJobResult contains details on the result of a history request
type DataHistoryJobSummary ¶
type DataHistoryJobSummary struct { Nickname string Exchange string Asset asset.Item Pair currency.Pair StartDate time.Time EndDate time.Time Interval kline.Interval Status dataHistoryStatus DataType dataHistoryDataType ResultRanges []string OverwriteExistingData bool ConversionInterval kline.Interval PrerequisiteJobNickname string }
DataHistoryJobSummary is a human readable summary of the job for quickly understanding the status of a given job
type DataHistoryManager ¶
type DataHistoryManager struct {
// contains filtered or unexported fields
}
DataHistoryManager is responsible for synchronising, retrieving and saving candle and trade data from loaded jobs
func SetupDataHistoryManager ¶
func SetupDataHistoryManager(em iExchangeManager, dcm iDatabaseConnectionManager, cfg *config.DataHistoryManager) (*DataHistoryManager, error)
SetupDataHistoryManager creates a data history manager subsystem
func (*DataHistoryManager) CheckCandleIssue ¶
func (m *DataHistoryManager) CheckCandleIssue(job *DataHistoryJob, multiplier int64, apiData, dbData float64, candleField string) (issue string, replace bool)
CheckCandleIssue verifies that stored data matches API data a job can specify a level of rounding along with a tolerance percentage a job can also replace data with API data if the database data exceeds the tolerance
func (*DataHistoryManager) GenerateJobSummary ¶
func (m *DataHistoryManager) GenerateJobSummary(nickname string) (*DataHistoryJobSummary, error)
GenerateJobSummary returns a human readable summary of a job's status
func (*DataHistoryManager) GetActiveJobs ¶
func (m *DataHistoryManager) GetActiveJobs() ([]DataHistoryJob, error)
GetActiveJobs returns all jobs with the status `dataHistoryStatusActive`
func (*DataHistoryManager) GetAllJobStatusBetween ¶
func (m *DataHistoryManager) GetAllJobStatusBetween(start, end time.Time) ([]*DataHistoryJob, error)
GetAllJobStatusBetween will return all jobs between two ferns
func (*DataHistoryManager) GetByID ¶
func (m *DataHistoryManager) GetByID(id uuid.UUID) (*DataHistoryJob, error)
GetByID returns a job's details from its ID
func (*DataHistoryManager) GetByNickname ¶
func (m *DataHistoryManager) GetByNickname(nickname string, fullDetails bool) (*DataHistoryJob, error)
GetByNickname searches for jobs by name and returns it if found returns nil if not if fullDetails is enabled, it will retrieve all job history results from the database
func (*DataHistoryManager) IsRunning ¶
func (m *DataHistoryManager) IsRunning() bool
IsRunning checks whether the subsystem is running
func (*DataHistoryManager) PrepareJobs ¶
func (m *DataHistoryManager) PrepareJobs() ([]*DataHistoryJob, error)
PrepareJobs will validate the config jobs, verify their status with the database and return all valid jobs to be processed m.jobs will be overridden by this function
func (*DataHistoryManager) SetJobRelationship ¶
func (m *DataHistoryManager) SetJobRelationship(prerequisiteJobNickname, jobNickname string) error
SetJobRelationship will add/modify/delete a relationship with an existing job it will add the relationship and set the jobNickname job to paused if deleting, it will remove the relationship from the database and set the job to active
func (*DataHistoryManager) SetJobStatus ¶
func (m *DataHistoryManager) SetJobStatus(nickname, id string, status dataHistoryStatus) error
SetJobStatus helper function to assist in setting a job to deleted
func (*DataHistoryManager) Start ¶
func (m *DataHistoryManager) Start() error
Start runs the subsystem
func (*DataHistoryManager) Stop ¶
func (m *DataHistoryManager) Stop() error
Stop stops the subsystem
func (*DataHistoryManager) UpsertJob ¶
func (m *DataHistoryManager) UpsertJob(job *DataHistoryJob, insertOnly bool) error
UpsertJob allows for GRPC interaction to upsert a job to be processed
type DatabaseConnectionManager ¶
type DatabaseConnectionManager struct {
// contains filtered or unexported fields
}
DatabaseConnectionManager holds the database connection and its status
func SetupDatabaseConnectionManager ¶
func SetupDatabaseConnectionManager(cfg *database.Config) (*DatabaseConnectionManager, error)
SetupDatabaseConnectionManager creates a new database manager
func (*DatabaseConnectionManager) GetInstance ¶
func (m *DatabaseConnectionManager) GetInstance() database.IDatabase
GetInstance returns a limited scoped database instance
func (*DatabaseConnectionManager) IsConnected ¶
func (m *DatabaseConnectionManager) IsConnected() bool
IsConnected is an exported check to verify if the database is connected
func (*DatabaseConnectionManager) IsRunning ¶
func (m *DatabaseConnectionManager) IsRunning() bool
IsRunning safely checks whether the subsystem is running
func (*DatabaseConnectionManager) Start ¶
func (m *DatabaseConnectionManager) Start(wg *sync.WaitGroup) (err error)
Start sets up the database connection manager to maintain a SQL connection
func (*DatabaseConnectionManager) Stop ¶
func (m *DatabaseConnectionManager) Stop() error
Stop stops the database manager and closes the connection Stop attempts to shutdown the subsystem
type DepositAddressManager ¶
type DepositAddressManager struct {
// contains filtered or unexported fields
}
DepositAddressManager manages the exchange deposit address store
func SetupDepositAddressManager ¶
func SetupDepositAddressManager() *DepositAddressManager
SetupDepositAddressManager returns a DepositAddressManager
func (*DepositAddressManager) GetDepositAddressByExchangeAndCurrency ¶
func (m *DepositAddressManager) GetDepositAddressByExchangeAndCurrency(exchName, chain string, currencyItem currency.Code) (deposit.Address, error)
GetDepositAddressByExchangeAndCurrency returns a deposit address for the specified exchange and cryptocurrency if it exists
func (*DepositAddressManager) GetDepositAddressesByExchange ¶
func (m *DepositAddressManager) GetDepositAddressesByExchange(exchName string) (map[string][]deposit.Address, error)
GetDepositAddressesByExchange returns a list of cryptocurrency addresses for the specified exchange if they exist
func (*DepositAddressManager) IsSynced ¶
func (m *DepositAddressManager) IsSynced() bool
IsSynced returns whether or not the deposit address store has synced its data
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
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
type Engine ¶
type Engine struct { Config *config.Config CommunicationsManager *CommunicationManager DatabaseManager *DatabaseConnectionManager DepositAddressManager *DepositAddressManager ExchangeManager *ExchangeManager OrderManager *OrderManager WithdrawManager *WithdrawManager Settings Settings ServicesWG sync.WaitGroup // contains filtered or unexported fields }
Engine contains configuration, portfolio manager, exchange & ticker data and is the overarching type across this code base.
var Bot *Engine
Bot is a happy global engine to allow various areas of the application to access its setup services and functions
func NewFromSettings ¶
NewFromSettings starts a new engine based on supplied settings
func (*Engine) GetAllActiveTickers ¶
func (bot *Engine) GetAllActiveTickers(ctx context.Context) []EnabledExchangeCurrencies
GetAllActiveTickers returns all enabled exchange tickers
func (*Engine) GetAllAvailablePairs ¶
func (bot *Engine) GetAllAvailablePairs(enabledExchangesOnly bool, assetType asset.Item) currency.Pairs
GetAllAvailablePairs returns a list of all available pairs on either enabled or disabled exchanges
func (*Engine) GetAllExchangeCryptocurrencyDepositAddresses ¶
func (bot *Engine) GetAllExchangeCryptocurrencyDepositAddresses() map[string]map[string][]deposit.Address
GetAllExchangeCryptocurrencyDepositAddresses obtains an exchanges deposit cryptocurrency list
func (*Engine) GetAuthAPISupportedExchanges ¶
GetAuthAPISupportedExchanges returns a list of auth api enabled exchanges
func (*Engine) GetCryptocurrenciesByExchange ¶
func (bot *Engine) GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, assetType asset.Item) ([]string, error)
GetCryptocurrenciesByExchange returns a list of cryptocurrencies the exchange supports
func (*Engine) GetCryptocurrencyDepositAddressesByExchange ¶
func (bot *Engine) GetCryptocurrencyDepositAddressesByExchange(exchName string) (map[string][]deposit.Address, error)
GetCryptocurrencyDepositAddressesByExchange returns the cryptocurrency deposit addresses for a particular exchange
func (*Engine) GetExchangeByName ¶
func (bot *Engine) GetExchangeByName(exchName string) (exchange.IBotExchange, error)
GetExchangeByName returns an exchange given an exchange name
func (*Engine) GetExchangeCryptocurrencyDepositAddress ¶
func (bot *Engine) GetExchangeCryptocurrencyDepositAddress(ctx context.Context, exchName, accountID, chain string, item currency.Code, bypassCache bool) (*deposit.Address, error)
GetExchangeCryptocurrencyDepositAddress returns the cryptocurrency deposit address for a particular exchange
func (*Engine) GetExchangeNames ¶
GetExchangeNames returns a list of enabled or disabled exchanges
func (*Engine) GetExchangeNamesByCurrency ¶
func (bot *Engine) 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 (*Engine) GetExchangeOTPByName ¶
GetExchangeOTPByName returns a OTP code for the desired exchange if it exists
func (*Engine) GetExchangeOTPs ¶
GetExchangeOTPs returns OTP codes for all exchanges which have a otpsecret stored
func (*Engine) GetExchanges ¶
func (bot *Engine) GetExchanges() []exchange.IBotExchange
GetExchanges retrieves the loaded exchanges
func (*Engine) GetRPCEndpoints ¶
func (bot *Engine) GetRPCEndpoints() (map[string]RPCEndpoint, error)
GetRPCEndpoints returns a list of RPC endpoints and their listen addrs
func (*Engine) GetSpecificAvailablePairs ¶
func (bot *Engine) GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, assetType asset.Item) currency.Pairs
GetSpecificAvailablePairs returns a list of supported pairs based on specific parameters
func (*Engine) GetSpecificOrderbook ¶
func (bot *Engine) GetSpecificOrderbook(ctx context.Context, p currency.Pair, exchangeName string, assetType asset.Item) (*orderbook.Base, error)
GetSpecificOrderbook returns a specific orderbook given the currency, exchangeName and assetType
func (*Engine) GetSpecificTicker ¶
func (bot *Engine) GetSpecificTicker(ctx context.Context, p currency.Pair, exchangeName string, assetType asset.Item) (*ticker.Price, error)
GetSpecificTicker returns a specific ticker given the currency, exchangeName and assetType
func (*Engine) GetSubsystemsStatus ¶
GetSubsystemsStatus returns the status of various subsystems
func (*Engine) LoadExchange ¶
LoadExchange loads an exchange by name. Optional wait group can be added for external synchronization.
func (*Engine) MapCurrenciesByExchange ¶
func (bot *Engine) 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 (*Engine) SetSubsystem ¶
SetSubsystem enables or disables an engine subsystem
func (*Engine) SetupExchanges ¶
SetupExchanges sets up the exchanges used by the Bot
func (*Engine) Stop ¶
func (bot *Engine) Stop()
Stop correctly shuts down engine saving configuration files
func (*Engine) UnloadExchange ¶
UnloadExchange unloads an exchange by name
func (*Engine) WaitForInitialCurrencySync ¶
WaitForInitialCurrencySync allows for a routine to wait for the initial sync of the currency pair syncer management system.
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
type EventConditionParams ¶
type EventConditionParams struct { Condition string Price float64 CheckBids bool CheckAsks bool OrderbookAmount float64 }
EventConditionParams holds the event condition variables
type ExchangeManager ¶
type ExchangeManager struct { Builder CustomExchangeBuilder // contains filtered or unexported fields }
ExchangeManager manages what exchanges are loaded
func SetupExchangeManager ¶
func SetupExchangeManager() *ExchangeManager
SetupExchangeManager creates a new exchange manager
func (*ExchangeManager) Add ¶
func (m *ExchangeManager) Add(exch exchange.IBotExchange)
Add adds or replaces an exchange
func (*ExchangeManager) GetExchangeByName ¶
func (m *ExchangeManager) GetExchangeByName(exchangeName string) (exchange.IBotExchange, error)
GetExchangeByName returns an exchange by its name if it exists
func (*ExchangeManager) GetExchanges ¶
func (m *ExchangeManager) GetExchanges() ([]exchange.IBotExchange, error)
GetExchanges returns all stored exchanges
func (*ExchangeManager) Len ¶
func (m *ExchangeManager) Len() int
Len says how many exchanges are loaded
func (*ExchangeManager) NewExchangeByName ¶
func (m *ExchangeManager) NewExchangeByName(name string) (exchange.IBotExchange, error)
NewExchangeByName helps create a new exchange to be loaded
func (*ExchangeManager) RemoveExchange ¶
func (m *ExchangeManager) RemoveExchange(exchName string) error
RemoveExchange removes an exchange from the manager
type OrderManager ¶
type OrderManager struct {
// contains filtered or unexported fields
}
OrderManager processes and stores orders across enabled exchanges
func SetupOrderManager ¶
func SetupOrderManager(exchangeManager iExchangeManager, communicationsManager iCommsManager, wg *sync.WaitGroup, verbose bool) (*OrderManager, error)
SetupOrderManager will boot up the OrderManager
func (*OrderManager) Add ¶
func (m *OrderManager) Add(o *order.Detail) error
Add adds an order to the orderstore
func (*OrderManager) Cancel ¶
Cancel will find the order in the OrderManager, send a cancel request to the exchange and if successful, update the status of the order
func (*OrderManager) CancelAllOrders ¶
func (m *OrderManager) CancelAllOrders(ctx context.Context, exchangeNames []exchange.IBotExchange)
CancelAllOrders iterates and cancels all orders for each exchange provided
func (*OrderManager) Exists ¶
func (m *OrderManager) Exists(o *order.Detail) bool
Exists checks whether an order exists in the order store
func (*OrderManager) FetchAndUpdateExchangeOrder ¶
func (m *OrderManager) FetchAndUpdateExchangeOrder(exch exchange.IBotExchange, ord *order.Detail, assetType asset.Item) error
FetchAndUpdateExchangeOrder calls the exchange to upsert an order to the order store
func (*OrderManager) GetByExchangeAndID ¶
func (m *OrderManager) GetByExchangeAndID(exchangeName, id string) (*order.Detail, error)
GetByExchangeAndID returns a copy of an order from an exchange if it matches the ID
func (*OrderManager) GetOrderInfo ¶
func (m *OrderManager) GetOrderInfo(ctx context.Context, exchangeName, orderID string, cp currency.Pair, a asset.Item) (order.Detail, error)
GetOrderInfo calls the exchange's wrapper GetOrderInfo function and stores the result in the order manager
func (*OrderManager) GetOrdersActive ¶
GetOrdersActive returns a snapshot of all orders in the order store that have a status that indicates it's currently tradable
func (*OrderManager) GetOrdersFiltered ¶
GetOrdersFiltered returns a snapshot of all orders in the order store. Filtering is applied based on the order.Filter unless entries are empty
func (*OrderManager) GetOrdersSnapshot ¶
func (m *OrderManager) GetOrdersSnapshot(s order.Status) []order.Detail
GetOrdersSnapshot returns a snapshot of all orders in the orderstore. It optionally filters any orders that do not match the status but a status of "" or ANY will include all the time adds contexts for when the snapshot is relevant for
func (*OrderManager) IsRunning ¶
func (m *OrderManager) IsRunning() bool
IsRunning safely checks whether the subsystem is running
func (*OrderManager) Modify ¶
func (m *OrderManager) Modify(ctx context.Context, mod *order.Modify) (*order.ModifyResponse, error)
Modify depends on the order.Modify.ID and order.Modify.Exchange fields to uniquely identify an order to modify.
func (*OrderManager) Stop ¶
func (m *OrderManager) Stop() error
Stop attempts to shutdown the subsystem
func (*OrderManager) Submit ¶
func (m *OrderManager) Submit(ctx context.Context, newOrder *order.Submit) (*OrderSubmitResponse, error)
Submit will take in an order struct, send it to the exchange and populate it in the OrderManager if successful
func (*OrderManager) SubmitFakeOrder ¶
func (m *OrderManager) SubmitFakeOrder(newOrder *order.Submit, resultingOrder order.SubmitResponse, checkExchangeLimits bool) (*OrderSubmitResponse, error)
SubmitFakeOrder runs through the same process as order submission but does not touch live endpoints
func (*OrderManager) UpdateExistingOrder ¶
func (m *OrderManager) UpdateExistingOrder(od *order.Detail) error
UpdateExistingOrder will update an existing order in the orderstore
func (*OrderManager) UpsertOrder ¶
func (m *OrderManager) UpsertOrder(od *order.Detail) (resp *OrderUpsertResponse, err error)
UpsertOrder updates an existing order or adds a new one to the orderstore
type OrderSubmitResponse ¶
type OrderSubmitResponse struct { order.SubmitResponse InternalOrderID string }
OrderSubmitResponse contains the order response along with an internal order ID
type OrderUpsertResponse ¶
OrderUpsertResponse contains a copy of the resulting order details and a bool indicating if the order details were inserted (true) or updated (false)
type RPCEndpoint ¶
RPCEndpoint stores an RPC endpoint status and addr
type RPCServer ¶
type RPCServer struct { gctrpc.UnimplementedGoCryptoTraderServer *Engine }
RPCServer struct
func (*RPCServer) AddEvent ¶
func (s *RPCServer) AddEvent(_ context.Context, r *gctrpc.AddEventRequest) (*gctrpc.AddEventResponse, error)
AddEvent adds an event
func (*RPCServer) AddPortfolioAddress ¶
func (s *RPCServer) AddPortfolioAddress(_ context.Context, r *gctrpc.AddPortfolioAddressRequest) (*gctrpc.GenericResponse, error)
AddPortfolioAddress adds an address to the portfoliomanager 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) CancelBatchOrders ¶
func (s *RPCServer) CancelBatchOrders(ctx context.Context, r *gctrpc.CancelBatchOrdersRequest) (*gctrpc.CancelBatchOrdersResponse, error)
CancelBatchOrders cancels an orders specified by exchange, currency pair and asset type
func (*RPCServer) CancelOrder ¶
func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderRequest) (*gctrpc.GenericResponse, error)
CancelOrder cancels an order specified by exchange, currency pair and asset type
func (*RPCServer) ConvertTradesToCandles ¶
func (s *RPCServer) ConvertTradesToCandles(_ context.Context, r *gctrpc.ConvertTradesToCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
ConvertTradesToCandles converts trades to candles using the interval requested returns the data too for extra fun scrutiny
func (*RPCServer) CurrencyStateDeposit ¶
func (s *RPCServer) CurrencyStateDeposit(_ context.Context, r *gctrpc.CurrencyStateDepositRequest) (*gctrpc.GenericResponse, error)
CurrencyStateDeposit determines via RPC if the currency code is operational for depositing to an exchange
func (*RPCServer) CurrencyStateGetAll ¶
func (s *RPCServer) CurrencyStateGetAll(_ context.Context, r *gctrpc.CurrencyStateGetAllRequest) (*gctrpc.CurrencyStateResponse, error)
CurrencyStateGetAll returns a full snapshot of currency states, whether they are able to be withdrawn, deposited or traded on an exchange.
func (*RPCServer) CurrencyStateTrading ¶
func (s *RPCServer) CurrencyStateTrading(_ context.Context, r *gctrpc.CurrencyStateTradingRequest) (*gctrpc.GenericResponse, error)
CurrencyStateTrading determines via RPC if the currency code is operational for trading
func (*RPCServer) CurrencyStateTradingPair ¶
func (s *RPCServer) CurrencyStateTradingPair(_ context.Context, r *gctrpc.CurrencyStateTradingPairRequest) (*gctrpc.GenericResponse, error)
CurrencyStateTradingPair determines via RPC if the pair is operational for trading
func (*RPCServer) CurrencyStateWithdraw ¶
func (s *RPCServer) CurrencyStateWithdraw(_ context.Context, r *gctrpc.CurrencyStateWithdrawRequest) (*gctrpc.GenericResponse, error)
CurrencyStateWithdraw determines via RPC if the currency code is operational for withdrawal from an exchange
func (*RPCServer) DisableExchange ¶
func (s *RPCServer) DisableExchange(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericResponse, error)
DisableExchange disables an exchange
func (*RPCServer) DisableSubsystem ¶
func (s *RPCServer) DisableSubsystem(_ context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericResponse, error)
DisableSubsystem disables a engine subsytem
func (*RPCServer) EnableExchange ¶
func (s *RPCServer) EnableExchange(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GenericResponse, error)
EnableExchange enables an exchange
func (*RPCServer) EnableSubsystem ¶
func (s *RPCServer) EnableSubsystem(_ context.Context, r *gctrpc.GenericSubsystemRequest) (*gctrpc.GenericResponse, error)
EnableSubsystem enables a engine subsytem
func (*RPCServer) FindMissingSavedCandleIntervals ¶
func (s *RPCServer) FindMissingSavedCandleIntervals(_ context.Context, r *gctrpc.FindMissingCandlePeriodsRequest) (*gctrpc.FindMissingIntervalsResponse, error)
FindMissingSavedCandleIntervals is used to help determine what candle data is missing
func (*RPCServer) FindMissingSavedTradeIntervals ¶
func (s *RPCServer) FindMissingSavedTradeIntervals(_ context.Context, r *gctrpc.FindMissingTradePeriodsRequest) (*gctrpc.FindMissingIntervalsResponse, error)
FindMissingSavedTradeIntervals is used to help determine what trade data is missing
func (*RPCServer) GCTScriptAutoLoadToggle ¶
func (s *RPCServer) GCTScriptAutoLoadToggle(_ context.Context, r *gctrpc.GCTScriptAutoLoadRequest) (*gctrpc.GenericResponse, error)
GCTScriptAutoLoadToggle adds or removes an entry to the autoload list
func (*RPCServer) GCTScriptExecute ¶
func (s *RPCServer) GCTScriptExecute(_ context.Context, r *gctrpc.GCTScriptExecuteRequest) (*gctrpc.GenericResponse, 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(_ 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(_ context.Context, r *gctrpc.GCTScriptReadScriptRequest) (*gctrpc.GCTScriptQueryResponse, error)
GCTScriptReadScript read a script and return contents
func (*RPCServer) GCTScriptStatus ¶
func (s *RPCServer) GCTScriptStatus(_ context.Context, _ *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(_ context.Context, r *gctrpc.GCTScriptStopRequest) (*gctrpc.GenericResponse, error)
GCTScriptStop terminate a running script
func (*RPCServer) GCTScriptStopAll ¶
func (s *RPCServer) GCTScriptStopAll(context.Context, *gctrpc.GCTScriptStopAllRequest) (*gctrpc.GenericResponse, error)
GCTScriptStopAll stops all running scripts
func (*RPCServer) GCTScriptUpload ¶
func (s *RPCServer) GCTScriptUpload(_ context.Context, r *gctrpc.GCTScriptUploadRequest) (*gctrpc.GenericResponse, 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) GetActiveDataHistoryJobs ¶
func (s *RPCServer) GetActiveDataHistoryJobs(_ context.Context, _ *gctrpc.GetInfoRequest) (*gctrpc.DataHistoryJobs, error)
GetActiveDataHistoryJobs returns any active data history job details
func (*RPCServer) GetAuditEvent ¶
func (s *RPCServer) GetAuditEvent(_ context.Context, r *gctrpc.GetAuditEventRequest) (*gctrpc.GetAuditEventResponse, error)
GetAuditEvent returns matching audit events from database
func (*RPCServer) GetAvailableTransferChains ¶
func (s *RPCServer) GetAvailableTransferChains(ctx context.Context, r *gctrpc.GetAvailableTransferChainsRequest) (*gctrpc.GetAvailableTransferChainsResponse, error)
GetAvailableTransferChains returns the supported transfer chains specified by exchange and cryptocurrency
func (*RPCServer) GetCommunicationRelayers ¶
func (s *RPCServer) GetCommunicationRelayers(_ context.Context, _ *gctrpc.GetCommunicationRelayersRequest) (*gctrpc.GetCommunicationRelayersResponse, error)
GetCommunicationRelayers returns the status of the engines communication relayers
func (*RPCServer) GetConfig ¶
func (s *RPCServer) GetConfig(_ context.Context, _ *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) GetDataHistoryJobDetails ¶
func (s *RPCServer) GetDataHistoryJobDetails(_ context.Context, r *gctrpc.GetDataHistoryJobDetailsRequest) (*gctrpc.DataHistoryJob, error)
GetDataHistoryJobDetails returns a data history job's details can request all data history results with r.FullDetails
func (*RPCServer) GetDataHistoryJobSummary ¶
func (s *RPCServer) GetDataHistoryJobSummary(_ context.Context, r *gctrpc.GetDataHistoryJobDetailsRequest) (*gctrpc.DataHistoryJob, error)
GetDataHistoryJobSummary provides a general look at how a data history job is going with the "resultSummaries" property
func (*RPCServer) GetDataHistoryJobsBetween ¶
func (s *RPCServer) GetDataHistoryJobsBetween(_ context.Context, r *gctrpc.GetDataHistoryJobsBetweenRequest) (*gctrpc.DataHistoryJobs, error)
GetDataHistoryJobsBetween returns all jobs created between supplied dates
func (*RPCServer) GetEvents ¶
func (s *RPCServer) GetEvents(_ context.Context, _ *gctrpc.GetEventsRequest) (*gctrpc.GetEventsResponse, error)
GetEvents returns the stored events list
func (*RPCServer) GetExchangeAssets ¶
func (s *RPCServer) GetExchangeAssets(_ context.Context, r *gctrpc.GetExchangeAssetsRequest) (*gctrpc.GetExchangeAssetsResponse, error)
GetExchangeAssets returns the supported asset types
func (*RPCServer) GetExchangeInfo ¶
func (s *RPCServer) GetExchangeInfo(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeInfoResponse, error)
GetExchangeInfo gets info for a specific exchange
func (*RPCServer) GetExchangeOTPCode ¶
func (s *RPCServer) GetExchangeOTPCode(_ context.Context, r *gctrpc.GenericExchangeNameRequest) (*gctrpc.GetExchangeOTPResponse, error)
GetExchangeOTPCode retrieves an exchanges OTP code
func (*RPCServer) GetExchangeOTPCodes ¶
func (s *RPCServer) GetExchangeOTPCodes(_ context.Context, _ *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(_ 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(_ 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(_ context.Context, _ *gctrpc.GetForexProvidersRequest) (*gctrpc.GetForexProvidersResponse, error)
GetForexProviders returns a list of available forex providers
func (*RPCServer) GetForexRates ¶
func (s *RPCServer) GetForexRates(_ context.Context, _ *gctrpc.GetForexRatesRequest) (*gctrpc.GetForexRatesResponse, error)
GetForexRates returns a list of forex rates
func (*RPCServer) GetHistoricCandles ¶
func (s *RPCServer) GetHistoricCandles(ctx context.Context, r *gctrpc.GetHistoricCandlesRequest) (*gctrpc.GetHistoricCandlesResponse, error)
GetHistoricCandles returns historical candles for a given exchange
func (*RPCServer) GetHistoricTrades ¶
func (s *RPCServer) GetHistoricTrades(r *gctrpc.GetSavedTradesRequest, stream gctrpc.GoCryptoTrader_GetHistoricTradesServer) error
GetHistoricTrades returns trades between a set of dates
func (*RPCServer) GetInfo ¶
func (s *RPCServer) GetInfo(_ context.Context, _ *gctrpc.GetInfoRequest) (*gctrpc.GetInfoResponse, error)
GetInfo returns info about the current GoCryptoTrader session
func (*RPCServer) GetLoggerDetails ¶
func (s *RPCServer) GetLoggerDetails(_ context.Context, r *gctrpc.GetLoggerDetailsRequest) (*gctrpc.GetLoggerDetailsResponse, error)
GetLoggerDetails returns a loggers details
func (*RPCServer) GetManagedOrders ¶
func (s *RPCServer) GetManagedOrders(_ context.Context, r *gctrpc.GetOrdersRequest) (*gctrpc.GetOrdersResponse, error)
GetManagedOrders returns all orders from the Order Manager for the provided exchange, asset type and currency pair
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, _ *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 between optional dates
func (*RPCServer) GetPortfolio ¶
func (s *RPCServer) GetPortfolio(_ context.Context, _ *gctrpc.GetPortfolioRequest) (*gctrpc.GetPortfolioResponse, error)
GetPortfolio returns the portfoliomanager details
func (*RPCServer) GetPortfolioSummary ¶
func (s *RPCServer) GetPortfolioSummary(_ context.Context, _ *gctrpc.GetPortfolioSummaryRequest) (*gctrpc.GetPortfolioSummaryResponse, error)
GetPortfolioSummary returns the portfoliomanager summary
func (*RPCServer) GetRPCEndpoints ¶
func (s *RPCServer) GetRPCEndpoints(_ context.Context, _ *gctrpc.GetRPCEndpointsRequest) (*gctrpc.GetRPCEndpointsResponse, error)
GetRPCEndpoints returns a list of API endpoints
func (*RPCServer) GetRecentTrades ¶
func (s *RPCServer) GetRecentTrades(ctx context.Context, r *gctrpc.GetSavedTradesRequest) (*gctrpc.SavedTradesResponse, error)
GetRecentTrades returns trades
func (*RPCServer) GetSavedTrades ¶
func (s *RPCServer) GetSavedTrades(_ context.Context, r *gctrpc.GetSavedTradesRequest) (*gctrpc.SavedTradesResponse, error)
GetSavedTrades returns trades from the database
func (*RPCServer) GetSubsystems ¶
func (s *RPCServer) GetSubsystems(_ context.Context, _ *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, _ *gctrpc.GetTickersRequest) (*gctrpc.GetTickersResponse, error)
GetTickers returns a list of tickers for all enabled exchanges and all enabled currency pairs
func (*RPCServer) ModifyOrder ¶
func (s *RPCServer) ModifyOrder(ctx context.Context, r *gctrpc.ModifyOrderRequest) (*gctrpc.ModifyOrderResponse, error)
ModifyOrder modifies an existing order if it exists
func (*RPCServer) RemoveEvent ¶
func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.GenericResponse, error)
RemoveEvent removes an event, specified by an event ID
func (*RPCServer) RemovePortfolioAddress ¶
func (s *RPCServer) RemovePortfolioAddress(_ context.Context, r *gctrpc.RemovePortfolioAddressRequest) (*gctrpc.GenericResponse, error)
RemovePortfolioAddress removes an address from the portfoliomanager manager
func (*RPCServer) SetAllExchangePairs ¶
func (s *RPCServer) SetAllExchangePairs(_ context.Context, r *gctrpc.SetExchangeAllPairsRequest) (*gctrpc.GenericResponse, error)
SetAllExchangePairs enables or disables an exchanges pairs
func (*RPCServer) SetDataHistoryJobStatus ¶
func (s *RPCServer) SetDataHistoryJobStatus(_ context.Context, r *gctrpc.SetDataHistoryJobStatusRequest) (*gctrpc.GenericResponse, error)
SetDataHistoryJobStatus sets a data history job's status
func (*RPCServer) SetExchangeAsset ¶
func (s *RPCServer) SetExchangeAsset(_ context.Context, r *gctrpc.SetExchangeAssetRequest) (*gctrpc.GenericResponse, error)
SetExchangeAsset enables or disables an exchanges asset type
func (*RPCServer) SetExchangePair ¶
func (s *RPCServer) SetExchangePair(_ context.Context, r *gctrpc.SetExchangePairRequest) (*gctrpc.GenericResponse, error)
SetExchangePair enables/disabled the specified pair(s) on an exchange
func (*RPCServer) SetExchangeTradeProcessing ¶
func (s *RPCServer) SetExchangeTradeProcessing(_ context.Context, r *gctrpc.SetExchangeTradeProcessingRequest) (*gctrpc.GenericResponse, error)
SetExchangeTradeProcessing allows the setting of exchange trade processing
func (*RPCServer) SetLoggerDetails ¶
func (s *RPCServer) SetLoggerDetails(_ 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) StartRPCRESTProxy ¶
func (s *RPCServer) StartRPCRESTProxy()
StartRPCRESTProxy starts a gRPC proxy
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) UpdateAccountInfo ¶
func (s *RPCServer) UpdateAccountInfo(ctx context.Context, r *gctrpc.GetAccountInfoRequest) (*gctrpc.GetAccountInfoResponse, error)
UpdateAccountInfo forces an update of the account info
func (*RPCServer) UpdateDataHistoryJobPrerequisite ¶
func (s *RPCServer) UpdateDataHistoryJobPrerequisite(_ context.Context, r *gctrpc.UpdateDataHistoryJobPrerequisiteRequest) (*gctrpc.GenericResponse, error)
UpdateDataHistoryJobPrerequisite sets or removes a prerequisite job for an existing job if the prerequisite job is "", then the relationship is removed
func (*RPCServer) UpdateExchangeSupportedPairs ¶
func (s *RPCServer) UpdateExchangeSupportedPairs(ctx context.Context, r *gctrpc.UpdateExchangeSupportedPairsRequest) (*gctrpc.GenericResponse, error)
UpdateExchangeSupportedPairs forces an update of the supported pairs which will update the available pairs list and remove any assets that are disabled by the exchange
func (*RPCServer) UpsertDataHistoryJob ¶
func (s *RPCServer) UpsertDataHistoryJob(_ context.Context, r *gctrpc.UpsertDataHistoryJobRequest) (*gctrpc.UpsertDataHistoryJobResponse, error)
UpsertDataHistoryJob adds or updates a data history job for the data history manager It will upsert the entry in the database and allow for the processing of the job
func (*RPCServer) WebsocketGetInfo ¶
func (s *RPCServer) WebsocketGetInfo(_ context.Context, r *gctrpc.WebsocketGetInfoRequest) (*gctrpc.WebsocketGetInfoResponse, error)
WebsocketGetInfo returns websocket connection information
func (*RPCServer) WebsocketGetSubscriptions ¶
func (s *RPCServer) WebsocketGetSubscriptions(_ context.Context, r *gctrpc.WebsocketGetSubscriptionsRequest) (*gctrpc.WebsocketGetSubscriptionsResponse, error)
WebsocketGetSubscriptions returns websocket subscription analysis
func (*RPCServer) WebsocketSetEnabled ¶
func (s *RPCServer) WebsocketSetEnabled(_ context.Context, r *gctrpc.WebsocketSetEnabledRequest) (*gctrpc.GenericResponse, error)
WebsocketSetEnabled enables or disables the websocket client
func (*RPCServer) WebsocketSetProxy ¶
func (s *RPCServer) WebsocketSetProxy(_ context.Context, r *gctrpc.WebsocketSetProxyRequest) (*gctrpc.GenericResponse, error)
WebsocketSetProxy sets client websocket connection proxy
func (*RPCServer) WebsocketSetURL ¶
func (s *RPCServer) WebsocketSetURL(_ context.Context, r *gctrpc.WebsocketSetURLRequest) (*gctrpc.GenericResponse, error)
WebsocketSetURL sets exchange websocket client connection URL
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(_ context.Context, r *gctrpc.WithdrawalEventByIDRequest) (*gctrpc.WithdrawalEventByIDResponse, error)
WithdrawalEventByID returns previous withdrawal request details
func (*RPCServer) WithdrawalEventsByDate ¶
func (s *RPCServer) WithdrawalEventsByDate(_ 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 EnableDataHistoryManager 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 EnableCurrencyStateManager bool EventManagerDelay time.Duration Verbose bool // Exchange syncer settings EnableTickerSyncing bool EnableOrderbookSyncing bool EnableTradeSyncing bool SyncWorkers int SyncContinuously bool SyncTimeoutREST time.Duration SyncTimeoutWebsocket time.Duration // Forex settings EnableCurrencyConverter bool EnableCurrencyLayer bool EnableFixer bool EnableOpenExchangeRates bool EnableExchangeRateHost bool // Exchange tuning settings EnableExchangeHTTPRateLimiter bool EnableExchangeHTTPDebugging bool EnableExchangeVerbose bool ExchangePurgeCredentials bool EnableExchangeAutoPairUpdates bool DisableExchangeAutoPairUpdates bool EnableExchangeRESTSupport bool EnableExchangeWebsocketSupport bool MaxHTTPRequestJobsLimit int TradeBufferProcessingInterval time.Duration 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 WebsocketAuth ¶
WebsocketAuth is a struct used for
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 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
type WithdrawManager ¶
type WithdrawManager struct {
// contains filtered or unexported fields
}
WithdrawManager is responsible for performing withdrawal requests and saving them to the database
func SetupWithdrawManager ¶
func SetupWithdrawManager(em iExchangeManager, pm iPortfolioManager, isDryRun bool) (*WithdrawManager, error)
SetupWithdrawManager creates a new withdraw manager
func (*WithdrawManager) SubmitWithdrawal ¶
func (m *WithdrawManager) SubmitWithdrawal(ctx context.Context, req *withdraw.Request) (*withdraw.Response, error)
SubmitWithdrawal performs validation and submits a new withdraw request to exchange
func (*WithdrawManager) WithdrawEventByDate ¶
func (m *WithdrawManager) WithdrawEventByDate(exchange string, start, end time.Time, limit int) ([]*withdraw.Response, error)
WithdrawEventByDate returns a withdrawal request by ID
func (*WithdrawManager) WithdrawalEventByExchange ¶
func (m *WithdrawManager) WithdrawalEventByExchange(exchange string, limit int) ([]*withdraw.Response, error)
WithdrawalEventByExchange returns a withdrawal request by ID
func (*WithdrawManager) WithdrawalEventByExchangeID ¶
func (m *WithdrawManager) WithdrawalEventByExchangeID(exchange, id string) (*withdraw.Response, error)
WithdrawalEventByExchangeID returns a withdrawal request by Exchange ID
func (*WithdrawManager) WithdrawalEventByID ¶
func (m *WithdrawManager) WithdrawalEventByID(id string) (*withdraw.Response, error)
WithdrawalEventByID returns a withdrawal request by ID
Source Files ¶
- apiserver.go
- apiserver_types.go
- communication_manager.go
- connection_manager.go
- currency_state_manager.go
- database_connection.go
- datahistory_manager.go
- datahistory_manager_types.go
- depositaddress.go
- engine.go
- engine_types.go
- event_manager.go
- event_manager_types.go
- exchange_manager.go
- helpers.go
- ntp_manager.go
- ntp_manager_types.go
- order_manager.go
- order_manager_types.go
- portfolio_manager.go
- rpcserver.go
- subsystem_types.go
- sync_manager.go
- sync_manager_types.go
- websocketroutine_manager.go
- websocketroutine_manager_types.go
- withdraw_manager.go
- withdraw_manager_types.go