Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KrakenAccess ¶
type KrakenAccess interface { AddOrder(pair string, direction string, orderType string, volume string, args map[string]string) (*krakenapi.AddOrderResponse, error) QueryOrders(txids string, args map[string]string) (*krakenapi.QueryOrdersResponse, error) }
KrakenAccess is an abstraction that provides access to the Kraken Exchange.
type KrakenOrderer ¶
type KrakenOrderer struct {
Client KrakenAccess
}
KrakenOrderer providess access to the Kraken Exchange
func (KrakenOrderer) MakeOrder ¶
func (ko KrakenOrderer) MakeOrder(order *config.DCAOrder) (*OrderFufilled, error)
MakeOrder executes the provided DCAOrder on the Kraken Exchange.
func (*KrakenOrderer) New ¶
func (ko *KrakenOrderer) New(client KrakenAccess)
New creates an entirely new access object to Kraken.
func (KrakenOrderer) ProcessTransaction ¶
func (ko KrakenOrderer) ProcessTransaction(transactionID ...string) (*[]OrderComplete, error)
ProcessTransaction takes the given transactionIds and loads details for them from the Kraken Exchange and standardise the order into a OrderComplete object
type OrderComplete ¶
type OrderComplete struct { TransactionID string `json:"transaction_id"` ExchangeStatus string `json:"exchange_status"` Pair string `json:"pair"` OrderType string `json:"order_type"` Type string `json:"type"` Price decimal.Decimal `json:"price"` Fee decimal.Decimal `json:"fee"` Volume decimal.Decimal `json:"volume"` OpenTime float64 `json:"open_time"` CloseTime float64 `json:"close_time"` }
OrderComplete from an Exchange This object acts as a common abstraction amongst all exchanges
type OrderFufilled ¶
type OrderFufilled struct { TransactionID string `json:"transaction_id"` Timestamp int64 `json:"timestamp"` Result interface{} `json:"result"` }
OrderFufilled which has been sent to the Exchange
func GetFakeOrderFufilled ¶
func GetFakeOrderFufilled() (*OrderFufilled, error)
GetFakeOrderFufilled generates a fake executed order Useful for end-to-end testing so we don't need to keep paying money during testing.
type Orderer ¶
type Orderer interface { MakeOrder(order *config.DCAOrder) (*OrderFufilled, error) ProcessTransaction(transactionsIds ...string) (*[]OrderComplete, error) }
Orderer Responsible for making DCA orders to an Exchange.
type OrdererFac ¶
type OrdererFac struct{}
OrdererFac is responsible for getting Exchange Orderers
func (OrdererFac) GetOrderers ¶
func (o OrdererFac) GetOrderers(ctx context.Context, ssm pkg.SSMAccess) (*map[string]Orderer, error)
GetOrderers gets a map of exchange to Orderer.
type OrdererFactory ¶
type OrdererFactory interface {
GetOrderers(ctx context.Context, ssm pkg.SSMAccess) (*map[string]Orderer, error)
}
OrdererFactory is an abstraction to get Exchange Orderers
type PendingOrderQueue ¶
type PendingOrderQueue interface {
SubmitPendingOrder(ctx context.Context, sc pkg.SQSAccess, po *PendingOrders, exchange string, real bool, sqsQueue string) error
}
PendingOrderQueue is an abstraction to submit pending orders to a queue.
type PendingOrderSubmitter ¶
type PendingOrderSubmitter struct{}
PendingOrderSubmitter submits pending order to a queue
func (PendingOrderSubmitter) SubmitPendingOrder ¶
func (p PendingOrderSubmitter) SubmitPendingOrder(ctx context.Context, sc pkg.SQSAccess, po *PendingOrders, exchange string, real bool, sqsQueue string) error
SubmitPendingOrder submits a pending order to queue.
type PendingOrders ¶
type PendingOrders struct { TransactionID string `json:"transaction_id"` S3Bucket string `json:"s3_bucket"` S3Key string `json:"s3_key"` }
PendingOrders which is processing on the exchange where the s3 bucket & key define the result from the exchange from the initial call.
An order could be accepted by the exchange but not necessarily successful yet so the payload in s3 is whatever they sent back to us.
This object is used to push the transaction to an out-of-process queue for later processing