![]() ![]() If error is within the given function (hard to say without detail on how this function is called) I believe it is one of: A Market order means that you TAKE the best price the market is willing to give you - this trade should be filled immediately. If the above solved your issue, please can you accept the answer? If i think of a better way to do it i'll add to here, but the above should solve your problem.ĮDIT: You are attempting to place a MARKET order, which by definition is not affected by price fluctuations in the same way as LIMIT. status filled) then you are reverting the SoldCheck flag to False to stop the loop as you no longer need to cancel the order. Then, when the if condition is satisfied (i.e. SellOrder = client.create_order(symbol = "DOGEEUR", side = 'SELL', type = 'MARKET', quantity = float(50.0))ĬurrentOrder = client.get_order(symbol = "DOGEEUR", orderId = sellOrderID)Ĭlient.cancel_order(symbol = "DOGEEUR", orderId = sellOrderID) The syntax while SoldCheck: will run a loop while the boolean variable SoldCheck is True - you have set this statically to False, so the loop will not run. If I've understood correctly, you've run into an issue with executing the code that is within the loop? It looks to me like you using contradicting logic in your while loop. SellOrder = client.create_order(symbol = hparams, side = 'SELL', type = 'MARKET', quantity = hparams)ĬurrentOrder = client.get_order(symbol = hparams, orderId = sellOrderID)Ĭlient.cancel_order(symbol = hparams, orderId = sellOrderID) Here is my try at it : (it will sometimes do the upper scenario and execute the code after this part with an order which was not executed yet which will make the program crash). (Maybe there is a better solution to that I'm open to all kinds of answers) Therefore I need to check if the order is filled and if it is not I need to redo the order. But if i create an order of sell and then the price drops, obviously no one will buy at that price. ![]() I need to sell my coins when the algorithm takes the decision. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |