mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-05 22:52:13 +08:00
Updated example strategies
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Enigma MPC, Inc.
|
||||
# Copyright 2015 Quantopian, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -80,21 +81,12 @@ def analyze(context=None, results=None):
|
||||
buys = trans.ix[
|
||||
[t[0]['amount'] > 0 for t in trans.transactions]
|
||||
]
|
||||
sells = trans.ix[
|
||||
[t[0]['amount'] < 0 for t in trans.transactions]
|
||||
]
|
||||
print 'buys:', buys.head()
|
||||
ax2.plot(
|
||||
buys.index, results.price[buys.index],
|
||||
buys.index,
|
||||
results.price[buys.index],
|
||||
'^',
|
||||
markersize=10,
|
||||
color='m',
|
||||
)
|
||||
ax2.plot(
|
||||
sells.index, results.price[sells.index],
|
||||
'v',
|
||||
markersize=10,
|
||||
color='k',
|
||||
color='g',
|
||||
)
|
||||
|
||||
ax3 = plt.subplot(513, sharex=ax1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2017 Enigma MPC, Inc.
|
||||
# Copyright 2014 Quantopian, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -128,14 +129,14 @@ def analyze(context=None, results=None):
|
||||
results.price[buys.index],
|
||||
'^',
|
||||
markersize=10,
|
||||
color='m',
|
||||
color='g',
|
||||
)
|
||||
ax2.plot(
|
||||
sells.index,
|
||||
results.price[sells.index],
|
||||
'v',
|
||||
markersize=10,
|
||||
color='k',
|
||||
color='r',
|
||||
)
|
||||
|
||||
ax3 = plt.subplot(513, sharex=ax1)
|
||||
|
||||
Reference in New Issue
Block a user