Skip to content

Instantly share code, notes, and snippets.

@dev4Fun
Created May 15, 2018 02:48
Show Gist options
  • Save dev4Fun/42657f4253a85de05e9ba9c0a32a1044 to your computer and use it in GitHub Desktop.
Save dev4Fun/42657f4253a85de05e9ba9c0a32a1044 to your computer and use it in GitHub Desktop.
from fasttrade.model.trade import TradeDetails
class ShortTrade(TradeDetails):
def __init__(self, start_price: float, symbol: str, amount: float, percent_change: float = 0.5,
currency: str = "USD") -> None:
super().__init__(start_price, symbol, amount, currency)
self.end_price = start_price * (1 - percent_change / 100)
@property
def exit_price(self):
return self.end_price
def __str__(self) -> str:
return "Short " + super().__str__()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment