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
    

      

     
  • 相关阅读:
    全民医疗
    SpringMVC
    Mybatis 缓存策略
    不要追涨杀跌
    我只认比特币
    ETH反思
    世界是熵增的
    切片最好还是传引用
    rxgo示例
    11月份的计划
  • 原文地址:https://www.cnblogs.com/gzhbk/p/14885907.html
Copyright © 2011-2022 走看看