crypto-chassis / ccapi

A header-only C++ library for interacting with crypto exchanges. Bindings for Python, Java, C#, Go, and Javascript are provided.
https://discord.gg/b5EKcp9s8T
MIT License
580 stars 200 forks source link

expose setTimer to python #463

Open djdjoko opened 7 months ago

djdjoko commented 7 months ago

Is it possible to expose the setTimer function to python? This would be a game changer for me and hopefully other python users :)

Thanks!

cryptochassis commented 7 months ago

That is quite challenging if not entirely impossible because we generate the Python bindings through something called SWIG (https://www.swig.org/). setTimer requires a callback as parameter, and that feature isn't supported in SWIG. Could you elaborate a little bit more about your use case so that we can find a workaround? For example, you need a periodic timer to be triggered (every 1 second or on each exact second moment or ...)? Thank you.

djdjoko commented 7 months ago

Thanks for your reply! I would like ideally to have a periodic timer as you suggested but subscribing to multiple setTimer events would also work to mimic this behavior. Exact second is not that important but would also be a nice to have. Ideally I want some scheduling for low frequency operations.

cryptochassis commented 7 months ago

We've found a workaround: not ideal at all, but can be used as a workaround. :) See: https://github.com/crypto-chassis/ccapi?tab=readme-ov-file#receive-subscription-events-at-periodic-intervals-including-when-the-market-depth-snapshot-hasnt-changed. That basically serves as a periodic "timer". Let me know if that works for your purpose or not. Meanwhile we continue to seek for a better solution. Thank you!

djdjoko commented 7 months ago

Thank you,

I will try that :)

On Sat, 2 Mar 2024 at 05:39, cryptochassis @.***> wrote:

We've found a workaround: not ideal at all, but can be used as a workaround. :) See: https://github.com/crypto-chassis/ccapi?tab=readme-ov-file#receive-subscription-events-at-periodic-intervals-including-when-the-market-depth-snapshot-hasnt-changed. That basically serves as a periodic "timer". Let me know if that works for your purpose or not. Meanwhile we continue to seek for a better solution. Thank you!

— Reply to this email directly, view it on GitHub https://github.com/crypto-chassis/ccapi/issues/463#issuecomment-1974292310, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG4JUSFWPNAXWJUAERFOE3YWFJZHAVCNFSM6AAAAABDW4ZDVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZUGI4TEMZRGA . You are receiving this because you authored the thread.Message ID: @.***>