poprawiono budowanie
This commit is contained in:
parent
7537f02177
commit
9bc85bc995
24
Makefile
Normal file
24
Makefile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
cpp=cl
|
||||||
|
link=link
|
||||||
|
|
||||||
|
cppflags=/EHsc /std:c++latest /nologo /O2
|
||||||
|
linkflags=/nologo
|
||||||
|
|
||||||
|
all: macd.exe tester.exe trainer.exe
|
||||||
|
|
||||||
|
.cpp.obj:
|
||||||
|
$(cpp) /c $(cppdebug) $(cppflags) $(cppvars) $*.cpp
|
||||||
|
|
||||||
|
macd.exe: macd.obj
|
||||||
|
$(link) $(ldebug) $(conflags) /out:macd.exe macd.obj $(conlibs)
|
||||||
|
|
||||||
|
tester.exe: tester.obj decider.obj
|
||||||
|
$(link) $(ldebug) $(conflags) /out:tester.exe $** $(conlibs)
|
||||||
|
|
||||||
|
trainer.exe: trainer.obj decider.obj
|
||||||
|
$(link) $(ldebug) $(conflags) /out:trainer.exe $** $(conlibs)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.lst
|
||||||
|
del *.exe
|
@ -115,8 +115,10 @@ private:
|
|||||||
vector<double, p> prices;
|
vector<double, p> prices;
|
||||||
vector<double, m+s> tech;
|
vector<double, m+s> tech;
|
||||||
|
|
||||||
|
// prices are normalized as percent change value
|
||||||
for (int j = 0; j < p; j++) {
|
for (int j = 0; j < p; j++) {
|
||||||
prices.set(j, 0, this->prices[j]);
|
auto diff = this->prices[j] - this->prices[j+1];
|
||||||
|
prices.set(j, 0, diff / this->prices[j+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -128,8 +130,6 @@ private:
|
|||||||
tech.set(i, 0, signal[j]);
|
tech.set(i, 0, signal[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prices are normalized in their domain
|
|
||||||
prices = normalize(prices);
|
|
||||||
// analytic data is normalized in its own domain
|
// analytic data is normalized in its own domain
|
||||||
tech = normalize(tech);
|
tech = normalize(tech);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ int main(int argc, const char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
} while(input_file >> price);
|
} while(input_file >> price);
|
||||||
std::cout << "Koniec: "
|
std::cout << "Koniec: "
|
||||||
<< money + stock*price << std::showpos << "("
|
<< money + stock*price << std::showpos << "("
|
||||||
<< (money + stock*price) / (start_money + start_stock*price)
|
<< (money + stock*price) / (start_money + start_stock*price)
|
||||||
<< ")";
|
<< ")";
|
||||||
|
@ -39,7 +39,10 @@ public:
|
|||||||
: factory(factory), id(0), generation(1), money(money), stock(stock), n(n), random_engine(std::time(0))
|
: factory(factory), id(0), generation(1), money(money), stock(stock), n(n), random_engine(std::time(0))
|
||||||
{
|
{
|
||||||
this->q = [=](std::shared_ptr<trained<T>> x, const dataset& input, double money, unsigned stock) {
|
this->q = [=](std::shared_ptr<trained<T>> x, const dataset& input, double money, unsigned stock) {
|
||||||
return (money + stock * input.back()) / (this->money + this->stock * input.front()); };
|
auto result = (money + stock * input.back()) / (this->money + this->stock * input.front());
|
||||||
|
|
||||||
|
return result / (1 + abs(result));
|
||||||
|
};
|
||||||
add(n);
|
add(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user