Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'quotes' values are incorrect? #6

Open
Leoalv72 opened this issue Jun 22, 2024 · 7 comments
Open

'quotes' values are incorrect? #6

Leoalv72 opened this issue Jun 22, 2024 · 7 comments

Comments

@Leoalv72
Copy link

Leoalv72 commented Jun 22, 2024

I Watch the last values for Psar[-1] and notice the value for date is not the same of the actual time.. it was hour 23:46 and my times was 20:40 (10:40pm), It is the same problem if I use the actual time in PO or change it 2 hours after. I think that is the reason why the values ​​do not correspond to the graph.

image

...This is a good capture.. you can see the is_reversal and sar values printed in the Terminal and the erratic signal in the Closed Tab in referal to the Psar poits in the graph. To this case I change the signal in the If Else, but is the same problem in contrary case.
image

Any Idea for that?

@Leoalv72
Copy link
Author

I noticed that the lag comes from the function websocket_log() when it get the data it is 2 hours ahead, e.g. for the timestamp '1719123870.591' it is '6/22/2024, 11:24:30 PM' when really my actual time is '09:24:30 PM'.
Has anyone noticed this too?

@VitalySvyatyuk
Copy link
Owner

hi @Leoalv72, datetimes coming from websocket have UTC timestamps, where is your local timezone can be different. That's why you can have a lag 2-3 hours.

@VitalySvyatyuk
Copy link
Owner

VitalySvyatyuk commented Jun 26, 2024

The condition you have in the second picture will not work, as you have orders all the time. Today I pushed a little update to po_bot_indicators.py for a PSAR strategy -> please have a look how the condition should look like.

@VitalySvyatyuk
Copy link
Owner

To make sure that data from websocked is valid, you can compare a current currency value in the graph and the one in the console last_value:, they should be the same.

@Leoalv72
Copy link
Author

Leoalv72 commented Jun 28, 2024

Ok, thanks for replay.
The hours of difference is not a big problem, the problem is the values of the Psar that it must to reflect the value in the point and it doesn't match with the graph, I check the values of the Psar in the Traidingview for the same pair and this is not the same too. And yes, I try an order all time just to check the Psar values and if it change the reversal at the same time in the graph, but it doesn't do it.
Ok, I´ll see you new update, Thanks so much for that.

@VitalySvyatyuk
Copy link
Owner

to print a graph, you can place this code somewhere inside check_indicators():

    import matplotlib
    matplotlib.use('TkAgg')
    import matplotlib.pyplot as plt
    import pandas as pd
    df = pd.DataFrame([{'close': q.close, 'open': q.open, 'high': q.high, 'low': q.low, 'psar': p.sar} for q, p in
                       zip(quotes[-100:], psar[-100:])], dtype=float)
    df.plot()
    plt.show()

@Leoalv72 Leoalv72 changed the title 'quotes' time is incorrect? 'quotes' values are incorrect? Jul 9, 2024
@Leoalv72
Copy link
Author

Leoalv72 commented Jul 9, 2024

Hi, I detect a problem whit the Quotes values for OS 'nt' (Windows). The problem is with the ""replace('.', ',') in the 'def get_quotes():', when the value is stored with a decimal point in string ".", it is store the var (close, high, ..etc) like a Int, ex: (1.1654 is stored like 11654).. From there all the values ​​with 'quotes' are miscalculated.
I use Windows 10 Home and my values is correct in decimals, I don't need to replace '.'.. then I just comment the if OS part and adjust the code like picture.
It work for me, and the Psar values are more similar to the graph, just some decimals of difference, but is ok now.
I suppose the similar quotes values for other indicators are now ok.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants