Crate trade_aggregation
source · [−]Expand description
This crate is used for aggregating raw trade data into candles using various methods
Modules
This module contains a bunch of ready to use ‘CandleComponents’ that can easily be combined to create a ‘ModularCandle’ using the ‘Candle’ macro.
Structs
An aggregator that is generic over the type of Candle being produced, as well as by which rule the candle is created
The classic time based aggregation rule, creating a new candle every n seconds
Defines a taker trade
Creates candles every n units of volume traded
Enums
Defines how to aggregate trade size either by Base currency or Quote Currency assumes trades sizes are denoted in Quote e.g.: buy 10 contracts of BTC would be trade size of 10
Constants
1 Day candle period
1 Hour candle period
2 Hour candle period
4 Hour candle period
8 Hour candle period
12 Hour candle period
1 Minute candle period
5 Minute candle period
15 Minute candle period
30 Minute candle period
Traits
Defines under what conditions one aggregation period is finished
Defines the needed methods for any online aggregator
Each component of a Candle must fullfill this trait
A modular candle that can be composed of multiple components
Functions
Apply an aggregator for all trades at once
Determine the candle volume which produces the same number of candles as the given time aggregation equivalent
Load trades from csv file
Derive Macros
The ‘Candle’ macro takes a named struct, that has multiple fields of type ‘CandleComponent’ to automatically generate a struct that implements the ‘ModularCandle’ trait, which means it can then be used in the aggregation process. It also exposes getter functions for each ‘CandleComponent’ for convenience.