-
Notifications
You must be signed in to change notification settings - Fork 3
/
PriceHistory.h
34 lines (29 loc) · 1.26 KB
/
PriceHistory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef PRICEHISTORY_H
#define PRICEHISTORY_H
#include "PriceCandle.h"
enum PriceCandlePeriod : uint8_t {
smallest = 0,
minutely = 1,
hourly = 2,
daily = 3
};
class PriceHistory : public PriceCandle{
public :
PriceHistory(size_t size = 60);
virtual ~PriceHistory();
size_t virtual addData(const PriceData& newData) override;
size_t virtual addData(uint32_t timestamp, float closePrice) override;
const PriceData& getRecentDataInPeriod(PriceCandlePeriod period) const;
const PriceData* getDataInPeriod(PriceCandlePeriod period, size_t index = 0) const;
size_t getValidDataCountInPeriod(PriceCandlePeriod period) const;
size_t getMaxDataCountInPeriod(PriceCandlePeriod period) const;
float getHistoryMaxValueInPeriod(PriceCandlePeriod period) const;
float getHistoryMinValueInPeriod(PriceCandlePeriod period) const;
const PriceData& getOldestDataInPeriod(PriceCandlePeriod period) const;
float getPeriodDiffInPeriod(PriceCandlePeriod period) const;
float getLastUpdateDiffInPeriod(PriceCandlePeriod period) const;
uint32_t getPeriodSecsInPeriod(PriceCandlePeriod period) const;
protected:
PriceCandle* candles;
};
#endif