This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <string> | |
#include <vector> | |
#include <ctime> | |
#include <cstdlib> | |
#include <iostream> | |
#include "kdtree.h" | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "kdtree.h" | |
#include <iostream> | |
// コンストラクタ | |
KDTree::KDTree() | |
{ | |
build_index({}); | |
} | |
// コンストラクタ | |
KDTree::KDTree(const vector<PointCloud_Point>& pts) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <memory> | |
#include <unordered_map> | |
#include "pointcloud.h" | |
#include "nanoflann.hpp" | |
using namespace std; | |
using namespace nanoflann; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct PointCloud_Point | |
{ | |
size_t id; | |
double x, y; | |
PointCloud_Point() :id(0), x(0.0), y(0.0) {}; | |
PointCloud_Point(const size_t id, const double x, const double y) : id(id), x(x), y(y) {}; | |
PointCloud_Point(const PointCloud_Point& pt) :id(pt.id), x(pt.x), y(pt.y) {}; | |
}; | |
struct PointCloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib.pylab import figure, plot, title, xlabel, ylabel, xlim,show | |
import numpy as np | |
from pprint import pprint | |
import math | |
from onlineregression import OnlineRegression | |
def draw_plot(arr_x,arr_y,plot_title): | |
plot(arr_x,arr_y,'bo-') | |
title(plot_title) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# データ | |
arr_x=[0, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12] | |
arr_y=[20,25,40,35,50,40,35,30,25,30,45,40,50] | |
sz=len(arr_x) | |
# グラフを格納する辞書 | |
data=dict() | |
# インデックス |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import math | |
class OnlineRegression(): | |
def __init__(self): | |
self.n=0 | |
self.x=0.0 | |
self.y=0.0 | |
self.xx=0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data; | |
$arr=array( | |
0,0.3987527,-0.8932547,0.1768298,-1.675824,-2.837438,-2.355524,-1.252398,-2.899442,-2.419981,-2.091308,-2.10021,-2.714076,-3.625284,-3.592246,-2.441939,-3.843519,-4.990552,-3.515711,-4.657077,-7.364385,-7.658229,-7.499073,-7.562957,-8.481097,-8.252456,-8.464059,-7.580894,-7.210767,-6.445776,-6.008003,-5.500024,-4.63942,-6.790132,-6.419145,-7.802707,-7.596067,-6.33891,-6.690298,-7.485143,-7.644236,-6.111133,-5.882926,-5.647768,-6.127489,-6.66978,-6.871189,-8.511509,-7.466892,-7.792628,-9.821345,-10.05553,-10.42828,-12.32344,-10.51485,-11.57175,-13.00084,-12.73021,-11.76026,-11.89079,-11.64385,-12.71155,-11.84579,-11.49114,-11.33376,-10.54172,-9.44159,-10.01351,-9.509508,-10.437,-8.269219,-7.62659,-7.505197,-7.904896,-8.12006,-9.240085,-9.298025,-8.780998,-9.275904,-10.12872,-11.86345,-11.52073,-11.26576,-11.491,-12.07157,-11.88601,-13.27906,-14.90004,-16.58147,-17.229,-16.64617,-15.97717,-16.49825,-15.11031,-16.1323,-16.66544,-17.47197,-17.43013,-19.23583,-18.25882,-17.05801,-15.96338 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EWMAC Trading /////////////////// | |
#include <profile.c> | |
function run() | |
{ | |
//+----------------------------------------------+ | |
//| Settings | | |
//+----------------------------------------------+ | |
// simulation period 2010-2016 | |
StartDate = 2010; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
This file shows how to calculate the EWMAC trading rule for crude oil futures | |
As in chapter 7 / appendix B of "Systematic Trading" by Robert Carver (www.systematictrading.org) | |
Required: pandas, matplotlib | |
USE AT YOUR OWN RISK! No warranty is provided or implied. |
NewerOlder