示例#1
0
from utils import read_stock_market_data
from evaluating.portfolio_evaluator import PortfolioEvaluator
from model.CompanyEnum import CompanyEnum
from dependency_injection_containers import Traders
import datetime
from definitions import PERIOD_1, PERIOD_2

if __name__ == "__main__":
    # Load stock market data for training and testing period
    stock_market_data = read_stock_market_data(
        [CompanyEnum.COMPANY_A, CompanyEnum.COMPANY_B], [PERIOD_1, PERIOD_2])

    # Define portfolio-name/trader mappings
    portfolio_name_trader_mappings = [
        # Benchmark trader
        ('Buy-and-hold Trader', Traders.BuyAndHoldTrader()),

        # Simple traders
        ('Simple Trader (perfect prediction)',
         Traders.SimpleTrader_with_perfect_prediction()),
        ('Simple Trader (NN binary perfect prediction)',
         Traders.SimpleTrader_with_nn_binary_perfect_prediction()),
        ('Simple Trader (NN binary prediction)',
         Traders.SimpleTrader_with_nn_binary_prediction()),

        # Deep Q-Learning traders
        ('DQL Trader (perfect prediction)',
         Traders.DqlTrader_with_perfect_prediction()),
        ('DQL Trader (NN binary perfect prediction)',
         Traders.DqlTrader_with_nn_binary_perfect_prediction()),
        ('DQL Trader (NN binary prediction)',
示例#2
0
from utils import read_stock_market_data
from evaluating.portfolio_evaluator import PortfolioEvaluator
from model.CompanyEnum import CompanyEnum
from dependency_injection_containers import Traders
import datetime
from definitions import PERIOD_1, PERIOD_2

if __name__ == "__main__":
    # Load stock market data for training and testing period
    stock_market_data = read_stock_market_data(
        [CompanyEnum.COMPANY_A, CompanyEnum.COMPANY_B], [PERIOD_1, PERIOD_2])

    # Define portfolio-name/trader mappings
    portfolio_name_trader_mappings = [
        # Benchmark trader
        ('Buy-and-hold Trader', Traders.BuyAndHoldTrader(), 'chartreuse'),

        # Simple traders
        ('Simple Trader (perfect prediction)',
         Traders.SimpleTrader_with_perfect_prediction(), 'pink'),
        ('Simple Trader (NN binary perfect prediction)',
         Traders.SimpleTrader_with_nn_binary_perfect_prediction(), 'yellow'),
        ('Simple Trader (NN binary prediction)',
         Traders.SimpleTrader_with_nn_binary_prediction(), 'brown'),

        # Deep Q-Learning traders
        ('DQL Trader (perfect prediction)',
         Traders.DqlTrader_with_perfect_prediction(), 'gray'),
        ('DQL Trader (NN binary perfect prediction)',
         Traders.DqlTrader_with_nn_binary_perfect_prediction(), 'magenta'),
        ('DQL Trader (NN binary prediction)',