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

Set lots(volume) #41

Open
AnggonoUtomo opened this issue Apr 17, 2023 · 3 comments
Open

Set lots(volume) #41

AnggonoUtomo opened this issue Apr 17, 2023 · 3 comments

Comments

@AnggonoUtomo
Copy link

how do i set the maximum lots?

@wayneadams
Copy link

You could update the volume_max property on the respective symbol_info stored in the DATA_DIR's pickle files. But that seems brittle.

I think you could also do something like this:

  1. Extend MtSimulator into a new class
  2. Include a new parameter, say max_lot_size
  3. Overwrite _check_volume() (see here) with a new function that uses the new parameter and throws a ValueError when appropriate

But, I'm pretty new to this package, so there are probably better ways to do this :)

@wayneadams
Copy link

wayneadams commented Apr 18, 2023

Actually, instead of going to the DATA_DIR, you can just update the volume_max property by accessing symbols_info directly on a MtSimulator instance. Do this after loading data.

For example:

sim = MtSimulator(
    unit='USD',
    balance=10000.,
    leverage=100.,
    stop_out_level=0.2,
    hedge=True,
    symbols_filename=FOREX_DATA_PATH
)

if not sim.load_symbols(FOREX_DATA_PATH):
    sim.download_data(
        symbols=["EURUSD"],
        time_range=(from_dt, to_dt),
        timeframe=Timeframe.M1
    )
    sim.save_symbols(FOREX_DATA_PATH)


new_max_volume = 42.0
sim.symbols_info["EURUSD"].volume_max = new_max_volume

@AnggonoUtomo
Copy link
Author

Let's to try, thanks Wayne....

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

No branches or pull requests

2 participants