mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-15 11:22:18 +08:00
DOC: fix import and support python3 for beginner tutorial
The beginner tutorial Dual Moving Average example attempted to import extract_transactions from the wrong location. The tutorial and corresponding example also would fail using python3 due to indexing the view object returned via context.exchange.values()
This commit is contained in:
@@ -84,7 +84,8 @@ def handle_data(context, data):
|
||||
def analyze(context, perf):
|
||||
|
||||
# Get the base_currency that was passed as a parameter to the simulation
|
||||
base_currency = context.exchanges.values()[0].base_currency.upper()
|
||||
exchange = list(context.exchanges.values())[0]
|
||||
base_currency = exchange.base_currency.upper()
|
||||
|
||||
# First chart: Plot portfolio value using base_currency
|
||||
ax1 = plt.subplot(411)
|
||||
|
||||
@@ -589,7 +589,7 @@ the ``examples`` directory:
|
||||
from catalyst import run_algorithm
|
||||
from catalyst.api import (order, record, symbol, order_target_percent,
|
||||
get_open_orders)
|
||||
from catalyst.exchange.stats_utils import extract_transactions
|
||||
from catalyst.exchange.utils.stats_utils import extract_transactions
|
||||
|
||||
NAMESPACE = 'dual_moving_average'
|
||||
log = Logger(NAMESPACE)
|
||||
@@ -660,7 +660,8 @@ the ``examples`` directory:
|
||||
def analyze(context, perf):
|
||||
|
||||
# Get the base_currency that was passed as a parameter to the simulation
|
||||
base_currency = context.exchanges.values()[0].base_currency.upper()
|
||||
exchange = list(context.exchanges.values())[0]
|
||||
base_currency = exchange.base_currency.upper()
|
||||
|
||||
# First chart: Plot portfolio value using base_currency
|
||||
ax1 = plt.subplot(411)
|
||||
|
||||
Reference in New Issue
Block a user