exchanges

package
v0.0.0-...-e057ce7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package exchanges contains all wrappers for common exchanges.

Index

Constants

This section is empty.

Variables

View Source
var ErrWebsocketNotSupported = errors.New("cannot use websocket: exchange does not support it")

ErrWebsocketNotSupported is the error representing when an exchange does not support websocket.

Functions

func MarketNameFor

func MarketNameFor(m *environment.Market, wrapper ExchangeWrapper) string

MarketNameFor gets the market name as seen by the exchange.

Types

type CandleMap

type CandleMap struct {
	TimeMap map[string]*environment.CandleStick
}

func NewSizedCandleMap

func NewSizedCandleMap(size int) CandleMap

type CandlesCache

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

CandlesCache represents a local candles cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewCandlesCache

func NewCandlesCache() *CandlesCache

NewCandlesCache creates a new CandlesCache Object

func (*CandlesCache) Get

Get gets the value for the specified key.

func (*CandlesCache) Set

Set sets a value for the specified key.

type CoinbaseWrapper

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

coinbaseWrapper represents the wrapper for the coinbase exchange.

func (*CoinbaseWrapper) BuyLimit

func (wrapper *CoinbaseWrapper) BuyLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

BuyLimit performs a limit buy action.

func (*CoinbaseWrapper) BuyMarket

func (wrapper *CoinbaseWrapper) BuyMarket(market *environment.Market, amount decimal.Decimal) (string, error)

BuyMarket performs a market buy action.

func (*CoinbaseWrapper) CalculateTradingFees

func (wrapper *CoinbaseWrapper) CalculateTradingFees(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal, orderSide environment.TradeSide) decimal.Decimal

NOTE: In Coinbase fees are currently hardcoded.

func (*CoinbaseWrapper) CalculateWithdrawFees

func (wrapper *CoinbaseWrapper) CalculateWithdrawFees(market *environment.Market, amount decimal.Decimal) decimal.Decimal

CalculateWithdrawFees calculates the withdrawal fees on a specified market.

func (*CoinbaseWrapper) FeedConnect

func (wrapper *CoinbaseWrapper) FeedConnect(markets []*environment.Market) error

FeedConnect connects to the feed of the exchange.

func (*CoinbaseWrapper) GetAllMarketTrades

func (wrapper *CoinbaseWrapper) GetAllMarketTrades(market *environment.Market) (*environment.TradeBook, error)

func (*CoinbaseWrapper) GetAllTrades

func (wrapper *CoinbaseWrapper) GetAllTrades(markets []*environment.Market) (*environment.TradeBook, error)

func (*CoinbaseWrapper) GetBalance

func (wrapper *CoinbaseWrapper) GetBalance(symbol string) (*decimal.Decimal, error)

GetBalance gets the balance of the user of the specified currency.

func (*CoinbaseWrapper) GetCandles

func (wrapper *CoinbaseWrapper) GetCandles(market *environment.Market) ([]environment.CandleStick, error)

GetCandles gets the candle data from the exchange.

func (*CoinbaseWrapper) GetDepositAddress

func (wrapper *CoinbaseWrapper) GetDepositAddress(coinTicker string) (string, bool)

GetDepositAddress gets the deposit address for the specified coin on the exchange.

func (*CoinbaseWrapper) GetFilteredTrades

func (wrapper *CoinbaseWrapper) GetFilteredTrades(market *environment.Market, symbol string, tradeSide environment.TradeSide, tradeType environment.TradeType, tradeStatus environment.TradeStatus) (*environment.TradeBook, error)

func (*CoinbaseWrapper) GetHistoricalCandles

func (wrapper *CoinbaseWrapper) GetHistoricalCandles(market *environment.Market, start time.Time, end time.Time, interval int) ([]environment.CandleStick, error)

func (*CoinbaseWrapper) GetHistoricalTrades

func (wrapper *CoinbaseWrapper) GetHistoricalTrades(market *environment.Market, start time.Time, end time.Time) (*environment.TradeBook, error)

func (*CoinbaseWrapper) GetMarketSummary

func (wrapper *CoinbaseWrapper) GetMarketSummary(market *environment.Market) (*environment.MarketSummary, error)

GetMarketSummary gets the current market summary.

func (*CoinbaseWrapper) GetMarkets

func (wrapper *CoinbaseWrapper) GetMarkets() ([]*environment.Market, error)

GetMarkets Gets all the markets info.

func (*CoinbaseWrapper) GetOrderBook

func (wrapper *CoinbaseWrapper) GetOrderBook(market *environment.Market) (*environment.OrderBook, error)

GetOrderBook gets the order(ASK + BID) book of a market.

func (*CoinbaseWrapper) GetTicker

func (wrapper *CoinbaseWrapper) GetTicker(market *environment.Market) (*environment.Ticker, error)

GetTicker gets the updated ticker for a market.

func (*CoinbaseWrapper) IsHistoricalSimulation

func (wrapper *CoinbaseWrapper) IsHistoricalSimulation() bool

func (*CoinbaseWrapper) Name

func (wrapper *CoinbaseWrapper) Name() string

Name returns the name of the wrapped exchange.

func (*CoinbaseWrapper) SellLimit

func (wrapper *CoinbaseWrapper) SellLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

SellLimit performs a limit sell action.

func (*CoinbaseWrapper) SellMarket

func (wrapper *CoinbaseWrapper) SellMarket(market *environment.Market, amount decimal.Decimal) (string, error)

SellMarket performs a market sell action.

func (*CoinbaseWrapper) String

func (wrapper *CoinbaseWrapper) String() string

func (*CoinbaseWrapper) Withdraw

func (wrapper *CoinbaseWrapper) Withdraw(destinationAddress string, coinTicker string, amount decimal.Decimal) error

Withdraw performs a withdraw operation from the exchange to a destination address.

type ExchangeWrapper

type ExchangeWrapper interface {
	Name() string                                                                                                                     // Gets the name of the exchange.
	GetCandles(market *environment.Market) ([]environment.CandleStick, error)                                                         // Gets the candle data from the exchange.
	GetHistoricalCandles(market *environment.Market, start time.Time, end time.Time, interval int) ([]environment.CandleStick, error) // Gets the candle data from the exchange.
	GetMarkets() ([]*environment.Market, error)
	GetMarketSummary(market *environment.Market) (*environment.MarketSummary, error) // Gets the current market summary.
	GetOrderBook(market *environment.Market) (*environment.OrderBook, error)         // Gets the order(ASK + BID) book of a market.

	BuyLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)  // Performs a limit buy action.
	SellLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error) // Performs a limit sell action.
	BuyMarket(market *environment.Market, amount decimal.Decimal) (string, error)                        // Performs a market buy action.
	SellMarket(market *environment.Market, amount decimal.Decimal) (string, error)                       // Performs a market sell action.

	GetHistoricalTrades(market *environment.Market, start time.Time, end time.Time) (*environment.TradeBook, error)
	GetAllTrades(markets []*environment.Market) (*environment.TradeBook, error)
	GetAllMarketTrades(market *environment.Market) (*environment.TradeBook, error)
	GetFilteredTrades(market *environment.Market, symbol string, tradeSide environment.TradeSide, tradeType environment.TradeType, tradeStatus environment.TradeStatus) (*environment.TradeBook, error)
	CalculateTradingFees(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal, orderSide environment.TradeSide) decimal.Decimal // Calculates the trading fees for an order on a specified market.
	CalculateWithdrawFees(market *environment.Market, amount decimal.Decimal) decimal.Decimal                                                        // Calculates the withdrawal fees on a specified market.

	GetBalance(symbol string) (*decimal.Decimal, error) // Gets the balance of the user of the specified currency.
	GetDepositAddress(coinTicker string) (string, bool) // Gets the deposit address for the specified coin on the exchange, if exists.

	FeedConnect(markets []*environment.Market) error // Connects to the feed of the exchange.

	Withdraw(destinationAddress string, coinTicker string, amount decimal.Decimal) error // Performs a withdraw operation from the exchange to a destination address.

	String() string // Returns a string representation of the object.
	IsHistoricalSimulation() bool
}

ExchangeWrapper provides a generic wrapper for exchange services.

func NewCoinbaseWrapper

func NewCoinbaseWrapper(publicKey string, secretKey string, depositAddresses map[string]string) ExchangeWrapper

NewCoinbaseWrapper creates a generic wrapper of the coinbase API.

func NewKrakenWrapper

func NewKrakenWrapper(publicKey string, secretKey string, depositAddresses map[string]string) ExchangeWrapper

NewKrakenWrapper creates a generic wrapper of the poloniex API.

func NewKucoinWrapper

func NewKucoinWrapper(publicKey string, secretKey string, depositAddresses map[string]string) ExchangeWrapper

NewKucoinWrapper creates a generic wrapper of theKucoin

type ExchangeWrapperSimulator

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

ExchangeWrapperSimulator wraps another wrapper and returns simulated balances and orders.

func NewExchangeWrapperSimulator

func NewExchangeWrapperSimulator(mockedWrapper ExchangeWrapper, simConfigs environment.SimulationConfig) *ExchangeWrapperSimulator

NewExchangeWrapperSimulator creates a new simulated wrapper from another wrapper and an initial balance.

func (*ExchangeWrapperSimulator) AddTrade

func (wrapper *ExchangeWrapperSimulator) AddTrade(market *environment.Market, trade environment.Trade) error

func (*ExchangeWrapperSimulator) BuyLimit

func (wrapper *ExchangeWrapperSimulator) BuyLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

func (*ExchangeWrapperSimulator) BuyMarket

func (wrapper *ExchangeWrapperSimulator) BuyMarket(market *environment.Market, amount decimal.Decimal) (string, error)

BuyMarket performs a FAKE market buy action.

func (*ExchangeWrapperSimulator) CalculateTradingFees

func (wrapper *ExchangeWrapperSimulator) CalculateTradingFees(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal, orderSide environment.TradeSide) decimal.Decimal

CalculateTradingFees calculates the trading fees for an order on a specified market.

func (*ExchangeWrapperSimulator) CalculateWithdrawFees

func (wrapper *ExchangeWrapperSimulator) CalculateWithdrawFees(market *environment.Market, amount decimal.Decimal) decimal.Decimal

CalculateWithdrawFees calculates the withdrawal fees on a specified market.

func (*ExchangeWrapperSimulator) FeedConnect

func (wrapper *ExchangeWrapperSimulator) FeedConnect(markets []*environment.Market) error

FeedConnect connects to the feed of the exchange.

func (*ExchangeWrapperSimulator) GetAllMarketTrades

func (wrapper *ExchangeWrapperSimulator) GetAllMarketTrades(market *environment.Market) (*environment.TradeBook, error)

func (*ExchangeWrapperSimulator) GetAllTrades

func (wrapper *ExchangeWrapperSimulator) GetAllTrades(markets []*environment.Market) (*environment.TradeBook, error)

func (*ExchangeWrapperSimulator) GetBalance

func (wrapper *ExchangeWrapperSimulator) GetBalance(symbol string) (*decimal.Decimal, error)

GetBalance gets the balance of the user of the specified currency.

func (*ExchangeWrapperSimulator) GetCandle

func (wrapper *ExchangeWrapperSimulator) GetCandle(market *environment.Market, time time.Time) (*environment.CandleStick, error)

func (*ExchangeWrapperSimulator) GetCandles

func (wrapper *ExchangeWrapperSimulator) GetCandles(market *environment.Market) ([]environment.CandleStick, error)

GetCandles gets the candle data from the exchange.

func (*ExchangeWrapperSimulator) GetCurrDate

func (wrapper *ExchangeWrapperSimulator) GetCurrDate() time.Time

func (*ExchangeWrapperSimulator) GetDepositAddress

func (wrapper *ExchangeWrapperSimulator) GetDepositAddress(coinTicker string) (string, bool)

GetDepositAddress gets the deposit address for the specified coin on the exchange.

func (*ExchangeWrapperSimulator) GetFilteredTrades

func (wrapper *ExchangeWrapperSimulator) GetFilteredTrades(market *environment.Market, symbol string, tradeSide environment.TradeSide, tradeType environment.TradeType, tradeStatus environment.TradeStatus) (*environment.TradeBook, error)

func (*ExchangeWrapperSimulator) GetHistoricalCandles

func (wrapper *ExchangeWrapperSimulator) GetHistoricalCandles(market *environment.Market, start time.Time, end time.Time, interval int) ([]environment.CandleStick, error)

func (*ExchangeWrapperSimulator) GetHistoricalTrades

func (wrapper *ExchangeWrapperSimulator) GetHistoricalTrades(market *environment.Market, start time.Time, end time.Time) (*environment.TradeBook, error)

func (*ExchangeWrapperSimulator) GetMarketSummary

func (wrapper *ExchangeWrapperSimulator) GetMarketSummary(market *environment.Market) (*environment.MarketSummary, error)

GetMarketSummary gets the current market summary.

func (*ExchangeWrapperSimulator) GetMarkets

func (wrapper *ExchangeWrapperSimulator) GetMarkets() ([]*environment.Market, error)

func (*ExchangeWrapperSimulator) GetOrderBook

func (wrapper *ExchangeWrapperSimulator) GetOrderBook(market *environment.Market) (*environment.OrderBook, error)

GetOrderBook gets the order(ASK + BID) book of a market.

func (*ExchangeWrapperSimulator) IncrementCurrDate

func (wrapper *ExchangeWrapperSimulator) IncrementCurrDate() error

func (*ExchangeWrapperSimulator) IsHistoricalSimulation

func (wrapper *ExchangeWrapperSimulator) IsHistoricalSimulation() bool

func (*ExchangeWrapperSimulator) Name

func (wrapper *ExchangeWrapperSimulator) Name() string

Name gets the name of the exchange.

func (*ExchangeWrapperSimulator) SellLimit

func (wrapper *ExchangeWrapperSimulator) SellLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

SellLimit here is just to implement the ExchangeWrapper Interface, do not use, use SellMarket instead.

func (*ExchangeWrapperSimulator) SellMarket

func (wrapper *ExchangeWrapperSimulator) SellMarket(market *environment.Market, amount decimal.Decimal) (string, error)

SellMarket performs a FAKE market buy action.

func (*ExchangeWrapperSimulator) String

func (wrapper *ExchangeWrapperSimulator) String() string

String returns a string representation of the exchange simulator.

func (*ExchangeWrapperSimulator) UpdateMappedCandles

func (wrapper *ExchangeWrapperSimulator) UpdateMappedCandles(market *environment.Market, from_time time.Time) (*environment.CandleStick, error)

GetCandles gets the candle data from the exchange.

func (*ExchangeWrapperSimulator) UpdateMappedOrders

func (wrapper *ExchangeWrapperSimulator) UpdateMappedOrders(market *environment.Market, from_time time.Time) (*environment.OrderBook, error)

func (*ExchangeWrapperSimulator) UpdateTrades

func (wrapper *ExchangeWrapperSimulator) UpdateTrades(market *environment.Market, from_time time.Time) (*environment.TradeBook, error)

func (*ExchangeWrapperSimulator) Withdraw

func (wrapper *ExchangeWrapperSimulator) Withdraw(destinationAddress string, coinTicker string, amount decimal.Decimal) error

Withdraw performs a FAKE withdraw operation from the exchange to a destination address.

type KrakenWrapper

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

KrakenWrapper provides a Generic wrapper of the Kraken API.

func (*KrakenWrapper) BuyLimit

func (wrapper *KrakenWrapper) BuyLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

BuyLimit performs a limit buy action.

func (*KrakenWrapper) BuyMarket

func (wrapper *KrakenWrapper) BuyMarket(market *environment.Market, amount decimal.Decimal) (string, error)

BuyMarket performs a market buy action.

func (*KrakenWrapper) CalculateTradingFees

func (wrapper *KrakenWrapper) CalculateTradingFees(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal, orderSide environment.TradeSide) decimal.Decimal

CalculateTradingFees calculates the trading fees for an order on a specified market.

NOTE: In Kraken fees are currently hardcoded.

func (*KrakenWrapper) CalculateWithdrawFees

func (wrapper *KrakenWrapper) CalculateWithdrawFees(market *environment.Market, amount decimal.Decimal) decimal.Decimal

CalculateWithdrawFees calculates the withdrawal fees on a specified market.

func (*KrakenWrapper) FeedConnect

func (wrapper *KrakenWrapper) FeedConnect(markets []*environment.Market) error

FeedConnect connects to the feed of the exchange.

func (*KrakenWrapper) GetAllMarketTrades

func (wrapper *KrakenWrapper) GetAllMarketTrades(market *environment.Market) (*environment.TradeBook, error)

func (*KrakenWrapper) GetAllTrades

func (wrapper *KrakenWrapper) GetAllTrades(markets []*environment.Market) (*environment.TradeBook, error)

func (*KrakenWrapper) GetBalance

func (wrapper *KrakenWrapper) GetBalance(symbol string) (*decimal.Decimal, error)

GetBalance gets the balance of the user of the specified currency.

func (*KrakenWrapper) GetCandles

func (wrapper *KrakenWrapper) GetCandles(market *environment.Market) ([]environment.CandleStick, error)

GetCandles gets the candle data from the exchange.

func (*KrakenWrapper) GetDepositAddress

func (wrapper *KrakenWrapper) GetDepositAddress(coinTicker string) (string, bool)

GetDepositAddress gets the deposit address for the specified coin on the exchange.

func (*KrakenWrapper) GetFilteredTrades

func (wrapper *KrakenWrapper) GetFilteredTrades(market *environment.Market, symbol string, tradeSide environment.TradeSide, tradeType environment.TradeType, tradeStatus environment.TradeStatus) (*environment.TradeBook, error)

func (*KrakenWrapper) GetHistoricalCandles

func (wrapper *KrakenWrapper) GetHistoricalCandles(market *environment.Market, start time.Time, end time.Time, interval int) ([]environment.CandleStick, error)

func (*KrakenWrapper) GetHistoricalTrades

func (wrapper *KrakenWrapper) GetHistoricalTrades(market *environment.Market, start time.Time, end time.Time) (*environment.TradeBook, error)

func (*KrakenWrapper) GetMarketSummary

func (wrapper *KrakenWrapper) GetMarketSummary(market *environment.Market) (*environment.MarketSummary, error)

GetMarketSummary gets the current market summary.

func (*KrakenWrapper) GetMarkets

func (wrapper *KrakenWrapper) GetMarkets() ([]*environment.Market, error)

GetMarkets gets all the markets info.

func (*KrakenWrapper) GetOrderBook

func (wrapper *KrakenWrapper) GetOrderBook(market *environment.Market) (*environment.OrderBook, error)

GetOrderBook gets the order(ASK + BID) book of a market.

func (*KrakenWrapper) GetTicker

func (wrapper *KrakenWrapper) GetTicker(market *environment.Market) (*environment.Ticker, error)

GetTicker gets the updated ticker for a market.

func (*KrakenWrapper) IsHistoricalSimulation

func (wrapper *KrakenWrapper) IsHistoricalSimulation() bool

func (*KrakenWrapper) Name

func (wrapper *KrakenWrapper) Name() string

Name returns the name of the wrapped exchange.

func (*KrakenWrapper) SellLimit

func (wrapper *KrakenWrapper) SellLimit(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal) (string, error)

SellLimit performs a limit sell action.

NOTE: In kraken buy and sell orders behave the same (the go kraken api automatically puts it on correct side)

func (*KrakenWrapper) SellMarket

func (wrapper *KrakenWrapper) SellMarket(market *environment.Market, amount decimal.Decimal) (string, error)

SellMarket performs a market sell action.

func (*KrakenWrapper) String

func (wrapper *KrakenWrapper) String() string

func (*KrakenWrapper) Withdraw

func (wrapper *KrakenWrapper) Withdraw(destinationAddress string, coinTicker string, amount decimal.Decimal) error

Withdraw performs a withdraw operation from the exchange to a destination address.

type KucoinWrapper

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

KucoinWrapper wrapsKucoin

func (*KucoinWrapper) BuyLimit

func (wrapper *KucoinWrapper) BuyLimit(market *environment.Market, amount, limit decimal.Decimal) (string, error)

BuyLimit performs a limit buy action.

func (*KucoinWrapper) BuyMarket

func (wrapper *KucoinWrapper) BuyMarket(market *environment.Market, amount decimal.Decimal) (string, error)

BuyMarket performs a market buy action.

func (*KucoinWrapper) CalculateTradingFees

func (wrapper *KucoinWrapper) CalculateTradingFees(market *environment.Market, amount decimal.Decimal, limit decimal.Decimal, orderSide environment.TradeSide) decimal.Decimal

CalculateTradingFees calculates the trading fees for an order on a specified market.

func (*KucoinWrapper) CalculateWithdrawFees

func (wrapper *KucoinWrapper) CalculateWithdrawFees(market *environment.Market, amount decimal.Decimal) decimal.Decimal

CalculateWithdrawFees calculates the withdrawal fees on a specified market.

func (*KucoinWrapper) FeedConnect

func (wrapper *KucoinWrapper) FeedConnect(markets []*environment.Market) error

FeedConnect connects to the feed of the exchange.

func (*KucoinWrapper) GetAllMarketTrades

func (wrapper *KucoinWrapper) GetAllMarketTrades(market *environment.Market) (*environment.TradeBook, error)

func (*KucoinWrapper) GetAllTrades

func (wrapper *KucoinWrapper) GetAllTrades(markets []*environment.Market) (*environment.TradeBook, error)

func (*KucoinWrapper) GetBalance

func (wrapper *KucoinWrapper) GetBalance(symbol string) (*decimal.Decimal, error)

GetBalance gets the balance of the user of the specified currency.

func (*KucoinWrapper) GetCandles

func (wrapper *KucoinWrapper) GetCandles(market *environment.Market) ([]environment.CandleStick, error)

GetCandles gets the candle data from the exchange.

func (*KucoinWrapper) GetDepositAddress

func (wrapper *KucoinWrapper) GetDepositAddress(coinTicker string) (string, bool)

GetDepositAddress gets the deposit address for the specified coin on the exchange.

func (*KucoinWrapper) GetFilteredTrades

func (wrapper *KucoinWrapper) GetFilteredTrades(market *environment.Market, symbol string, tradeSide environment.TradeSide, tradeType environment.TradeType, tradeStatus environment.TradeStatus) (*environment.TradeBook, error)

func (*KucoinWrapper) GetHistoricalCandles

func (wrapper *KucoinWrapper) GetHistoricalCandles(market *environment.Market, start time.Time, end time.Time, interval int) ([]environment.CandleStick, error)

func (*KucoinWrapper) GetHistoricalTrades

func (wrapper *KucoinWrapper) GetHistoricalTrades(market *environment.Market, start time.Time, end time.Time) (*environment.TradeBook, error)

func (*KucoinWrapper) GetMarketSummary

func (wrapper *KucoinWrapper) GetMarketSummary(market *environment.Market) (*environment.MarketSummary, error)

GetMarketSummary gets the current market summary.

func (*KucoinWrapper) GetMarkets

func (wrapper *KucoinWrapper) GetMarkets() ([]*environment.Market, error)

GetMarkets gets all the markets info.

func (*KucoinWrapper) GetOrderBook

func (wrapper *KucoinWrapper) GetOrderBook(market *environment.Market) (*environment.OrderBook, error)

GetOrderBook gets the order(ASK + BID) book of a market.

func (*KucoinWrapper) GetTicker

func (wrapper *KucoinWrapper) GetTicker(market *environment.Market) (*environment.Ticker, error)

GetTicker gets the updated ticker for a market.

func (*KucoinWrapper) IsHistoricalSimulation

func (wrapper *KucoinWrapper) IsHistoricalSimulation() bool

func (*KucoinWrapper) Name

func (wrapper *KucoinWrapper) Name() string

Name returns the name of the wrapped exchange.

func (*KucoinWrapper) SellLimit

func (wrapper *KucoinWrapper) SellLimit(market *environment.Market, amount, limit decimal.Decimal) (string, error)

SellLimit performs a limit sell action.

func (*KucoinWrapper) SellMarket

func (wrapper *KucoinWrapper) SellMarket(market *environment.Market, amount decimal.Decimal) (string, error)

SellMarket performs a market sell action.

func (*KucoinWrapper) String

func (wrapper *KucoinWrapper) String() string

func (*KucoinWrapper) Withdraw

func (wrapper *KucoinWrapper) Withdraw(destinationAddress string, coinTicker string, amount decimal.Decimal) error

Withdraw performs a withdraw operation from the exchange to a destination address.

type MappedCandlesCache

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

func NewMappedCandlesCache

func NewMappedCandlesCache() *MappedCandlesCache

NewCandlesCache creates a new CandlesCache Object

func (*MappedCandlesCache) GetMap

func (mcc *MappedCandlesCache) GetMap(market *environment.Market) (CandleMap, bool)

Get gets the value for the specified key.

func (*MappedCandlesCache) GetTime

func (mcc *MappedCandlesCache) GetTime(market *environment.Market, time time.Time) (*environment.CandleStick, bool)

Get gets the value for the specified key.

func (*MappedCandlesCache) SetMap

func (mcc *MappedCandlesCache) SetMap(market *environment.Market, candles CandleMap) CandleMap

Set sets a value for the specified key.

type MappedOrdersCache

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

func NewMappedOrdersCache

func NewMappedOrdersCache() *MappedOrdersCache

NewCandlesCache creates a new CandlesCache Object

func (*MappedOrdersCache) GetMap

func (moc *MappedOrdersCache) GetMap(market *environment.Market) (OrderBookMap, bool)

Get gets the value for the specified key.

func (*MappedOrdersCache) GetTime

func (moc *MappedOrdersCache) GetTime(market *environment.Market, time time.Time) (*environment.OrderBook, bool)

Get gets the value for the specified key.

func (*MappedOrdersCache) SetMap

func (moc *MappedOrdersCache) SetMap(market *environment.Market, orders OrderBookMap) OrderBookMap

type OrderBookMap

type OrderBookMap struct {
	TimeMap map[string]*environment.OrderBook
}

func NewOrderBookMap

func NewOrderBookMap(size int) OrderBookMap

type OrderbookCache

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

OrderbookCache represents a local orderbook cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewOrderbookCache

func NewOrderbookCache() *OrderbookCache

NewOrderbookCache creates a new OrderbookCache Object

func (*OrderbookCache) Get

Get gets the value for the specified key.

func (*OrderbookCache) Set

Set sets a value for the specified key.

type SummaryCache

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

SummaryCache represents a local summary cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewSummaryCache

func NewSummaryCache() *SummaryCache

NewSummaryCache creates a new SummaryCache Object

func (*SummaryCache) Get

Get gets the value for the specified key.

func (*SummaryCache) Set

Set sets a value for the specified key.

type TradeBookbookCache

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

OrderbookCache represents a local orderbook cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewTradeBookbookCache

func NewTradeBookbookCache() *TradeBookbookCache

NewOrderbookCache creates a new OrderbookCache Object

func (*TradeBookbookCache) Get

Get gets the value for the specified key.

func (*TradeBookbookCache) Set

Set sets a value for the specified key.

Jump to

Keyboard shortcuts

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