Code Monkey home page Code Monkey logo

Comments (6)

karlwancl avatar karlwancl commented on August 15, 2024

Hi. The most updated version is v3.1. Some of your problem should be fixed in this version. Please pull the branch and try to see if the problem is fixed.

from trady.

Transigent avatar Transigent commented on August 15, 2024

Thanks but I got 3.1 and the the same thing happens.
First error : 'Object reference not set to an instance of an object.'

in Runner.cs

private void SellAsset(IIndexedOhlcv indexedCandle, decimal premium, IDictionary<IEnumerable<IOhlcv>, decimal> assetCashMap, IList<Transaction> transactions)
        {
            if (assetCashMap.TryGetValue(indexedCandle.BackingList, out _))
            {
                var nextIOhlcvData = indexedCandle.Next;
                var lastTransaction = transactions.LastOrDefault(t => t.IOhlcvDatas.Equals(indexedCandle.BackingList));

                decimal cashIn = nextIOhlcvData.Open * lastTransaction.Quantity - premium;
                decimal plRatio = (cashIn - lastTransaction.AbsoluteCashFlow) / lastTransaction.AbsoluteCashFlow;
                assetCashMap[indexedCandle.BackingList] += cashIn;

                transactions.Add(new Transaction(indexedCandle.BackingList, nextIOhlcvData.Index, nextIOhlcvData.DateTime, TransactionType.Sell, lastTransaction.Quantity, cashIn));
                OnSold?.Invoke(indexedCandle.BackingList, nextIOhlcvData.Index, nextIOhlcvData.DateTime, nextIOhlcvData.Open, lastTransaction.Quantity, cashIn, assetCashMap[indexedCandle.BackingList], plRatio);
            }
        }

Error is thrown on the line

decimal cashIn = nextIOhlcvData.Open * lastTransaction.Quantity - premium;


In the second sample above, I am getting new errors:

'IsEma10BullishCrossEma30' is not a member of 'IIndexedOhlcv'
'IsEma10Rising' is not a member of 'IIndexedOhlcv'.
'IsEma10BearishCrossEma30' is not a member of 'IIndexedOhlcv'
'IsEma10Dropping' is not a member of 'IIndexedOhlcv'

Thanks

from trady.

Transigent avatar Transigent commented on August 15, 2024

Again if there were a simple project where these samples were working, we could use that to solve our own problems.

from trady.

irperez avatar irperez commented on August 15, 2024

@Transigent I don't see those 4 methods anywhere in the project.

IsEma10BullishCrossEma30
IsEma10Rising
IsEma10BearishCrossEma30
IsEma10Dropping

Can you confirm once again you were working on v3.1? Are these custom indicators or methods you created for this library?

I got your first example working fine in a unit test.

from trady.

irperez avatar irperez commented on August 15, 2024

@Transigent I just noticed that those four methods were an example that IppKarl created for the README file. But they are not actual methods in the library. FYI. Hope that answers your question.

from trady.

karlwancl avatar karlwancl commented on August 15, 2024

The issue is no longer active, closed.

from trady.

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.