程序員理財 之Python量化交易系統(視頻文件數據齊)


 Python量化交易系統


  第1章學習的內容有以下這些:課程導學-開啓量化交易的大門、java

public class PrintGCLog {

    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();
    }
}

什麼是量化? 、經常使用的股票量化指標(上):技術面 、經常使用的股票量化指標(下):基本面 、 量化投資發展史、如何搭建量化交易系統 、量化基礎知識、 本章小結與重點知識複習 。redis


  第2章 學習的內容有以下這些:本章節導學&學習計劃、(視頻資源vxcmL46679910)) 什麼是股票、獲取股票數據的3種方式、使用JQData查詢行情數據、使用resample函數轉化時間序列、resample函數的應用、使用JQData查詢財務指標、數據庫

public class MoreMinorGC {

    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();
        }
    }
}

使用JQData查詢估值指標 、使用財務數據計算估值指標、實時更新股票數據 、建立你的股票數據庫。app


第3章 學習的內容有以下這些:股票交易快速入門、使用shift函數計算漲跌幅、模擬股票交易:買入、賣出信號、模擬股票交易:計算持倉收益 、Debug:解決CopyWarning問題、模擬股票交易:計算累計收益......ide

watermark,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=
第4章 學習的內容有以下這:數據準備:本地化股票數據、數據準備:從本地讀取數據、什麼是均線策略、雙均線策略:生成交易信號、雙均線策略:計算信號收益率、計算並比較全部A股的策略收益、什麼是假設檢驗、(視頻資源vx(cmL46679910))雙均線策略:利用p值檢驗可靠性、雙均線策略:尋找最優參、雙均線策略:尋找最優參數、嘗試建立基於布林道的擇時策略、總結。 函數

private static final ScheduledThreadPoolExecutor executor =
            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章學習的內容有以下這些:什麼是動量策略、動量策略:篩選股票池、動量策略:計算動量因子、動量策略:生成交易信號、動量策略:計算組合收益率(等權重)、實現反向動量策略、打印策略評估指標、(視頻資源vx(cmL46679910))調整投資組合權重 、構建ETF動量策略。學習

public class NeedAvoidLog {

    @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());
        }

        // 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;
    }
}

第6章 學習的內容有以下這些: 有哪些經常使用的數據回測框、爲何回測與實盤有差別、初始化PyAlgoTrade開發環境、定義數據與策略、PyAlgoTrade:模擬交易與回測、PyAlgoTrade:交易信號可視化、PyAlgoTrade回測雙均線策略、PyAlgoTrade回測MACD指標、PyAlgoTrade回測BOLL指標。大數據

public class JavaSystemProperties {

    public static void main(String[] args) {

        // 打印全部的 Java 系統屬性
        Properties pros = System.getProperties();
        pros.list(System.out);

        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"));
    }
}


第7章學習的內容有以下這些: 如何實現程序化交易、初始化EasyTrader開發環境、認識EasyTrader基本函數、模擬實盤:雙均線擇時策略。優化

private final ExecutorService es = Executors.newCachedThreadPool(
            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) {

        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章學習的內容有以下這些:什麼是多因子模型 、vx(cmL46679910)關於文檔說明和項目優化、如何獲取更多策略 、 課程總結。ui

點擊

相關文章
相關標籤/搜索