File tree Expand file tree Collapse file tree 3 files changed +73
-4
lines changed Expand file tree Collapse file tree 3 files changed +73
-4
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "date" : 1583637418739 ,
3
+ "marketData" : [
4
+ {
5
+ "price" : " 8000" ,
6
+ "time" : " 1583291820000"
7
+ },
8
+ {
9
+ "price" : " 8100" ,
10
+ "time" : " 1583291880000"
11
+ },
12
+ {
13
+ "price" : " 8200" ,
14
+ "time" : " 1583291940000"
15
+ },
16
+ {
17
+ "price" : " 7900" ,
18
+ "time" : " 1583292000000"
19
+ },
20
+ {
21
+ "price" : " 7800" ,
22
+ "time" : " 1583292000000"
23
+ },
24
+ {
25
+ "price" : " 7700" ,
26
+ "time" : " 1583292000000"
27
+ },
28
+ {
29
+ "price" : " 8000" ,
30
+ "time" : " 1583292060000"
31
+ },
32
+ {
33
+ "price" : " 8100" ,
34
+ "time" : " 1583292060000"
35
+ },
36
+ {
37
+ "price" : " 8200" ,
38
+ "time" : " 1583292060000"
39
+ }
40
+ ]
41
+ }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ )
6
+
7
+ func main () {
8
+
9
+ const demoTargetPrice = 8000
10
+
11
+ backtestArgs := Backtest {
12
+ marketData : []BarData {},
13
+ option : BackTestOptions {
14
+ capital : 1000 ,
15
+ debug : true ,
16
+ },
17
+ strategy : Strategy {
18
+ analysePosition : func (args AnalysePositionArgs ) {
19
+
20
+ },
21
+ onMarketTick : func (args OnMarketTickArgs ) {
22
+ if args .bar .close > demoTargetPrice {
23
+ args .enterPosition ("BUY" )
24
+ }
25
+ },
26
+ },
27
+ }
28
+
29
+ results = baregone .backtest (backtestArgs )
30
+
31
+ fmt .Printf (results .String ())
32
+ }
Original file line number Diff line number Diff line change @@ -32,7 +32,3 @@ type Strategy struct {
32
32
analysePosition AnalysePosition
33
33
onMarketTick OnMarketTick
34
34
}
35
-
36
- // func (BackTestParams backtest) runStrategy() BacktestContext {
37
-
38
- // }
You can’t perform that action at this time.
0 commit comments