Skip to content

Symbol not Subscribed #27

Open
Open
@wds33817

Description

@wds33817

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions