Regardless of what you want to fix, do not execute a trading algorithm if you don't understand it. If you don't want to speak to that person again, hire another developer to verify that the algo is doing what are you expecting it to do. And that dev will fix any issues you might have.
Of course I understand it, it´s my system, built for me to my specification. I just dont want this software on other people´s hands thats all. Can you help me set the print in the code? Should be fairly easy, I just never did it, thats why i´m asking for help. As said before I have no problem with the logic part. The structure though, I never worked on it.
It is hard to modify code that I don't have. I know you are paranoid about sharing that code but devs don't care about what the code does. Specially because I don't trust that your algo is working at all. You found one issue but I am sure that it has plenty more. And also I have my own algos, I won't execute yours. If you want, I can have a look, but only if you share a GitHub repo. Otherwise you can look for someone else.
The error you're encountering occurs because the code is attempting to convert the string `'ENTRY'` to an integer, which is not possible. Specifically, the line causing the error is: ```python original_order_id = int(entry_order_ref.split('_')[1]) ``` Here's what's happening: 1. **Splitting `entry_order_ref`:** The `entry_order_ref` string is being split by the underscore `_` character. 2. **Accessing the Second Element:** The code tries to access the element at index `[1]` of the split list. 3. **Attempting to Convert to Integer:** It then attempts to convert this element to an integer using `int()`. However, the element at index `[1]` is `'ENTRY'`, which cannot be converted to an integer, leading to the `ValueError`. **Why Did This Happen Now?** - **Change in `entry_order_ref` Structure:** It's likely that the format or structure of `entry_order_ref` has changed since the last time the code was run successfully. - **Assumptions in Indexing:** The code assumes that certain pieces of data are at fixed positions in the split list, which may no longer be valid. **How to Fix It:** 1. **Inspect `entry_order_ref`:** Print out or log the value of `entry_order_ref` to understand its current structure. ```python print(f"entry_order_ref: {entry_order_ref}") ``` 2. **Analyze the Split List:** ```python split_ref = entry_order_ref.split('_') print(f"split_ref: {split_ref}") ``` 3. **Adjust Indexing Based on Actual Structure:** - Determine which indices correspond to the `trade_id`, `original_order_id`, `datetime_stamp`, and `cancel_price`. - Update the code to use the correct indices. **Example Adjustment:** If after inspecting, you find that the structure of `entry_order_ref` is: ``` 'trade_id_ENTRY_datetime_stamp_OTHER_cancel_price' ``` Then the correct indices might be: - `trade_id = int(split_ref[0])` - **Skip `'ENTRY'` at `split_ref[1]`** - `original_order_id = int(split_ref[2])` - `datetime_stamp = split_ref[3]` - `cancel_price = float(split_ref[5])` **Updated Code:** ```python trade_id = int(entry_order_ref.split('_')[0]) # Skip index [1] because it is 'ENTRY' original_order_id = int(entry_order_ref.split('_')[2]) cancel_price = float(entry_order_ref.split('_')[5]) ``` **Recommendation:** - **Avoid Hard-Coded Indices:** If possible, use a more robust method of parsing `entry_order_ref`, such as regular expressions or a structured format like JSON. - **Add Error Handling:** ```python try: original_order_id = int(entry_order_ref.split('_')[1]) except ValueError as e: print(f"Error parsing original_order_id: {e}") # Handle the error or adjust the index ``` - **Update Documentation:** Ensure that any changes in the format of `entry_order_ref` are documented and that all parts of the codebase are updated accordingly. **Summary:** The error arises due to incorrect assumptions about the structure of `entry_order_ref`. By inspecting and adjusting your code to match the actual format of `entry_order_ref`, you can resolve the `ValueError`.
Wow! Now this is what helping out means! Dear sir, I thank you, dearly. I will study and implement this no doubt. Thank you a bunch. Will report back!
Maybe or not but I used it too and this is much more well explained. Either way, wow and hats off to Maverick.
Wait for the next error Fixing one line without seeing the rest of code can lead to many more issues. I know you have done it to help the guy from a good heart, but you might have caused a much bigger problem.