gzhbk
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:\Python38\python.exe F:/test/test/demo3.py
Starting Portfolio Value: 100000.00
Final Portfolio Value: 100000.00

Process finished with exit code 0

  

 

分类:

技术点:

相关文章:

  • 2021-05-11
  • 2021-09-07
  • 2021-10-30
  • 2021-12-28
猜你喜欢
  • 2021-11-12
  • 2021-12-23
  • 2021-06-19
  • 2021-10-31
  • 2021-12-23
  • 2021-06-28
  • 2022-01-19
相关资源
相似解决方案