Code Monkey home page Code Monkey logo

Comments (6)

AminHP avatar AminHP commented on May 31, 2024

As I explained here, you can override the download_data method and load your own dataframes. It's a bit more complicated than anytrading. For each symbol, you should load a dataframe and specify its SymbolInfo. The symbol info is required for precise calculations. Currently, it is filled by retrieving the information from MetaTrader but you can create an instance of this class and fill it manually.

from gym-mtsim.

yglpyn8888 avatar yglpyn8888 commented on May 31, 2024

@AminHP
Hi Amin, I probably know what to do next, but it's a little different from what I expected. I thought I should rewrite the load_symbols method to load my own df. So what's the difference between the download_data() and load_symbols()?

According to their source code, the load_symbols method is loaded from a filename:str(actually a path), which seems to be more in line with my requirements?

def download_data(
        self, symbols: List[str], time_range: Tuple[datetime, datetime], timeframe: Timeframe
    ) -> None:
    from_dt, to_dt = time_range
    for symbol in symbols:
        si, df = retrieve_data(symbol, from_dt, to_dt, timeframe)
        self.symbols_info[symbol] = si
        self.symbols_data[symbol] = df

def load_symbols(self, filename: str) -> bool:
    if not os.path.exists(filename):
        return False
    with open(filename, 'rb') as file:
        self.symbols_info, self.symbols_data = pickle.load(file)
    return True

from gym-mtsim.

AminHP avatar AminHP commented on May 31, 2024

The load_symbols method can only load a file which was previously saved by the save_symbols method. And the save_symbols should be called after filling the simulator.symbols_info and simulator.symbols_data attributes. These attributes are filled in the download_data. So, in order to make load_symbols work correctly, the proper data should be provided first in the download_data method.

from gym-mtsim.

yglpyn8888 avatar yglpyn8888 commented on May 31, 2024

oh, that's clear, thanks!

from gym-mtsim.

TanapongAUS avatar TanapongAUS commented on May 31, 2024

May I ask, How can I fix trading volume or lot size?

thanks in advance for your answer

from gym-mtsim.

SUSHANTH009 avatar SUSHANTH009 commented on May 31, 2024

oh, that's clear, thanks!

please can you share your notebook to upload custom data file

from gym-mtsim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.