Skip to content

Commit

Permalink
renaming repo
Browse files Browse the repository at this point in the history
  • Loading branch information
simongarisch committed Oct 19, 2020
1 parent eb70f64 commit 5cc542c
Show file tree
Hide file tree
Showing 2 changed files with 2,735 additions and 40 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ portfolio.broker = Broker(
All strategy classes must inherit from pxtrade.Strategy and implement a generate_trades method. Note that the trades returned can either be None, a trade instance or list or trades.

```python
import pxtrade as pt
from pxtrade import Strategy, Trade


class ExampleStrategy(pt.Strategy):
class ExampleStrategy(Strategy):
def generate_trades(self):
trades = list()

# get the portfolio trades first
if spy.price < 330:
trades.append(pt.Trade(portfolio, spy, +100))
trades.append(Trade(portfolio, spy, +100))

trades.append(pt.Trade(benchmark, spy, +1000))
trades.append(Trade(benchmark, spy, +1000))

return trades
```
Expand All @@ -109,9 +109,12 @@ class ExampleStrategy(pt.Strategy):
A backtest takes a strategy instance as its argument. Any instances of History then record state through time as events are processed.

```python
backtest = pt.Backtest(ExampleStrategy())
from pxtrade import Backtest, History

history = pt.History(

backtest = Backtest(ExampleStrategy())

history = History(
portfolios=[portfolio, benchmark],
backtest=backtest
)
Expand Down
Loading

0 comments on commit 5cc542c

Please sign in to comment.