Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
saleh-mir committed Sep 14, 2024
1 parent ee2dd54 commit c3c9442
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ documentation is **short yet very informative**.

- [⚡️ Website](https://jesse.trade)
- [🎓 Documentation](https://docs.jesse.trade)
- [🛟 Help center](https://jesse.trade/help)
- [🎥 Youtube channel (screencast tutorials)](https://jesse.trade/youtube)
- [🛟 Help center](https://jesse.trade/help)
- [💬 Discord community](https://jesse.trade/discord)

## Screenshots
Expand All @@ -50,7 +50,47 @@ Here are a few screenshots just to get you excited:

**Example strategy code:**

![image](assets/screenshots/strategy.jpg)
```py
class SMACrossover(Strategy):
@property
def slow_sma(self):
return ta.sma(self.candles, 200)

@property
def fast_sma(self):
return ta.sma(self.candles, 50)

def should_long(self) -> bool:
# Fast SMA above Slow SMA
return self.fast_sma > self.slow_sma

def should_short(self) -> bool:
# Fast SMA below Slow SMA
return self.fast_sma < self.slow_sma

def should_cancel_entry(self) -> bool:
return False

def go_long(self):
# Open long position and use entire balance to buy
qty = utils.size_to_qty(self.balance, self.price, fee_rate=self.fee_rate)

self.buy = qty, self.price

def go_short(self):
# Open short position and use entire balance to sell
qty = utils.size_to_qty(self.balance, self.price, fee_rate=self.fee_rate)

self.sell = qty, self.price

def update_position(self):
# If there exist long position, but the signal shows Death Cross, then close the position, and vice versa.
if self.is_long and self.fast_sma < self.slow_sma:
self.liquidate()

if self.is_short and self.fast_sma > self.slow_sma:
self.liquidate()
```

**Live trading (requires [live plugin](https://docs.jesse.trade/docs/livetrade.html)):**

Expand Down

0 comments on commit c3c9442

Please sign in to comment.