Git Product home page Git Product logo

Comments (6)

digaph avatar digaph commented on July 28, 2024 1

@Chavithra thank you very much. I tested it and it works like a charm.

Cheers, Michel

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

Hello there,

I will split my answer into three points :

  1. What is your question ?
  2. Override
  3. Related issue

1. What is your question ?
Do you want to add the following options to Chart.Resolution enum ?

  • P1D
  • P7D
  • P1M

Chart.Resolution can be changed here :

  • protos/degiro_connector/quotecast/pb/quotecast.proto

Feel free to make a Pull Request, if you have tested these options.

I could then regenerate the pb2 files.

2. Override
The method get_chart has a parameter override.

You can use it to override the resolution, like so :

chart = quotecast_api.get_chart(
    request=request,
    override={"resolution":"P1D"},
    raw=True,
)

More information in the comments of get_chart function in degiro_connector/quotecast/utilities.py

3. Related issue
Here is another issue related to chart : #9
Just in case you might be interested in.

Thanks

from degiro-connector.

digaph avatar digaph commented on July 28, 2024

@Chavithra thank you for your answer.
I wasn't aware of the ability to override the resolution and period of the get_chart call, which is a workaround I can live with.

As for the pull request to add the P1D, P7D & P1M resolutions to the protobuf I ran into a conflict as P1D is already used for the Period enum and apparently it's not possible to use the same enum value twice in one proto file.

So I guess I'll switch to using the override instead.

Thanks, Michel

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

As for the pull request to add the P1D, P7D & P1M resolutions to the protobuf I ran into a conflict as P1D is already used for the Period enum and apparently it's not possible to use the same enum value twice in one proto file.

What you are trying to do is perfectly allowed by Protocol Buffer.

If you are interested in the full process after updating the quotecast.proto file you need to run a command like this :

python -m grpc_tools.protoc --python_out=. --grpc_python_out=. --proto_path=protos protos\degiro_connector\quotecast\pb\quotecast.proto protos\degiro_connector\trading\pb\trading.proto

Nice evening

from degiro-connector.

digaph avatar digaph commented on July 28, 2024

When I run that command I get the following messages:

degiro_connector/quotecast/pb/quotecast.proto:57:5: "P1D" is already defined in "Chart".
degiro_connector/quotecast/pb/quotecast.proto:57:5: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "P1D" must be unique within "Chart", not just within "Period".
degiro_connector/quotecast/pb/quotecast.proto:59:5: "P1M" is already defined in "Chart".
degiro_connector/quotecast/pb/quotecast.proto:59:5: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "P1M" must be unique within "Chart", not just within "Period".

The error is explaining what I mentioned above. As both the Resolution Enum and the Period Enum are children of the Chart scope, the values within the Enum need to be unique within Chart and not just within each Enum. This limitation means that I don't know how to get both to support the same values as changing the value will not work for the external API.

A quick google search reveals many developers running into the same limitation with no real solution other than to prefix the enum values with something unique.

Cheers, Michel

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

You are right, I didn't know that :

  • enum inside the same message couldn't have the same option names.

Merged Period and Resolution into a single Interval enum.

The modification was published and a migration script comes with it.

from degiro-connector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.