Skip to content

Commit c6b4544

Browse files
committed
main file
1 parent 7248b99 commit c6b4544

File tree

3 files changed

+73
-4
lines changed

3 files changed

+73
-4
lines changed

BTCUSDT.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
}

main.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

strategy.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@ type Strategy struct {
3232
analysePosition AnalysePosition
3333
onMarketTick OnMarketTick
3434
}
35-
36-
// func (BackTestParams backtest) runStrategy() BacktestContext {
37-
38-
// }

0 commit comments

Comments
 (0)