-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: some tweaks when getting OHCLData
- Loading branch information
Showing
5 changed files
with
212 additions
and
39 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
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,53 @@ | ||
package kraken | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestTick_Values(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
tr Tick | ||
wantTick TickValues | ||
}{ | ||
{ | ||
name: "invalid tick", | ||
tr: Tick{}, | ||
}, | ||
{ | ||
name: "tick with invalid values", | ||
tr: Tick{"0", 1, 2, 3, 4, 5, 6, "7"}, | ||
}, | ||
{ | ||
name: "tick with valid values", | ||
tr: Tick{ | ||
1688671200, | ||
"30306.1", | ||
"30306.2", | ||
"30305.7", | ||
"30305.7", | ||
"30306.1", | ||
"3.39243896", | ||
23, | ||
}, | ||
wantTick: TickValues{ | ||
Time: 1688671200, | ||
Open: "30306.1", | ||
High: "30306.2", | ||
Low: "30305.7", | ||
Close: "30305.7", | ||
Vwap: "30306.1", | ||
Volume: "3.39243896", | ||
Count: 23, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := tt.tr.Values(); !reflect.DeepEqual(got, tt.wantTick) { | ||
t.Errorf("tick = %v, want %v", got, tt.wantTick) | ||
} | ||
}) | ||
} | ||
} |