Documentation ¶
Index ¶
- Constants
- Variables
- func AddTradesToBuffer(exchangeName string, data ...Data) error
- func ConvertTradesToCandles(interval kline.Interval, trades ...Data) (kline.Item, error)
- func HasTradesInRanges(exchangeName, assetType, base, quote string, ...) error
- func SaveTradesToDatabase(trades ...Data) error
- type ByDate
- type Data
- type Processor
Constants ¶
View Source
const DefaultProcessorIntervalTime = time.Second * 15
DefaultProcessorIntervalTime is the default timer to process queued trades and save them to the database
Variables ¶
View Source
var ( // BufferProcessorIntervalTime is the interval to save trade buffer data to the database. // Change this by changing the runtime param `-tradeprocessinginterval=15s` BufferProcessorIntervalTime = DefaultProcessorIntervalTime // ErrNoTradesSupplied is returned when an attempt is made to process trades, but is an empty slice ErrNoTradesSupplied = errors.New("no trades supplied") )
Functions ¶
func AddTradesToBuffer ¶
AddTradesToBuffer will push trade data onto the buffer
func ConvertTradesToCandles ¶
ConvertTradesToCandles turns trade data into kline.Items
func HasTradesInRanges ¶
func HasTradesInRanges(exchangeName, assetType, base, quote string, rangeHolder *kline.IntervalRangeHolder) error
HasTradesInRanges Creates an executes an SQL query to verify if a trade exists within a timeframe
func SaveTradesToDatabase ¶
SaveTradesToDatabase converts trades and saves results to database
Types ¶
type Data ¶
type Data struct { ID uuid.UUID `json:"ID,omitempty"` TID string Exchange string CurrencyPair currency.Pair AssetType asset.Item Side order.Side Price float64 Amount float64 Timestamp time.Time }
Data defines trade data
func FilterTradesByTime ¶
FilterTradesByTime removes any trades that are not between the start and end times
Click to show internal directories.
Click to hide internal directories.