Skip to content

Instantly share code, notes, and snippets.

@qharlie
Created May 15, 2019 14:20
Show Gist options
  • Save qharlie/6c456a22e22d7fb84323700af8ca884c to your computer and use it in GitHub Desktop.
Save qharlie/6c456a22e22d7fb84323700af8ca884c to your computer and use it in GitHub Desktop.
import util.data as btu
from strategy import SMAStrategy
from joblib import Parallel, delayed
tickers = btu.get_nasdaq100()
def test_ticker(ticker):
cash = 100000
c = btu.run_backtest(SMAStrategy, ticker, '2019-05-01', '2019-05-14',cash)
percent_gain = ((c.broker.getvalue() - cash) / cash) * 100
print('Final Portfolio Value: {} for {} executing {} orders ( {}% )'.format(c.broker.getvalue(), ticker, len(c.broker.orders),percent_gain ))
Parallel(n_jobs=16)(delayed(test_ticker)(ticker) for ticker in tickers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment