Git Product home page Git Product logo

Comments (7)

cunnane avatar cunnane commented on August 26, 2024

This does seem strange: I know the BBG does fiddle with the RTD timing, but from what you're describing, it seems you're not using any RTD functions in xloil?

run_coroutine_threadsafe should return more or less immediately unless it throws, so I'd suggest putting a try...except around start_hb and logging any error (I would expect xloil to catch and print the error, but there may be some reason why it doesn't)

Also, it's possible to structure this so the user doesn't have to press a button: create an RTD clock and a worksheet function "SEND_HB" which takes a single dummy argument. Point the dummy argument to the output of the clock on the worksheet and it will be called whenever the clock ticks (assuming you have automatic calc enabled).

from xloil.

keithalewis avatar keithalewis commented on August 26, 2024

Another possibility might be https://xlladdins.github.io/Excel4Macros/on.time.html.
This corresponds to the xlcOnTime function number.

The Bloomberg add-ins do not play nicely with other add-ins.

from xloil.

ekwf avatar ekwf commented on August 26, 2024

As an experiment I tried switching to loop = xloil.get_async_loop() and it appears to do exactly what I want although I can't 100% understand why this works and the other doesn't.

from xloil.

cunnane avatar cunnane commented on August 26, 2024

Interesting observation. get_event_loop gives the asyncio loop which is used to background load code and handle ribbon callbacks, and get_async_loop returns the loop which handles RTD functions. Both these loops should be being "pumped" unless the associated thread crashes, so I'm not sure why you see this behaviour but will ponder on it.

from xloil.

cunnane avatar cunnane commented on August 26, 2024

@keithalewis Agree that BBG is not friendly, especially the old-skool spill functionality. But I've no idea how it could sabotage my asyncio loop.

Ontime is a good idea, the most Excel-onic approach!

from xloil.

govert avatar govert commented on August 26, 2024

In the past I found that xlcOnTime is more reliable that Application.OnTime, but xlcOnTime can't be called from a UDF context, or from some other thread, so setting it up from the context required is not so useful. xlcOnTime also used to reset the undo/redo stack every time, which is annoying (though I have not checked recently). I can't remember whether multiple 'OnTime' macros can be scheduled (e.g. by different add-ins). I ended up avoiding both xlcOnTime and Application.OnTime completely.

In Excel-DNA I have evolved to an elaborate mechanism that runs a windows message loop on the main thread to receive any notifications (including timer callbacks), then check whether Excel is in a 'receptive' state for invoking a macro (that means Excel is not busy calculating, running a macro, editing a formula etc.) and when safe then invoke a macro from which to execute the work. This has become reliable over time, though included a watchdog check and other enhancements.

RTD-based approaches which stay completely inside the normal Excel calculation world are of course best. Although RTD has its own quirks it tends to work as advertised, integrate well with calculations, including dynamic arrays. The fact that the RTD ThrottleInterval is a shared setting, global and persistent between Excel sessions, seems to be the biggest gotcha.

I'm always happy to discuss and test any of these low-level Excel ideas - at this level Excel is mostly undocumented, the knowledge base stuff from Microsoft has bit-rotted away and we can only figure out what would through empirically studying Excel like some artifact left by aliens.

from xloil.

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.