2 years ago I started learning Python just so that I can create my own Bitcoin trading framework. Now I'm open sourcing it, I hope you guys like it too

https://github.com/jesse-ai/jesse

I know many of you are already familiar with other projects such as Gekko and Freqtrade, etc and would like to know why I started Jesse instead of using them. So here are a few reasons:

  • Simple syntax for defining strategies. I have years of experience and a deep understanding of frameworks such as Laravel and Vuejs which are popular for their simplicity. I designed Jesse the same way. So #1 thing that you'll like about Jesse is how easy it makes it for you turn a strategy idea into actual code.
  • Support for using multiple timeframes and symbols in a single strategy. I haven't seen any other project that can offer this without the look-ahead bias. Jesse does that.
  • Trading more than one pair at the same time. Jesse allows doing this. I designed it using Routes, which is a concept borrowed from web development.
  • It is accurate. This part was a real pain. I did it tho. Through hundreds of unit tests.
  • Provides tools for getting and manipulating data in Jupyter notebooks.

Example Strategy

Here is an example of a profitable strategy that shows the usage of TA and the syntax of the framework:

from jesse.strategies import Strategy import jesse.indicators as ta from jesse import utils class SampleTrendFollowing(Strategy): @property def long_ema(self): return ta.ema(self.candles, 50) @property def short_ema(self): return ta.ema(self.candles, 21) @property def atr(self): return ta.atr(self.candles) def should_long(self) -> bool: return self.short_ema > self.long_ema def should_short(self) -> bool: return self.short_ema < self.long_ema def should_cancel(self) -> bool: return True def go_long(self): entry = self.price stop = entry - 3*self.atr qty = utils.risk_to_qty(self.capital, 3, entry, stop) profit_target = entry + 5*self.atr self.buy = qty, entry self.stop_loss = qty, stop self.take_profit = qty, profit_target def go_short(self): entry = self.price stop = entry + 3 * self.atr qty = utils.risk_to_qty(self.capital, 3, entry, stop) profit_target = entry - 5 * self.atr self.sell = qty, entry self.stop_loss = qty, stop self.take_profit = qty, profit_target 

And here is the backtested results:

 CANDLES | ----------------------+-------------------------- period | 365 days (12.17 months) starting-ending date | 2019-01-01 => 2020-01-01 exchange | symbol | timeframe | strategy | DNA ------------+----------+-------------+----------------------+------- Bitfinex | BTCUSD | 6h | SampleTrendFollowing | Executing simulation... [####################################] 100% Executed backtest simulation in: 22.61 seconds METRICS | ---------------------------------+------------------------------------- Total Closed Trades | 24 Total Net Profit | 3991.39 (39.91%) Starting => Finishing Balance | 10000 => 14063.47 Total Open Trades | 1 Open PL | 97.15 Total Paid Fees | 498.22 Max Drawdown | -15.9% Sharpe Ratio | 1.18 Annual Return | 26.46% Expectancy | 166.31 (1.66%) Avg Win | Avg Loss | 558.76 | 383.12 Ratio Avg Win / Avg Loss | 1.46 Percent Profitable | 58% Longs | Shorts | 67% | 33% Avg Holding Time | 2.0 weeks, 12.0 hours, 53.0 minutes Winning Trades Avg Holding Time | 1.0 week, 4.0 days, 6.0 hours Losing Trades Avg Holding Time | 2.0 weeks, 5.0 days, 2.0 hours 

Above example was just an example! Please don't compare it to hodling; or you know, do it! It'll be fun.

This project took me ~2 years. I did it for my own trading needs and I am very happy with the results. Now that I'm releasing it to the public, I hope you guys like it too.

Cheers



Submitted June 30, 2020 at 05:40PM by Melisanjb https://ift.tt/31vY7Cw

Comments

Popular posts from this blog

No, Bitcoin is not controlled by a small group of investors and miners (A rebuttal to the TechSpot article)

Day 9: I will post this guide regularly until available solutions like SegWit, order batching, and Lightning payment channels are mass adopted, the mempool is empty once again, and tx fees are low. Have you done your part?