robcarver17 / pysystemtrade

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

Run_backups crashes since updating to master branch on 4/1 #1119

Closed oldlore closed 1 year ago

oldlore commented 1 year ago

I noticed today that run_backups has been crashing since 4/3. Error is posted below. I updated to the master branch this past weekend. Run_backups completed successfully on 3/31 (before upgrade). I don't know if it matters, but the instrument order is different each day, i.e. it doesn't seem to be crashing on one specific instrument.

2023-04-03 21:25:52 {'type': 'backup_arctic_to_csv', 'component': 'csvFuturesAdjustedPricesData', 'instrument_code': 'YENEUR'}  Added data for instrument YENEUR
2023-04-03 21:25:52 {'type': 'backup_arctic_to_csv'}  Written .csv backup for adjusted prices YENEUR
2023-04-03 21:25:52 {'type': 'backup_arctic_to_csv', 'component': 'csvFuturesAdjustedPricesData', 'instrument_code': 'ZAR'}  Added data for instrument ZAR
2023-04-03 21:25:52 {'type': 'backup_arctic_to_csv'}  Written .csv backup for adjusted prices ZAR
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up VIX_mini dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up FTSECHINAA dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up GOLD_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up SP500_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up USIRS5ERIS dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up NIKKEI dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up RUSSELL dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up BRE dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up AUD_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up MXP dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up NASDAQ_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up SOYBEAN_mini dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up TOPIX dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up DOW dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up DAX dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up KOSDAQ dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up GBP_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up US5 dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up COPPER-micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up CRUDE_W_micro dynamic_system strategy position data
2023-04-03 21:25:53 {'type': 'backup_arctic_to_csv'}  Backed up EUR_micro dynamic_system strategy position data
Traceback (most recent call last):
  File "/home/pysystemtrade/sysproduction/linux/scripts/run.py", line 67, in <module>
    func(*args, **kwargs)
  File "/home/pysystemtrade/sysproduction/run_backups.py", line 13, in run_backups
    backup_process.run_process()
  File "/home/pysystemtrade/syscontrol/run_process.py", line 103, in run_process
    self._main_loop_over_methods()
  File "/home/pysystemtrade/syscontrol/run_process.py", line 129, in _main_loop_over_methods
    timer_class.check_and_run(**kwargs)
  File "/home/pysystemtrade/syscontrol/timer_functions.py", line 124, in check_and_run
    self.run_function(**kwargs)
  File "/home/pysystemtrade/syscontrol/timer_functions.py", line 299, in run_function
    self._function(**kwargs)
  File "/home/pysystemtrade/sysproduction/backup_arctic_to_csv.py", line 85, in backup_arctic_to_csv
    backup_contract_position_data(backup_data)
  File "/home/pysystemtrade/sysproduction/backup_arctic_to_csv.py", line 357, in backup_contract_position_data
    data.csv_contract_position.overwrite_position_series_for_contract_object_without_checking(
  File "/home/pysystemtrade/sysdata/production/historic_contract_positions.py", line 244, in overwrite_position_series_for_contract_object_without_checking
    self._write_updated_position_series_for_contract_object(
TypeError: _write_updated_position_series_for_contract_object() got an unexpected keyword argument 'contract_object'
tgibson11 commented 1 year ago

I think this is fixed in the develop branch, but not in master yet

oldlore commented 1 year ago

You're right. I didn't catch this similar report under the closed issue #1070 . I updated the 2 relevant files from develop branch and the process ran successfully. Thanks for your help and I'll try to remember to check the closed issues before opening new ones to avoid clutter!

emretezel commented 1 year ago

Has the fix been merged into master ?

oldlore commented 1 year ago

It has not but I fixed it locally by updating: ib_client.py csv_contract_position_data.py from develop. Hopefully that didn't break anything else :)

emretezel commented 1 year ago

At the moment there seems to be two critical fixes in develop and not in master - the logging fix and the backup process fix.

As a general practice, it would be better implement critical fixes in master first, and then merge the fix into develop.

I know we have recently decided to have two branches master and develop, but thinking little more, the best practice could be instead of having a develop branch, each new big feature or critical bug fix which require substantial code change is developed in a new branch (out of master) and then merged into master. Small safe fixes can directly be done in master. Perhaps food for thought for the future.

Anyhow, I hope there will be a merge from develop into master soon and things are stable.

tgibson11 commented 1 year ago

Yes, @emretezel. That is exactly how it should work. But...

No one else but you is responsible for your system.

If all you can do in this situation is wait for Rob to do a merge, you're likely to be in for a bad time down the road.


*Neither of those bugs is truly critical. Both are highly annoying, though, and should be fixed in master as soon as possible.