Skip to content

Problem with running out sample backtesting (evaluation) with data from Google Drive #1

@Duc7111

Description

@Duc7111

Description

I got a problem running python evaluation.py when use the data collected from Google Drive option. I notice a mismatch in date in `backtesting_parameter.json', but replacing it with the following setting (adapted from this config from the previous commit) did not work

{
    "is_from_date_str": "2022-01-01 00:00:00",
    "is_end_date_str": "2023-01-01 00:00:00",
    "os_from_date_str": "2023-02-01 00:00:00",
    "os_end_date_str": "2024-01-01 00:00:00",
    "fee": "0.4",
    "time": "15"
}

Both cases above yield the same issue:

Traceback (most recent call last):
  File "/home/<path>/ProtoMarketMaker/evaluation.py", line 14, in <module>
    bt.run(data, Decimal(BEST_CONFIG["step"]))
  File "/home/<path>/ProtoMarketMaker/backtesting.py", line 251, in run
    self.handle_force_sell(row["f2_price"] if moving_to_f2 else row["price"])
  File "/home/<path>/ProtoMarketMaker/backtesting.py", line 107, in handle_force_sell
    while self.get_maximum_placeable(price) < 0:
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<path>/ProtoMarketMaker/backtesting.py", line 123, in get_maximum_placeable
    from_cash_to_tradeable_contracts(
  File "/home/<path>/ProtoMarketMaker/utils.py", line 29, in from_cash_to_tradeable_contracts
    return int(cash / (inst_price * multiplier * margin_rate))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot convert NaN to integer

Roll back to this commit and it worked well.

Environment

OS: Ubuntu 24.04
Python version: 3.12.3

Reproduce steps

  1. Clone this repo to local
  2. Download data from Google Drive
  3. Setup env as in README
  4. (Optional) Run every other steps in README
  5. Run `python evaluation.py

Notes: It worked fine with data collected from database

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions