ejtraderCT icon indicating copy to clipboard operation
ejtraderCT copied to clipboard

Symbol not Subscribed

Open wds33817 opened this issue 2 years ago • 2 comments

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}")`

wds33817 avatar Oct 25 '23 10:10 wds33817

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!

github-actions[bot] avatar Oct 25 '23 11:10 github-actions[bot]

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")

traderpedroso avatar Mar 30 '24 15:03 traderpedroso