Coder Social home page Coder Social logo

Comments (5)

tournierjc avatar tournierjc commented on July 17, 2024

I think your workaround will work for your test case but it's look to me more like an ugly fix.

It's the Settings and Observable pattern that should be threadsafe and it is your program who needs to be aware of the objects you share between threads.

from qlnet.

channell avatar channell commented on July 17, 2024

I first came across Quantlib in the comments of an Investment Banks Quant Library “copied from the original quantlib”.. the most common reason to copy rather that use Quantlib is the mistake introducing Observable to assist the StatPro pricing service: a hack for to present price/yield functions independently without the need to pass a previously calculated value into a “price given yield” or “yield given price” function.

A proper quant library should be fully functional (with no side effects), but that will require a major re-write. The suggestion of spinlock is indeed a work-around for a pattern that should not be there.

I added spinlock_ in addition to bootstrapping_ (the fix to concurrency issue I was seeing) in order to avoid the side effect of duplicate observer notifications and co-mutation if more than one thread performs the same calculation (numeric consistency is questionable writing doubles on a 32-bit computer without interlocked exchange)

Given the marginal cost of plugging this problem, it is worth doing

from qlnet.

amaggiulli avatar amaggiulli commented on July 17, 2024

Hey @channell , thx for your PR , I agree with you about the uneeded pattern , what about working togheter to completly remove it from the library ? In the QLNet development we did several hack to avoid this problem with the only result to make the code ugly and difficult to read and without fixing the issue. Let me know if you have any idea on how to proceed.

from qlnet.

tournierjc avatar tournierjc commented on July 17, 2024

Hello @channell, @amaggiulli,

I've started a fork of QLNet moving to Visual Studio Code, .NET Core 3.1 and xUnit. You can find it here : https://github.com/OpenDerivatives/QLCore

I've removed the Observer & Observable pattern and so far it seems to work (only one test is not working but it is not working on original QLNet either and has been removed from tests), and some issues can still happen with ExchangeRateManager, but I'm looking into it.

There is still a lot to do on this fork. @amaggiulli do not hesitate to remove this message if it not appropriate and please let me know if the fork do not respect the original license.

from qlnet.

oliviermilla avatar oliviermilla commented on July 17, 2024

@tournierjc why not do that here as a major version? I mean, It's QLNet + refactoring + some more from QuantLib right?

from qlnet.

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.