This file contains hidden or 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 array | |
| import random | |
| import json | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from math import sqrt |
This file contains hidden or 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 numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from tradingrrl import TradingRRL | |
| def main(): | |
| fname = "../data/USDJPY30.csv" |
This file contains hidden or 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
| import random | |
| import numpy | |
| from deap import algorithms | |
| from deap import base | |
| from deap import creator | |
| from deap import tools | |
| creator.create("FitnessMax", base.Fitness, weights=(1.0,)) | |
| creator.create("Individual", numpy.ndarray, fitness=creator.FitnessMax) |
This file contains hidden or 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
| import random | |
| import numpy | |
| from deap import algorithms | |
| from deap import base | |
| from deap import creator | |
| from deap import tools | |
| creator.create("FitnessMax", base.Fitness, weights=(1.0,)) | |
| creator.create("Individual", numpy.ndarray, fitness=creator.FitnessMax) |
This file contains hidden or 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
| import random | |
| from deap import base | |
| from deap import creator | |
| from deap import tools | |
| creator.create("FitnessMax", base.Fitness, weights=(1.0,)) | |
| creator.create("Individual", list, fitness=creator.FitnessMax) | |
| toolbox = base.Toolbox() |
This file contains hidden or 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
| import random | |
| import numpy as np | |
| from operator import attrgetter | |
| def main(): | |
| n_gene = 100 # The number of genes. | |
| n_ind = 300 # The number of individuals in a population. | |
| CXPB = 0.5 # The probability of crossover. | |
| MUTPB = 0.2 # The probability of individdual mutation. | |
| MUTINDPB = 0.05 # The probability of gene mutation. |
This file contains hidden or 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
| //+------------------------------------------------------------------+ | |
| //| tradingrrl.mq4 | | |
| //| Copyright 2014, MetaQuotes Software Corp. | | |
| //| http://www.mql5.com | | |
| //+------------------------------------------------------------------+ | |
| #property copyright "Copyright 2014, MetaQuotes Software Corp." | |
| #property link "http://www.mql5.com" | |
| #property version "1.03" | |
| #property strict |
This file contains hidden or 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
| import time | |
| import py_test_sum | |
| import cy_test_sum | |
| import cpp_test_sum | |
| n_iter = 10000000 | |
| #--- Python sum | |
| py_ts = py_test_sum.TestSum(n_iter) |
This file contains hidden or 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 distutils.core import setup | |
| from distutils.extension import Extension | |
| from Cython.Distutils import build_ext | |
| from Cython.Build import cythonize | |
| setup( | |
| name = "cpp_test_sum", | |
| ext_modules = cythonize( | |
| Extension("cpp_test_sum", | |
| sources=["cpp_test_sum.pyx", "cpp_test_sum_.cpp"], |
This file contains hidden or 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 libcpp.vector cimport vector | |
| cdef extern from "cpp_test_sum_.h" namespace "cpp_test_sum": | |
| cdef cppclass cppTestSum: | |
| cppTestSum(int n_iter) except + | |
| int n_iter | |
| vector[double] sum | |
| void calc_sum() |