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

x.Stream.subscribe.getCandles bug (caused by xOpenHub server side logic) #17

Open
peterszombati opened this issue Apr 25, 2021 · 15 comments
Labels
bug Something isn't working

Comments

@peterszombati
Copy link
Owner

x.Stream.subscribe.getCandles doesn't working if you didn't do a price history request for specific symbol
example with BITCOIN:

x.Stream.subscribe.getCandles('BITCOIN')
        .catch(() => { console.error('subscribe for BITCOIN failed')});

It won't work.
You have to do a request to BITCOIN price history then subscribe for candles
example with BITCOIN:

x.getPriceHistory({
  symbol: 'BITCOIN',
  period: PERIOD_FIELD.PERIOD_M1,
  ticks: -1
})

x.Stream.subscribe.getCandles('BITCOIN')
        .catch(() => { console.error('subscribe for BITCOIN failed')});
@peterszombati peterszombati added the bug Something isn't working label Apr 25, 2021
@solarfrantz
Copy link

solarfrantz commented Apr 25, 2021

Is there anything you can do on your library side that is not a tiny hack since the root 'cause is located on XTB side ?
I'm curious, have you tried submitting a bug (through their help desk) on their side ?
PS: So far locally, I've found a better solution to do realtime computation of the candles based on the getTickPrices subscription, so I don't have to wait a minute to get a notification from their websocket.

@peterszombati
Copy link
Owner Author

Hi @solarfrantz
Today I sent an email to support @ xhub . pro

@peterszombati
Copy link
Owner Author

@solarfrantz btw they still didn't respond to me, I'm 100% they won't do any changes on their side:)

@wtld
Copy link

wtld commented Dec 7, 2021

That's weird because Python code works fine:

import sys
import time
from xAPIConnector import APIClient, APIStreamClient, loginCommand

userId = 999999
password = 'blabla'

client = APIClient()

loginResponse = client.execute(loginCommand(userId=userId, password=password))

if not loginResponse['status']:
    print('Login failed. Error code: {0}'.format(loginResponse['errorCode']))
    sys.exit()

ssid = loginResponse['streamSessionId']

sclient = APIStreamClient(ssId=ssid)

sclient.execute(dict(command='getCandles', symbol='EURUSD', streamSessionId=ssid))

# make it run for 5 minutes
time.sleep(300)

sclient.disconnect()
client.disconnect()

You need official wrapper (xAPIConnector) from here: http://developers.xstore.pro/api/wrappers/
But I remember that about a year ago getCandles wasn't working at all. Maybe they fixed something?

@peterszombati
Copy link
Owner Author

@wtld I will check this later

@sznowak
Copy link

sznowak commented Dec 9, 2021

@peterszombati any info here?

@mb-mb
Copy link

mb-mb commented Sep 6, 2022

@peterszombati any update about this problem ?

@KevinKlima
Copy link

Thank you very much for this information.
I thought I was going crazy. Calling getCandle sometimes worked for me, other times it didn't. I wondered in vain where I was going wrong, even though I was sure I hadn't changed any critical code. In desperation I tried Google and the very first link got me here. When I call the getLastChart function, then subscribe starts working. Weird but works for me.

Thanks again for this information!

@sgflt
Copy link

sgflt commented May 21, 2024

2024 and found this issue is still alive. Using https://github.com/sgflt/xapi-websocket-client

@damiancyrana
Copy link

2024 i odkryłem, że ten problem jest nadal aktualny. Używając https://github.com/sgflt/xapi-websocket-client

did you manage to solve the problem with Command: getCandles ?

@sgflt
Copy link

sgflt commented Jun 2, 2024

I just call getChartLastRequest before subscription and it seems to be working.

@damiancyrana
Copy link

I just call getChartLastRequest before subscription and it seems to be working.

Thanks, I changed the calling order as you wrote and it worked <3

@htimi
Copy link

htimi commented Aug 12, 2024

I'm using python that not working for me too. I have the official wrapper but getCandles not working. Sent email to the support waitin for the answer. I'm the only one in this situation. I try call getChartLastRequest before nothing change. Sad

@damiancyrana
Copy link

@htimi You must use getChartLastRequest for M1 interval, before retrieving candles

@htimi
Copy link

htimi commented Aug 12, 2024

@damiancyrana thanks it works !!!! Maururu (thanks in Polynesia langage)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants