forked from jjttjj/trateg
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trade backtest metrics improved (a lot)
- Loading branch information
awb99
committed
May 2, 2024
1 parent
b8c05cd
commit 0e5034a
Showing
32 changed files
with
320 additions
and
179 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,17 @@ | ||
(ns quanta.notebook.bardb-duck-delete | ||
(:require | ||
[tick.core :as t] | ||
[tablecloth.api :as tc] | ||
[ta.db.bars.protocol :as b] | ||
[ta.db.bars.duckdb :as duck] | ||
[ta.db.bars.dynamic.overview-db :refer [remove-asset]] | ||
[modular.system])) | ||
|
||
(def ddb (modular.system/system :bardb-dynamic)) | ||
|
||
(def db (modular.system/system :duckdb)) | ||
|
||
|
||
(duck/delete-bars db [:crypto :d] "ETHUSDT") | ||
|
||
(remove-asset (:overview-db ddb) {:asset "ETHUSDT" :calendar [:crypto :d]}) |
2 changes: 1 addition & 1 deletion
2
.../resources/quanta/notebook/bardb_duck.clj → ...urces/quanta/notebook/docs/bardb_duck.clj
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
25 changes: 25 additions & 0 deletions
25
lib/import/resources/quanta/notebook/docs/import_bardb_dynamic.clj
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,25 @@ | ||
(ns quanta.notebook.docs.import-bardb-dynamic | ||
(:require | ||
[tick.core :as t] | ||
[modular.system] | ||
[ta.calendar.core :as cal] | ||
[ta.db.bars.protocol :as b])) | ||
|
||
(def db (modular.system/system :bardb-dynamic)) | ||
|
||
(def window-daily | ||
(cal/trailing-range [:us :d] 200 | ||
(t/zoned-date-time "2024-05-02T17:30-05:00[America/New_York]"))) | ||
|
||
window-daily | ||
|
||
|
||
(b/get-bars db {:asset "AEE.AU" | ||
:calendar [:us :d] | ||
:import :eodhd} | ||
window-daily) | ||
|
||
(b/get-bars db {:asset "BTCUSDT" | ||
:calendar [:us :d] | ||
:import :bybit} | ||
window-daily) |
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
24 changes: 0 additions & 24 deletions
24
lib/import/resources/quanta/notebook/import_bardb_dynamic.clj
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
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,30 @@ | ||
(ns quanta.notebook.docs.mark2market | ||
(:require | ||
[tick.core :as t] | ||
[modular.system] | ||
[ta.trade.roundtrip.nav.mark2market :refer [portfolio]] | ||
[ta.viz.trade.m2m.core :refer [m2m-chart]] | ||
[ta.db.bars.protocol :as b])) | ||
|
||
(def bardb (modular.system/system :bardb-dynamic)) | ||
|
||
(def rts [{:asset "ETHUSDT" | ||
:side :long | ||
:qty 100.0 | ||
:entry-date (t/instant "2023-03-09T23:59:59Z") | ||
:entry-price 1400.78 | ||
:exit-date (t/instant "2023-03-16T23:59:59Z") | ||
:exit-price 1600.92}]) | ||
|
||
|
||
(-> (portfolio bardb rts {:calendar [:crypto :d] | ||
:import :bybit}) | ||
(m2m-chart) | ||
;pr-str | ||
) | ||
|
||
; {:open# 0, :long$ 0.0, :short$ 0.0, :net$ 0.0, :pl-u 0.0, | ||
; :pl-r 0.0, :date #inst \"2023-03-06T23:59:59.000000000-00:00\", | ||
; :pl-r-cum 0.0, :pl-cum 0.0} | ||
|
||
|
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
Oops, something went wrong.