Skip to content

Instantly share code, notes, and snippets.

View saleh-old's full-sized avatar

Saleh O saleh-old

View GitHub Profile
@saleh-old
saleh-old / jesse-ubuntu.bash
Last active July 31, 2019 06:41
installation commands for Jesse 2.0 on Ubuntu 18.04
# initital update
sudo apt -y update
sudo apt-get -y upgrade
# create new user
adduser jesse
adduser jesse sudo
# close the terminal and login with jesse:
ssh-jesse
https://coderwall.com/p/ds2dha/word-line-deletion-and-navigation-shortcuts-in-iterm2
and
https://stackoverflow.com/a/48002681/11126038
@saleh-old
saleh-old / format-flash-man.sh
Created December 31, 2019 15:47
Fix a flash dirve formatted for Ubuntu/macOS installer on mac
# find the device name by listing all external volumes
diskutil list external
# format it
sudo diskutil eraseDisk FAT32 UPPERCASE-NAME FULL_DEVICE_ADDRESS
# example
diskutil eraseDisk FAT32 SULLY /dev/disk3
brew install unrar
from jesse.strategies import Strategy
import jesse.indicators as ta
from jesse import utils
class SampleTrendFollowing(Strategy):
def should_long(self) -> bool:
return False
def should_short(self) -> bool:
@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 go_long(self):
entry = self.price
stop = entry - 3*self.atr
qty = utils.risk_to_qty(self.capital, 3, entry, stop, fee_rate=self.fee_rate)
profit_target = entry + 5*self.atr
self.buy = qty, entry
self.stop_loss = qty, stop
self.take_profit = qty, profit_target
# trading routes
routes = [
('Bitfinex', 'BTCUSD', '6h', 'SampleTrendFollowing'),
]