driver

package module
v0.0.0-...-5e377c6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

Models

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Overview

shyost/exchange-driver

This file is part of Shyost.

shyost/exchange-driver is free software: you can redistribute it and/or modify it under the terms of the Apache License, Version 2.0 (the "License").

shyost/models is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache License, Version 2.0 for more details.

You should have received a copy of the Apache License, Version 2.0 along with shyost/exchange-driver. If not, see <https://www.apache.org/licenses/LICENSE-2.0>.

shyost/exchange/driver

This file is part of Shyost.

shyost/exchange/driver is free software: you can redistribute it and/or modify it under the terms of the Apache License, Version 2.0 (the "License").

shyost/models is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache License, Version 2.0 for more details.

You should have received a copy of the Apache License, Version 2.0 along with shyost/exchange/driver. If not, see <https://www.apache.org/licenses/LICENSE-2.0>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandleReader

type CandleReader interface {
	// Subscribe is used to subscribe to the topic that allows retrieving the
	// required project data.
	Subscribe(pair *models.Pair, timeframe models.TimeFrame) (string, error)

	// Connect is used to connect to the exchange provider. Case somme problem
	// occur the error should be returned
	Connect() error

	// Start is used to start the process of consuming data from the exchange
	// provider, processing it, and sending it to the provided channel.
	Start(channel chan DataTransport)
}

CandleReader is an interface that defines methods for subscribing to a topic, connecting to an exchange provider, converting time frames, and starting the process of consuming data from the exchange provider and sending it to a channel.

type DataTransport

type DataTransport struct {
	Candle    *models.Candle    `json:"candle"`
	Pair      *models.Pair      `json:"pair"`
	TimeFrame *models.TimeFrame `json:"timeframe"`
	Read      time.Time         `json:"read"`
}

DataTransport represents the data transport structure used for exchanging candle and pair information. It contains the candle data, pair information, timeframe, and the read timestamp.

type TimeFrame

type TimeFrame interface {
	// ToExchangeFormat converts the bot time frame to the corresponding exchange
	// time frame format. It takes a `timeframe` of type `models.TimeFrame` as input
	// and returns a pointer to `models.TimeFrame`. The returned `models.TimeFrame`
	// represents the equivalent time frame in the exchange format.
	ToExchangeFormat(timeframe models.TimeFrame) *models.TimeFrame

	// ToBotFormat converts the exchange time frame string to the corresponding bot
	// time frame format. It takes a `timeframe` of type `models.TimeFrame` as input
	// and returns a pointer to `models.TimeFrame`. If the given `timeframe` is not
	// recognized or cannot be converted, it returns `nil`. The returned
	// `models.TimeFrame` represents the equivalent time frame in the bot format.
	ToBotFormat(timeframe models.TimeFrame) *models.TimeFrame
}

TimeFrame is an interface that defines methods for converting time frames between the bot and exchange formats.

Jump to

Keyboard shortcuts

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