-
Notifications
You must be signed in to change notification settings - Fork 0
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
T.K
committed
Feb 5, 2024
1 parent
0b3097c
commit 0db42a9
Showing
699 changed files
with
427 additions
and
366,375 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.dll | ||
*.exe | ||
*.db | ||
*.html | ||
bin/ | ||
spot/ | ||
html/ | ||
|
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
|
||
|
||
|
||
assetName: "SOLUSDT" | ||
assetName: "TIAUSDT" | ||
|
||
duration: "30m" | ||
duration: "1h" | ||
|
||
limit: 17000 |
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,24 @@ | ||
package analytics | ||
|
||
import "v1/pkg/execute" | ||
|
||
func ExpectedValue(s *execute.SignalEvents) float64 { | ||
|
||
if s == nil { | ||
return 0.0 | ||
} | ||
|
||
var ev float64 | ||
|
||
wr := WinRate(s) | ||
|
||
aw := AveregeProfit(s) | ||
|
||
lr := 1.0 - wr | ||
|
||
al := AveregeLoss(s) | ||
|
||
ev = (wr * aw) - (lr * al) | ||
|
||
return ev | ||
} |
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 @@ | ||
package analytics | ||
|
||
import "v1/pkg/execute" | ||
|
||
func ReturnDDRattio(s *execute.SignalEvents) float64 { | ||
|
||
if s == nil { | ||
return 0.0 | ||
} | ||
|
||
np := NetProfit(s) | ||
dd := MaxDrawdownUSD(s) | ||
|
||
rdr := np / dd | ||
|
||
return rdr | ||
} |
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,63 @@ | ||
package analytics | ||
|
||
import ( | ||
"math" | ||
"v1/pkg/execute" | ||
) | ||
|
||
func calculateStandardDeviation(s *execute.SignalEvents) float64 { | ||
if s == nil || s.Signals == nil || len(s.Signals) == 0 { | ||
return 0.0 | ||
} | ||
|
||
var profits []float64 | ||
var buyPrice float64 | ||
|
||
for _, signal := range s.Signals { | ||
if signal.Side != "BUY" && signal.Side != "SELL" { | ||
continue | ||
} | ||
if signal.Side == "BUY" { | ||
buyPrice = signal.Price | ||
} else if signal.Side == "SELL" && buyPrice != 0 { | ||
profit := (signal.Price - buyPrice) * signal.Size | ||
profits = append(profits, profit) | ||
buyPrice = 0 // Reset buy price after a sell | ||
} | ||
} | ||
|
||
// Calculate mean of profits | ||
mean := 0.0 | ||
for _, profit := range profits { | ||
mean += profit | ||
} | ||
mean /= float64(len(profits)) | ||
|
||
// Calculate standard deviation of profits | ||
variance := 0.0 | ||
for _, profit := range profits { | ||
difference := profit - mean | ||
squaredDifference := difference * difference | ||
variance += squaredDifference | ||
} | ||
variance /= float64(len(profits) - 1) | ||
|
||
standardDeviation := math.Sqrt(variance) | ||
|
||
return standardDeviation | ||
} | ||
|
||
func SQN(s *execute.SignalEvents) float64 { | ||
if s == nil { | ||
return 0.0 | ||
} | ||
|
||
e := ExpectedValue(s) | ||
tt := TotalTrades(s) | ||
|
||
sdv := calculateStandardDeviation(s) | ||
|
||
sqn := math.Sqrt(float64(tt)) * e / sdv | ||
|
||
return sqn | ||
} |
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.