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

I think it would be better. #245

Closed
darrenli6 opened this issue Mar 27, 2023 · 2 comments · Fixed by #246
Closed

I think it would be better. #245

darrenli6 opened this issue Mar 27, 2023 · 2 comments · Fixed by #246

Comments

@darrenli6
Copy link
Contributor

https://github.com/rodrigo-brito/ninjabot/blob/181d22019248c1174674b222dcde4801659df677/model/model.go#L62-#L65

I think it would be better.

start := size - positions

if start <= 0 {
    return df
}
@darrenli6
Copy link
Contributor Author

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,
Complete: true,
}
require.Equal(t, []string{"1609459200", "10000.1", "10000.1", "10000.1", "10000.1", "10000.1"}, candle.ToSlice(1))
}

I think it makes more sense to do that.

func TestCandle_ToSlice(t *testing.T) {
	candle := Candle{
		Pair:     "BTCUSDT",
		Time:     time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
		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.2"}, candle.ToSlice(1))
}

@rodrigo-brito
Copy link
Owner

Hi @darrenli6, thanks for the suggestions!
Feel free to contribute and welcome to open PRs with the suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants