soltrade icon indicating copy to clipboard operation
soltrade copied to clipboard

Discard outdated position.json data

Open GiorgosK opened this issue 11 months ago • 1 comments

I have encounced a situation where position.json contained

{"is_open": true, "sl": 0.6535125, "tp": 0.883125}

meanwhile there was no real position, had probably been already executed but the position.json was not properly updated. Perhaps this resulted from a forced stop (there is no graceful stop of the program is there ?)

This situation is bad as it creates an infinite loop. The program trying to find a way to sell a position of 0 amount and hence it results in an infinite loop

2025-02-23 07:31:36     Soltrade is creating exchange for 0.0 JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN
2025-02-23 07:31:36     Soltrade API Link: https://quote-api.jup.ag/v6/quote?inputMint=JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=0&slippageBps=50
2025-02-23 07:31:36     Soltrade is creating transaction for the following quote: 
{'error': 'Could not find any route', 'errorCode': 'COULD_NOT_FIND_ANY_ROUTE'}

Well this MR helps realize this an reset the position.json on first encounter

GiorgosK avatar Feb 23 '25 06:02 GiorgosK

I'm going to try to look over everything this week and hopefully get this pull request merged.

nmweaver avatar Mar 09 '25 22:03 nmweaver