(self, price, amount=-1)
| 213 | self.value = self.current_value(price) |
| 214 | |
| 215 | def sell(self, price, amount=-1): |
| 216 | |
| 217 | # evaluate sell position |
| 218 | eval_sell_postion = self.eval_sell_position() |
| 219 | |
| 220 | # predict sell position |
| 221 | sell_position = int(np.floor((1.0 * np.abs(amount / self.action_radius)) * eval_sell_postion)) |
| 222 | if sell_position == 0: |
| 223 | self.action = "HOLD" |
| 224 | else: |
| 225 | self.action = "SELL" |
| 226 | |
| 227 | self.cash += sell_position * price * (1 - self.transaction_cost_pct) |
| 228 | self.position -= sell_position |
| 229 | self.value = self.current_value(price) |
| 230 | |
| 231 | def hold_on(self, price, amount=0): |
| 232 | self.action = "HOLD" |
no test coverage detected