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
    

      

     
  • 相关阅读:
    一步一步本地化部署mapbox-gl
    快速排序
    合并排序
    冒泡排序
    选择排序
    插入排序
    mapbox-gl象形文字字体glyph生成
    前端html
    Mysql练习
    Mysql语句
  • 原文地址:https://www.cnblogs.com/gzhbk/p/14885907.html
Copyright © 2011-2022 走看看