robcarver17 / pysystemtrade

Systematic Trading in python
GNU General Public License v3.0
2.66k stars 837 forks source link

Initialize Capital Fails if __global_capital.parquet Doesn't Exist #1377

Closed craigmediaservices closed 1 month ago

craigmediaservices commented 6 months ago
Configuring sim logging

 sysproduction.interactive_update_capital_manual.interactive_update_capital_manual:
 Interactive session that allows you to manipulate capital manually

:return: Nothing 
 Arguments: []
2024-05-03 13:28:42 DEBUG config {'type': 'config', 'stage': 'config'} Adding config defaults

No capital setup yet

1: Setup initial capital parameters

Your choice? <RETURN for EXIT> 1
Broker account value <RETURN for get from IB> 
2024-05-03 13:28:50 DEBUG Interactive-Update-Capital-Manual {'component': 'mongoIbBrokerClientIdData'} Locked IB client ID 602
...
  File "/home/trader/pysystemtrade/sysproduction/linux/scripts/run.py", line 66, in <module>
    func(*args, **kwargs)
  File "/home/trader/pysystemtrade/sysproduction/interactive_update_capital_manual.py", line 44, in interactive_update_capital_manual
    function_to_run(data)
  File "/home/trader/pysystemtrade/sysproduction/interactive_update_capital_manual.py", line 101, in setup_initial_capital
    data_capital.create_initial_capital(
  File "/home/trader/pysystemtrade/sysproduction/data/capital.py", line 88, in create_initial_capital
    self.total_capital_calculator.create_initial_capital(
  File "/home/trader/pysystemtrade/sysdata/production/capital.py", line 476, in create_initial_capital
    self.delete_all_global_capital(are_you_really_sure=are_you_really_sure)
  File "/home/trader/pysystemtrade/sysdata/production/capital.py", line 513, in delete_all_global_capital
    self.capital_data.delete_all_global_capital(
  File "/home/trader/pysystemtrade/sysdata/production/capital.py", line 135, in delete_all_global_capital
    self.delete_all_capital_for_strategy(
  File "/home/trader/pysystemtrade/sysdata/production/capital.py", line 192, in delete_all_capital_for_strategy
    self._delete_all_capital_for_strategy_no_checking(strategy_name)
  File "/home/trader/pysystemtrade/sysdata/parquet/parquet_capital.py", line 48, in _delete_all_capital_for_strategy_no_checking
    self.parquet.delete_data_given_data_type_and_identifier(
  File "/home/trader/pysystemtrade/sysdata/parquet/parquet_access.py", line 36, in delete_data_given_data_type_and_identifier
    os.remove(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/trader/data/parquet/capital/__global_capital.parquet'

I was able to bypass by just running 'touch __global_capital.parquet' and rerunning the script.

bug-or-feature commented 1 month ago

Fixed by #1423