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

Random sample data #93

Merged
merged 11 commits into from
Jan 6, 2024
Merged

Conversation

femtotrader
Copy link
Member

Closes #27

src/random.jl Outdated
price_init_max = 1000.00,
price_var_min = -1.0,
price_var_step = 0.01,
price_var_max = 0.01,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is downward trend intentional? Maybe by default should be price_var_max = 1.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

src/random.jl Outdated
price_var_min = price_var_step,
price_var_max = price_var_max,
)
price
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one probably is a leftover?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed also

@Arkoniak
Copy link
Member

Arkoniak commented Jan 5, 2024

It would be nice to have tests, but for this it's better to add rng parameter in function signature.

For example:

using Random

function random_cl(rng::AbstractRNG = Random.default_rng();
    start = Dates.DateTime(2020, 1, 1),
    ... # all other fields

and use it internally with constructions like

price_init .+ cumsum(rand(rng, price_var_min:price_var_step:price_var_max, length))

I am not sure though, if it is possible to use Random.default_rng() in Julia versions prior to 1.9

For compatibility reasons, one can use Random.GLOBAL_RNG

@femtotrader
Copy link
Member Author

Tests have been added
Should be ready now

@Arkoniak Arkoniak merged commit b4bb981 into JuliaQuant:master Jan 6, 2024
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 this pull request may close these issues.

Create constructor for random time series
2 participants