Replies

karol.bautrel
04 Dec 2022, 03:00

RE: RE: RE:

Okay I already figured it out. Looks like vscode does not understand class names from * imports and calling it that class name is not defined but it actually works and for example if 

I do ProtoOAApplicationAuthReq.__class__ I can see exact class and import

 


@karol.bautrel

karol.bautrel
02 Dec 2022, 14:39

RE: RE:

patsan said:

karol.bautrel said:

Hey guys !

After installing your python package from docs with pip install ctrader-open-api I am struggling with missing import of every Proto instances. Documentation says, that I dont need to do any compilation but when I did it to compare messages it looks the same, there is no instance like ProtoOAAPlicationAuthReq, it just something like this 

# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: OpenApiModelMessages.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)

_sym_db = _symbol_database.Default()




DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aOpenApiModelMessages.proto\"R\n\x0cProtoOAAsset\x12\x0f\n\x07\x61ssetId\x18\x01 \x02(\x03\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\x13\n\x0b\x64isplayName\x18\x03 \x01(\t\x12\x0e\n\x06\x64igits\x18\x04 \x01(\x05\"\xc8\t\n\rProtoOASymbol\x12\x10\n\x08symbolId\x18\x01 \x02(\x03\x12\x0e\n\x06\x64igits\x18\x02 \x02(\x05\x12\x13\n\x0bpipPosition\x18\x03 \x02(\x05\x12\x1a\n\x12\x65nableShortSelling\x18\x04 \x01(\x08\x12\x1a\n\x12guaranteedStopLoss\x18\x05 \x01(\x08\x12\x34\n\x11swapRollover3Days\x18\x06 \x01(\x0e\x32\x11.ProtoOADayOfWeek:\x06MONDAY\x12\x10\n\x08swapLong\x18\x07 \x01(\x01\x12\x11\n\tswapShort\x18\x08 \x01(\x01\x12\x11\n\tmaxVolume\x18\t \x01(\x03\x12\x11\n\tminVolume\x18\n \x01(\x03\x12\x12\n\nstepVolume\x18\x0b \x01(\x03\x12\x13\n\x0bmaxExposure\x18\x0c \x01(\x04\x12\"\n\x08schedule\x18\r \x03(\x0b\x32\x10.ProtoOAInterval\x12\x16\n\ncommission\x18\x0e \x01(\x03\x42\x02\x18\x01\x12\x

Am I supposed to do something more than installing package or something is wrong here ? 


 

 

You are missing a "p" in ProtoOAApplicationAuthReq.

This was only my missclick in typing here, in Vscode everything is copy-pasted from docs quick start. And also the most important thing that this is working because if I call it with __class__ I can see from where it is imported. The point is that vscode and flake8 does not understand what is this. 


@karol.bautrel