Documentation ¶
Index ¶
- Variables
- func TestCandleSticksCount() (count int)
- type CandleStickService
- func (m *CandleStickService) Do(ctx context.Context) ([]models.CandleStick, error)
- func (m *CandleStickService) EndTime(endTime time.Time) interfaces.CandleStickServiceInterface
- func (m *CandleStickService) Limit(limit int) interfaces.CandleStickServiceInterface
- func (m *CandleStickService) Period(period int64) interfaces.CandleStickServiceInterface
- func (m *CandleStickService) SetError(err error)
- func (m *CandleStickService) Symbol(symbol string) interfaces.CandleStickServiceInterface
- type CandleSticks
- type MockedService
Constants ¶
This section is empty.
Variables ¶
var DefaultCandleStickServiceLimit = 1000
DefaultCandleStickServiceLimit is the limit for CandleStick service if none is specified
var TestCandleSticks = []CandleSticks{ { Symbol: "BTC-USDC", Period: models.M1, CandleSticks: []models.CandleStick{ {Time: time.Time{}, Open: 10, High: 10, Low: 10, Close: 10}, {Time: time.Time{}, Open: 15, High: 15, Low: 15, Close: 15}}, }, { Symbol: "ETH-USDC", Period: models.M5, CandleSticks: []models.CandleStick{ {Time: time.Time{}, Open: 20, High: 20, Low: 20, Close: 20}, {Time: time.Time{}, Open: 25, High: 25, Low: 25, Close: 25}}, }, { Symbol: "IOTA-USDC", Period: models.M15, CandleSticks: []models.CandleStick{ {Time: time.Unix(1257894000, 0), Open: 30, High: 30, Low: 30, Close: 30}, {Time: time.Unix(1257894900, 0), Open: 35, High: 35, Low: 35, Close: 35}}, }, { Symbol: "BTC-USDC", Period: models.M5, CandleSticks: []models.CandleStick{ {Time: time.Unix(1257894000, 0), Open: 30, High: 30, Low: 30, Close: 30}, {Time: time.Unix(1257894300, 0), Open: 35, High: 35, Low: 35, Close: 35}}, }, }
TestCandleSticks are candle sticks that can be used for test
Functions ¶
func TestCandleSticksCount ¶
func TestCandleSticksCount() (count int)
TestCandleSticksCount will return the count of candles for TestCandleSticks
Types ¶
type CandleStickService ¶
type CandleStickService struct {
// contains filtered or unexported fields
}
CandleStickService is the mocked service for candlesticks
func (*CandleStickService) Do ¶
func (m *CandleStickService) Do(ctx context.Context) ([]models.CandleStick, error)
Do will execute a request for candlesticks
func (*CandleStickService) EndTime ¶
func (m *CandleStickService) EndTime(endTime time.Time) interfaces.CandleStickServiceInterface
EndTime will specify the time where the list ends (earliest time) for next candlesticks request
func (*CandleStickService) Limit ¶
func (m *CandleStickService) Limit(limit int) interfaces.CandleStickServiceInterface
Limit will specify the number of candlesticks the list should have at its maximum If the limit is higher than the default limit, it will be limited to this one
func (*CandleStickService) Period ¶
func (m *CandleStickService) Period(period int64) interfaces.CandleStickServiceInterface
Period will specify a period for next candlesticks request
func (*CandleStickService) SetError ¶
func (m *CandleStickService) SetError(err error)
SetError will set an error that will be raised each time a Do() is executed You can set it at nil if you want to deactivate it
func (*CandleStickService) Symbol ¶
func (m *CandleStickService) Symbol(symbol string) interfaces.CandleStickServiceInterface
Symbol will specify a symbol for next candlesticks request
type CandleSticks ¶
CandleSticks are candlesticks that can be used in MockCandleStickService
type MockedService ¶
type MockedService struct {
// contains filtered or unexported fields
}
MockedService represents the Binance service mocked
func (*MockedService) AddCandleSticks ¶
func (m *MockedService) AddCandleSticks(cs []CandleSticks)
AddCandleSticks will add fake candlesticks to service that can be used in candlestick services
func (*MockedService) NewCandleStickService ¶
func (m *MockedService) NewCandleStickService() interfaces.CandleStickServiceInterface
NewCandleStickService will create a new candlestick service
func (*MockedService) NextError ¶
func (m *MockedService) NextError(err error)
NextError will set an error for the next Do() on any child service