-
Notifications
You must be signed in to change notification settings - Fork 156
/
StatsInSlidingWindow.cpp
43 lines (35 loc) · 1.73 KB
/
StatsInSlidingWindow.cpp
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
35
36
37
38
39
40
41
42
43
/************************************************************************
* Copyright(c) 2010, One Unified. All rights reserved. *
* email: [email protected] *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
#include "stdafx.h"
#include "StatsInSlidingWindow.h"
namespace ou { // One Unified
namespace tf { // TradeFrame
TradeStats::TradeStats( std::string sName, unsigned int WindowSizeSeconds, unsigned int WindowSizeCount ):
StatsInSlidingWindow( sName, WindowSizeSeconds, WindowSizeCount ) {
}
TradeStats::~TradeStats() {
}
Trade* TradeStats::Add(boost::posix_time::ptime dt, Trade *trade) {
StatsInSlidingWindow::Add( dt, trade->Price() );
SlidingWindow::Add( dt, trade );
return trade;
}
Trade* TradeStats::Remove() {
Trade* trade = SlidingWindow::Remove();
// what is stored in the removal, does dt need to come from trade?
StatsInSlidingWindow::Remove( trade->DateTime(), trade->Price() );
return trade;
}
} // namespace tf
} // namespace ou