程序员理财 之Python量化交易系统(视频文件数据齐)

361 阅读3分钟

程序员理财 之Python量化交易系统(视频文件数据齐) Python量化交易系统

第1章学习的内容有如下这些:课程导学-开启量化交易的大门...cmL46679910如何搭建量化交易系统 、量化基础知识。


    @PostMapping("/log")
    public Imoocer avoidLog(List<Imoocer> imoocers) {

        // 1. 避免大数据量日志的打印
        log.info("args imoocer: [{}]", imoocers); // 这种方式并不好
        if (imoocers.size() > 10) {
            log.info("args imoocer count: [{}]", imoocers.size());
        }
(视频资源vx(cmL46679910))
        // 2. 避免在循环中打日志, 特别是大循环
        imoocers.forEach(i -> log.info("imoocer name is: [{}]", i.getName()));

        // 3. 不要打没有意义的日志
        File file = new File(imoocers.get(0).getName());
        if (!file.exists()) {
            log.warn("file does not exist!");   // 没有意义
            log.warn("file does not exist: [{}]", imoocers.get(0).getName());
        }

        // 4. 如果日志什么都说明不了, 修改或删除
        double sumSalary = 0.0;
        for (Imoocer imoocer : imoocers) {
            sumSalary += imoocer.getSalary();
        }

        log.info("all imoocers sum salary is: [{}], [{}]", imoocers.size(), sumSalary);

        return null;
    }
}

第2章 学习的内容有如下这些:本章节导学&学习计划、 什么是股票、获取股票数据的3种方式、使用JQData查询行情数据、


    private static void gc01() {

        byte[] x = new byte[1024 * 1024]; // 1024 * 1024 分配 1MB 空间
        x = new byte[1024 * 1024];
        x = new byte[1024 * 1024];
        x = null;

        byte[] y = new byte[2 * 1024 * 1024]; // 2 * 1024 * 1024 分配 2MB 空间
    }

    public static void main(String[] args) {

        gc01();
    }
}

第3章 学习的内容有如下这些:


    private static void minorGC() throws InterruptedException {

        byte[] x = new byte[1024 * 1024];   // 在 Eden 区域放入一个 1MB 的对象
        x = new byte[1024 * 1024];
        x = new byte[1024 * 1024];  // 会导致前两个 1MB 的对象成为垃圾对象
        x = null;   // 将之前的三个 1MB 的对象都变成垃圾对象

        // 这句代码就会触发年轻代的 Young GC
        byte[] y = new byte[2 * 1024 * 1024];   // 在 Eden 区中分配一个 2MB 的对象

        Thread.sleep(1000);
    }

    public static void main(String[] args) throws InterruptedException {

        while (true) {
            minorGC();
        }
    }
}

股票交易快速入门、使用shift函数计算涨跌幅、模拟股票交易:买入、卖出信号、模拟股票交易:计算持仓收益 、Debug:解决CopyWarning问题、模拟股票交易:计算累计收益、比较3只股票的累计收益率......

image.png 第4章 学习的内容有如下这:数据准备:本地化股票数据、数据准备:从本地读取数据、什么是均线策略、双均线策略:生成交易信号、双均线策略:计算信号收益率、计算并比较所有A股的策略收益、什么是假设检验......

            new ScheduledThreadPoolExecutor(50,
                    new ThreadPoolExecutor.DiscardOldestPolicy());

    private static void processImoocers(List<Imoocer> imoocers) {
        imoocers.forEach(i -> executor.scheduleWithFixedDelay(
                i::func, 2, 3, TimeUnit.SECONDS
        ));
    }

    private static List<Imoocer> getAllImoocer(int count) {

        List<Imoocer> imoocers = new ArrayList<>(count);

        for (int i = 0; i != count; ++i) {
            imoocers.add(new Imoocer());
        }

        return imoocers;
    }

    public static void main(String[] args) throws InterruptedException {

        executor.setMaximumPoolSize(50);

        while (true) {
            processImoocers(getAllImoocer(100));
            Thread.sleep(100);
        }
    }
}

第5章学习的内容有如下这些:什么是动量策略、动量策略:筛选股票池、动量策略:计算动量因子、动量策略:生成交易信号。


    public static void main(String[] args) {

        // 打印所有的 Java 系统属性
        Properties pros = System.getProperties();
        pros.list(System.out);
(视频资源vx(cmL46679910))
        System.out.println("//////////////////////////////////////////////////////////////////");

        // 获取特定的 Java 系统属性, key 不存在则返回 null
        System.out.println(System.getProperty("java.home"));        // JRE 主目录
        System.out.println(System.getProperty("java.library.path"));        // 用于搜索本机库的 JRE 库搜索路径
        System.out.println(System.getProperty("java.ext.dirs"));        // JRE扩展库路径
        System.out.println(System.getProperty("java.class.path"));      // JRE类路径
        System.out.println(System.getProperty("java.version"));     // Java 版本
        System.out.println(System.getProperty("imooc-qinyi"));
    }
}

第6章 学习的内容有如下这些: 有哪些常用的数据回测框、为什么回测与实盘有差异、初始化PyAlgoTrade开发环境、、、

第7章学习的内容有如下这些: 如何实现程序化交易...双均线择时策略。

            new BasicThreadFactory.Builder().namingPattern("Imooc-Qinyi-%d").build()
    );

    private final StringRedisTemplate redisTemplate;

    public InsufficientResourceController(StringRedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @GetMapping("/{batch}")
    public DeferredResult<String> resource(@PathVariable int batch) {
(视频资源vx(cmL46679910))
        DeferredResult<String> result = new DeferredResult<>(10 * 1000L,
                "timeout");
        CompletableFuture[] futures = new CompletableFuture[batch];

        for (int i = 0; i != batch; ++i) {
            futures[i] = CompletableFuture.supplyAsync(this::getValue, es);
        }

        CompletableFuture.allOf(futures).thenRun(() -> result.setResult("success"));

        return result;
    }

    private String getValue() {

        try {
            return redisTemplate.execute((RedisCallback<String>) connection -> {
                sleep(5000);
                return "qinyi-" + connection;
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        return "error";
    }

    private void sleep(long millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
}

第8章学习的内容有如下这些:什么是多因子模型 cmL46679910。。。