-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
76 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from roboquant.journals.journal import Journal | ||
from roboquant.journals.alphabeta import AlphaBeta | ||
from roboquant.journals.basicjournal import BasicJournal | ||
from roboquant.journals.tensorboardjournal import TensorboardJournal | ||
from roboquant.journals.runmetric import RunMetric | ||
from roboquant.journals.equitymetric import EquityMetric | ||
from roboquant.journals.metric import Metric | ||
from roboquant.journals.feedmetric import FeedMetric | ||
from roboquant.journals.pricemetric import PriceItemMetric |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
roboquant/trackers/basictracker.py → roboquant/journals/basicjournal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
roboquant/trackers/equitymetric.py → roboquant/journals/equitymetric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
roboquant/trackers/feedmetric.py → roboquant/journals/feedmetric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
roboquant/trackers/metricstracker.py → roboquant/journals/metricsjournal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
roboquant/trackers/pricemetric.py → roboquant/journals/pricemetric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
roboquant/trackers/runmetric.py → roboquant/journals/runmetric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
roboquant/trackers/tensorboardtracker.py → roboquant/journals/tensorboardjournal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from cProfile import Profile | ||
import os | ||
from pstats import Stats, SortKey | ||
import roboquant as rq | ||
|
||
from roboquant import Roboquant, CSVFeed, BasicTracker, EMACrossover | ||
|
||
if __name__ == "__main__": | ||
path = os.path.expanduser("~/data/nasdaq_stocks/1") | ||
feed = CSVFeed.stooq_us_daily(path) | ||
feed = rq.feeds.CSVFeed.stooq_us_daily(path) | ||
print("timeframe =", feed.timeframe(), " symbols =", len(feed.symbols)) | ||
rq = Roboquant(EMACrossover(13, 26)) | ||
tracker = BasicTracker() | ||
roboquant = rq.Roboquant(rq.strategies.EMACrossover(13, 26)) | ||
journal = rq.journals.BasicJournal() | ||
|
||
# Profile the run to detect bottlenecks | ||
with Profile() as profile: | ||
rq.run(feed, tracker=tracker) | ||
print(tracker) | ||
roboquant.run(feed, journal) | ||
print(f"\n{journal}") | ||
Stats(profile).sort_stats(SortKey.TIME).print_stats() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
from roboquant import Roboquant, EMACrossover, EquityTracker, YahooFeed | ||
import roboquant as rq | ||
|
||
|
||
if __name__ == "__main__": | ||
feed = YahooFeed("JPM", "IBM", "F", start_date="2000-01-01") | ||
feed = rq.feeds.YahooFeed("JPM", "IBM", "F", start_date="2000-01-01") | ||
|
||
# split the feed timeframe in 4 equal parts | ||
timeframes = feed.timeframe().split(4) | ||
|
||
# run a back-test on each timeframe | ||
for timeframe in timeframes: | ||
rq = Roboquant(EMACrossover(13, 26)) | ||
tracker = EquityTracker() | ||
rq.run(feed, tracker, timeframe) | ||
pnl = tracker.pnl() * 100 | ||
mdd = tracker.max_drawdown() * 100 | ||
print(f"{timeframe} pnl={pnl:5.2f}% mdd={mdd:5.2f}%") | ||
roboquant = rq.Roboquant(rq.strategies.EMACrossover(13, 26)) | ||
journal = rq.journals.BasicJournal() | ||
roboquant.run(feed, journal, timeframe) | ||
pnl = journal.pnl * 100.0 | ||
print(f"{timeframe} pnl={pnl:5.2f}%") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters