Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
add basics
Browse files Browse the repository at this point in the history
  • Loading branch information
CelestialCrafter committed Dec 1, 2023
1 parent 9061dc2 commit 3e1e818
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from __future__ import (absolute_import, division, print_function, unicode_literals)
from datetime import datetime

import backtrader as bt

if __name__ == '__main__':
cerebro = bt.Cerebro()

data = bt.feeds.YahooFinanceData(dataname='MSFT', fromdate=datetime(2011, 1, 1), todate=datetime(2012, 12, 31))

cerebro.adddata(data)
cerebro.broker.setcash(1000)

print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())

cerebro.run()

print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())

0 comments on commit 3e1e818

Please sign in to comment.