Open t3chap opened 6 months ago
I think I overcame this error by creating a blank __global_capital.parquet file and next running interactive_update_capital_manual()
That works, thank you.
I also copied the blank file and renamed it for the system name that I was trying to use, as that error occurred next.
I have the same issue BUT having created the file :
import pyarrow.parquet as pq import pandas as pd df = pd.DataFrame() df.to_parquet('/home/rorym/data/parquet/capital/__global_capital.parquet')
Still get the following error
Traceback (most recent call last):
File "/home/rorym/pysystemtrade/sysproduction/linux/scripts/run.py", line 66, in <module>
func(*args, **kwargs)
File "/home/rorym/pysystemtrade/sysproduction/interactive_update_capital_manual.py", line 44, in interactive_update_capital_manual
function_to_run(data)
File "/home/rorym/pysystemtrade/sysproduction/interactive_update_capital_manual.py", line 101, in setup_initial_capital
data_capital.create_initial_capital(
File "/home/rorym/pysystemtrade/sysproduction/data/capital.py", line 88, in create_initial_capital
self.total_capital_calculator.create_initial_capital(
File "/home/rorym/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/rorym/pysystemtrade/sysdata/production/capital.py", line 513, in delete_all_global_capital
self.capital_data.delete_all_global_capital(
File "/home/rorym/pysystemtrade/sysdata/production/capital.py", line 135, in delete_all_global_capital
self.delete_all_capital_for_strategy(
File "/home/rorym/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/rorym/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/rorym/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/rorym/data/parquet/capital/__global_capital.parquet'
perhaps is someone can please show the basic df from _global_capital.parquet - then I can create it and try that instead. Just the headers should do it.
Hi Rory,
Were you able to resolve this issue? I am running into the same problem in master.
I have created an empty file under data parquet, and ran the interactive manual capital update and then tried the transfer again, now getting the following error.
It seems the transfer to parquet script is not working in master branch.
(pysystemtrade-user) pysystemtrade@emre-OptiPlex-3080:~/opt/pysystemtrade/sysinit/transfer$ python backup_arctic_to_parquet.py
Configuring sim logging
2024-03-29 16:17:10 DEBUG config {'type': 'config', 'stage': 'config'} Adding config defaults
2024-03-29 16:17:10 DEBUG backup_arctic_to_parquet Dumping from arctic, mongo to parquet files
Do futures contract prices?n
FX?n
Multiple prices?n
Adjusted prices?n
Strategy positions?n
Contract positions?n
Capital?y
Traceback (most recent call last):
File "/home/pysystemtrade/opt/pysystemtrade/sysinit/transfer/backup_arctic_to_parquet.py", line 548, in <module>
backup_arctic_to_parquet()
File "/home/pysystemtrade/opt/pysystemtrade/sysinit/transfer/backup_arctic_to_parquet.py", line 95, in backup_arctic_to_parquet
backup_capital(backup_data)
File "/home/pysystemtrade/opt/pysystemtrade/sysinit/transfer/backup_arctic_to_parquet.py", line 454, in backup_capital
if len(parquet_data) > strategy_capital_data:
File "/home/pysystemtrade/anaconda3/envs/pysystemtrade-user/lib/python3.10/site-packages/pandas/core/generic.py", line 1519, in __nonzero__
raise ValueError(
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Yeah I did manage to, the long way around, from the csv backup files for capital, I created a parquet files put those into the directory and it worked.
I'm trying to get a production system going that, at least at first, I intend to use to generate orders and manually inter them into IB. I also plan to enter the capital manually until I get things further setup/integrated with IB.
when I run the interactive_update_capital_manual() function with no previous capital set (and not pulling it from IB), I get an error when it tries to delete the __global_capital.parquet file that doesn't yet exist.
I worked around this by editing capital.py to add a try: except surrounding the delete command on or about 190, figuring that this workaround would allow me to at least proceed enough to get orders. However, I found the RETURN for EXIT doesn't work at the menu, it just loops back to the menu. After exiting this, I attempted to run the update_system_backtest() function, and get the following errors:
Any ideas how to get around this one? It is very possible that I've missed a step somewhere that would setup the capital values in parquet correctly, but I haven't found anything yet.