AminHP / gym-mtsim

A general-purpose, flexible, and easy-to-use simulator alongside an OpenAI Gym trading environment for MetaTrader 5 trading platform (Approved by OpenAI Gym)
MIT License
428 stars 107 forks source link

can i ask attributes' meaning of SymbolInfo class? #13

Closed yglpyn8888 closed 2 years ago

yglpyn8888 commented 2 years ago
class LocalMtSimulator(MtSimulator):
    def download_data(self, symbol: str, df, symbol_info: SymbolInfo) -> None:
        """load dataframe from disk"""
        # symbol_df = pd.read_excel(path)
        self.symbols_info[symbol] = symbol_info
        self.symbols_data[symbol] = df

dataset = sqlite2df("data\\my\\kb8w.db", table_name='temp')
dataset['datetime'] = dataset['datetime'].apply(lambda x: bt.num2date(x))
dataset = dataset.rename(
        columns={"datetime": "Time", "open": "Open", "close": "Close", "high": "High", "low": "Low",
                 "volume": "Volume"})

sim = LocalMtSimulator(
        unit='CNY',
        balance=10000.,
        leverage=5,
        # stop_out_level=0.2,
        # hedge=True,

    )
sim.download_data('rb', dataset, symbol_info=SymbolInfo(
    info={
        "name": "rb",
        "path": "CTP\\rb",

        "currency_margin": 0,
        "currency_profit": 0,
        "trade_contract_size": 0,
        "margin_rate": 0.2,
        "volume_min": 0,
        "volume_max": 0,
        "volume_step": 0
    }

the above is code structure of how i load my own df, and when i fill symbolinfo class, i found i dont understand meaning of following parameters : "currency_margin": 0, "currency_profit": 0, "trade_contract_size": 0, "margin_rate": 0.2, "volume_min": 0, "volume_max": 0, "volume_step": 0 can u explain these? Thank you.

AminHP commented 2 years ago

Some of these are explained here.

currency_margin: The currency in which the margin requirements are calculated. usage currency_profit: The currency in which the profit of the symbol trading is calculated. usage trade_contract_size: The number of units for one volume of trade. The order.volume will be multiplied by this value. usage margin_rate: The calculated margin for a new order will be multiplied by this value. It's usually 1. usage volume_min: The minimum volume can be set for a new order. usage volume_max: The maximum volume can be set for a new order. usage volume_step: The volume of a new order must be a multiple of this value. usage