zoukankan      html  css  js  c++  java
  • 量化交易学习笔记(二)-实例化Cerebro引擎-代理已经手握一笔资金准备进行交易

    from __future__ import (absolute_import, division, print_function,
                            unicode_literals)
    #引入backtrader
    import backtrader as bt
    
    #实例化Cerebro引擎(Cerebro西班牙语中大脑的意思)
    cerebro = bt.Cerebro()
    #代理已经手握一笔资金准备进行交易
    cerebro.broker.setcash(100000.0)
    #打印输出结果
    print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
    #cerebro在数据上循环执行
    cerebro.run()
    #打印输出结果
    print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())
    

      输出结果:

    C:Python38python.exe F:/test/test/demo3.py
    Starting Portfolio Value: 100000.00
    Final Portfolio Value: 100000.00
    
    Process finished with exit code 0
    

      

     
  • 相关阅读:
    通过dockerfile制作nginx镜像
    docker存储卷
    docker容器网络配置
    状态模式
    抽象工厂模式
    观察者模式
    建造者模式
    外观模式
    模板方法模式
    原型模式
  • 原文地址:https://www.cnblogs.com/gzhbk/p/14885907.html
Copyright © 2011-2022 走看看