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

Symbol not Subscribed #27

Open
wds33817 opened this issue Oct 25, 2023 · 2 comments
Open

Symbol not Subscribed #27

wds33817 opened this issue Oct 25, 2023 · 2 comments

Comments

@wds33817
Copy link

Try to get the symbol quote, but the result is Symbol not Subscribed.

No problem with connection, but cannot get quote..
`
api = Ctrader(server, account, password)
api.subscribe("EURUSD")
price = api.quote("EURUSD")
print(price)

Buy position

price = api.quote()
price = price["EURUSD"]["bid"]

symbol = "EURUSD"
volume = 0.01 # position size:
stoploss = round(price - 0.00010,6)
takeprofit = round(price + 0.00020,6)

id = api.buy(symbol, volume, stoploss, takeprofit)
print(f"Position: {id}")

sell position

price = api.quote()
price = price['EURUSD']['bid']

symbol = "EURUSD"
volume = 0.01 # position size
stoploss = round(price + 0.00010,6)
takeprofit = round(price - 0.00010,6)

id = api.sell(symbol, volume, stoploss, takeprofit)
print(f"Position: {id}")`

@github-actions
Copy link

We're glad you've opened your first issue. Please provide all the necessary details and any relevant code or screenshots to help us understand the problem better. Our team will review your issue and provide assistance as soon as possible. Thank you for contributing!

@traderpedroso
Copy link
Member

traderpedroso commented Mar 30, 2024

Try to get the symbol quote, but the result is Symbol not Subscribed.

No problem with connection, but cannot get quote.. ` api = Ctrader(server, account, password) api.subscribe("EURUSD") price = api.quote("EURUSD") print(price)

Buy position

price = api.quote() price = price["EURUSD"]["bid"]

symbol = "EURUSD" volume = 0.01 # position size: stoploss = round(price - 0.00010,6) takeprofit = round(price + 0.00020,6)

id = api.buy(symbol, volume, stoploss, takeprofit) print(f"Position: {id}")

sell position

price = api.quote() price = price['EURUSD']['bid']

symbol = "EURUSD" volume = 0.01 # position size stoploss = round(price + 0.00010,6) takeprofit = round(price - 0.00010,6)

id = api.sell(symbol, volume, stoploss, takeprofit) print(f"Position: {id}")`

need a time.sleep(1) after api.subscribe("EURUSD")

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