BUG: fixes for issues #204 #237

-modified parameters for cancel_orders
-update portfolio after any change in
 the orders before sync
This commit is contained in:
AvishaiW
2018-02-23 00:38:51 +02:00
parent 8fe3ab344e
commit b4bd557273
4 changed files with 29 additions and 14 deletions
+3 -4
View File
@@ -4,8 +4,7 @@ import pandas as pd
from logbook import Logger
from catalyst import run_algorithm
from catalyst.api import (record, symbol, order_target_percent,
get_open_orders)
from catalyst.api import (record, symbol, order_target_percent,)
from catalyst.exchange.utils.stats_utils import extract_transactions
NAMESPACE = 'dual_moving_average'
@@ -21,7 +20,7 @@ def initialize(context):
def handle_data(context, data):
# define the windows for the moving averages
short_window = 2
long_window = 3
long_window = 5
# Skip as many bars as long_window to properly compute the average
context.i += 1
@@ -63,7 +62,7 @@ def handle_data(context, data):
# Since we are using limit orders, some orders may not execute immediately
# we wait until all orders are executed before considering more trades.
orders = get_open_orders(context.asset)
orders = context.blotter.open_orders
if len(orders) > 0:
return