Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/model:make more sense #246

Merged
merged 2 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (df Dataframe) Sample(positions int) Dataframe {
sample := df
size := len(sample.Time)
start := size - positions
if size <= positions || start < 0 {
if start <= 0 {
return df
}

Expand Down
12 changes: 6 additions & 6 deletions model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ func TestCandle_ToSlice(t *testing.T) {
candle := Candle{
Pair: "BTCUSDT",
Time: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
Open: 10000.1,
Close: 10000.1,
Low: 10000.1,
High: 10000.1,
Volume: 10000.1,
Open: 10000.12,
Close: 10000.12,
Low: 10000.14,
High: 10000.14,
Volume: 10000.19,
Complete: true,
}
require.Equal(t, []string{"1609459200", "10000.1", "10000.1", "10000.1", "10000.1", "10000.1"}, candle.ToSlice(1))
require.Equal(t, []string{"1609459200", "10000.1", "10000.1", "10000.1", "10000.1", "10000.2"}, candle.ToSlice(1))
rodrigo-brito marked this conversation as resolved.
Show resolved Hide resolved
}

func TestCandle_Less(t *testing.T) {
Expand Down