harwee/IQOption-Api

How to determine a profit or a loss?

Opened this issue · 3 comments

Hello

I can't seem to find any method that shows you whether you have made a profit or a lose from your last trade, or even if that trade has been concluded

Can anyone point me in the right direction with some working code examples?

Thank you in advance

I was unable to find proper solution for this and that is why I made it in this way:

def make_bid(pair, direction):
    threadUpdater = Thread(target=update_reports)
    threadUpdater.start()
    ... (making bid)
def update_reports():
    time.sleep(2 * 60)
    for k, item in iqoption.portfolio.items():
        if item.win == "equal":
            continue
        ... (handle "k" as bid result)

This example ignores cases when result is really "equal", but it is fine for me.
It is not a production solution

I was unable to find proper solution for this and that is why I made it in this way:

def make_bid(pair, direction):
    threadUpdater = Thread(target=update_reports)
    threadUpdater.start()
    ... (making bid)
def update_reports():
    time.sleep(2 * 60)
    for k, item in iqoption.portfolio.items():
        if item.win == "equal":
            continue
        ... (handle "k" as bid result)

This example ignores cases when result is really "equal", but it is fine for me.
It is not a production solution

@djumpen @harwee

I've encountered a new problem

What do you do if Portfolio is never populated?

dict_items([])

In such a situation it is impossible to determine a win, lose or break even.

Is there any other way to determine if a bid has ended and the result?