Skip to content

Commit

Permalink
modif after running additional strategies in Q2
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed May 16, 2016
1 parent cdbaf28 commit ceea5ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion skeleton/TradingSystemArchitecture/OrderManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def send_order_through(self, data, instrument, dollar_value=0, style=MarketOrder
MarketOrder()
LimitOrder()
'''
nb_shares = int(np.floor(dollar_value /float(data[instrument].price) ))
# nb_shares = int(np.floor(dollar_value /float(data[instrument].price) ))
nb_shares = int(np.floor(dollar_value /float(data.current(instrument,'price')) ))
order(instrument, nb_shares, style=style)
return

Expand Down
3 changes: 2 additions & 1 deletion skeleton/TradingSystemArchitecture/StrategyDesign.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def _send_percent_order (self, data, pct):
# update desired strategy targeted allocation
self.portfolio.assets[inst] = dollar_value

current_value = self.context.portfolio.positions[inst].amount *data[inst].price
# current_value = self.context.portfolio.positions[inst].amount *data[inst].price
current_value = self.context.portfolio.positions[inst].amount *data.current(inst, 'price')
tgt_dollar_value = self.portfolio.assets[inst] - current_value
target_dollar_value = merge_dicts(target_dollar_value, {inst:tgt_dollar_value})

Expand Down
3 changes: 2 additions & 1 deletion skeleton/generic_modules/live_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def get_cagr(context, data):

cagr = np.power(current_value/initial_value, 1/float(context.cagr_period/12) )-1

print( '['+str(data.items()[0][1].datetime.year) +'-'+str(data.items()[0][1].datetime.month)+'] > CAGR = ' +str(cagr))
# print( '['+str(data.items()[0][1].datetime.year) +'-'+str(data.items()[0][1].datetime.month)+'] > CAGR = ' +str(cagr))
print( '['+str(get_datetime().date().year) +'-'+str(get_datetime().date().month)+'] > CAGR = ' +str(cagr))
return

0 comments on commit ceea5ad

Please sign in to comment.