-
Notifications
You must be signed in to change notification settings - Fork 53
Balance not updating accordingly #41
Comments
|
@harwee can we have some callback when option gets closed (to write result into db for example) |
This feature would be really useful to me. I opened a fork of this project in IssueHunt if someone is interested. We can merge it back to the parent project (this one) |
@cnexans I'll appreciate if you'll notify about updates in current topic. Thanks. |
It's not difficult to implement it but I am busy with some other work so if someone can implement this and create a pull request, will merge it. |
@cnexans use this library instead it has all the function https://github.com/Lu-Yi-Hsun/iqoptionapi |
@cnexans Yes, I'm already doing this. But I still have no proper trigger for this check. I was trying to run infinite async loop aside but have not enough expertise in python to accomplish this (I'm from go/php) |
@djumpen That's my implementation right now. I will take that tech debt in few weeks, probably requesting a PR on here. You can use the implementation for waiting until is done in my repo. You have to use asyncio so you don't block the tasks inside the API. It should look like this def order_is_completed(order_id):
return api.portfolio[order_id]['rate_finished']
def get_if_won(order_id):
return api.portfolio[order_id]['win']
async def wait_until_is_complete(order_id):
while not order_is_completed():
await asyncio.sleep(quantity_of_seconds)
return get_if_won(order_id)
def place_order_and_get_id():
# buy sync
# get order_id
return order_id
order_id = place_order_and_get_id()
await wait_until_is_complete(order_id) |
I'm currently stuck on this same problem. Has anyone found a working answer yet? I've already tried all the above with no results. The closest to an answer I could get was to just create a whole new instance of the program within the program and starting that to get a new balance... but that is insane! |
@cnexans please help |
@MightyMaxSaviorOfTheUniverse I just run separate thread with infinite loop and check for updates there. Works well |
Can you provide your exact code? on my side the portfolio is NEVER populated so the following code returns print(iqoption.portfolio.items()) Return: dict_items([]) I've tried 3 different methods for getting the results of the market and none work. I've tried looking at the balance, refreshing and starting a whole new instance of the program to get a balance update, and this portfolio method. NOTHING WORKS. Can you please put my mind at easy by showing me exactly how you do it... it could even be a network error on my side |
I fond a sure fire way to get the balance, no matter what! You simply look at the candles and compare the ending time of your stock with the currency value in the candle at that placement. DONE! |
Call this function before you use/call the balance again. It will update the balance so that you get the latest/updated balance.
|
Hello,
Thank you very much for your effort. I'm using this library implementation to automate binary options but I have a trouble calculating the if an option went well or bad. My very first idea was to just compute
current_balance - last_balance
, although even if I wait 10 seconds after the option is closed, theapi.balance
is exactly the same.Is there a way to compute the profit?
Moreover, if you share the API docs I may try to implement it.
EDIT: I tried using
api.update_balances()
but it doesn't work neitherRegards
The text was updated successfully, but these errors were encountered: