remove slow unnecessary table scan
This commit is contained in:
parent
a071571eac
commit
a28ffcbcf7
@ -78,15 +78,13 @@ def get_sell_trade_entry(pair, row, buy_subset, ticker, trade_count_lock, args):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# calculate win/lose forwards from buy point
|
# calculate win/lose forwards from buy point
|
||||||
sell_subset = ticker[ticker.index > row.Index][['close', 'sell']]
|
sell_subset = ticker[ticker.index > row.Index][['close', 'sell', 'buy']]
|
||||||
for row2 in sell_subset.itertuples(index=True):
|
for row2 in sell_subset.itertuples(index=True):
|
||||||
if max_open_trades > 0:
|
if max_open_trades > 0:
|
||||||
# Increase trade_count_lock for every iteration
|
# Increase trade_count_lock for every iteration
|
||||||
trade_count_lock[row2.Index] = trade_count_lock.get(row2.Index, 0) + 1
|
trade_count_lock[row2.Index] = trade_count_lock.get(row2.Index, 0) + 1
|
||||||
|
|
||||||
# Buy is on is in the buy_subset there is a row that matches the date
|
buy_signal = row2.buy
|
||||||
# of the sell event
|
|
||||||
buy_signal = (buy_subset.index == row2.Index).any()
|
|
||||||
if(should_sell(trade, row2.close, row2.Index, buy_signal, row2.sell)):
|
if(should_sell(trade, row2.close, row2.Index, buy_signal, row2.sell)):
|
||||||
return row2, (pair,
|
return row2, (pair,
|
||||||
trade.calc_profit_percent(rate=row2.close),
|
trade.calc_profit_percent(rate=row2.close),
|
||||||
|
Loading…
Reference in New Issue
Block a user