santoshlite / EigenLedger

An Open Source Portfolio Backtesting Engine for Everyone | 面向所有人的开源投资组合回测引擎
https://eigenledger.gitbook.io/documentation
Apache License 2.0
949 stars 128 forks source link

EM Optimizer fails if benchmark changed to Nifty50 (yahoo ticker used "^NSEI") #51

Closed lawzeus closed 3 years ago

lawzeus commented 3 years ago

Describe the bug The EM optimiser fails when the default benchmark is altered to Nifty .

However if the default is restored it works .

To Reproduce Steps to reproduce the behavior : use this code "from empyrial import empyrial, Engine

portfolio = Engine(
start_date= "2015-01-01", #start date for the backtesting portfolio= ["TCS.NS", "INFY.NS", "HDFC.NS", "KOTAKBANK.NS","TITAN.NS","NESTLEIND.NS"], #assets in your portfolio benchmark = ["NSEI"] optimizer = "EF" ) empyrial(portfolio)"

Expected behavior error message " File "/var/folders/41/q1hx0rjd5xzck1vl121t6b2m0000gn/T/ipykernel_2924/1251204071.py", line 7 optimizer = "EF" ^ SyntaxError: invalid syntax

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

santoshlite commented 3 years ago

Hello I think it is a problem of typo. You missed a comma after defining the benchmark.

Also NSEI doesn't exist in yfinance, it is ^NSEI.

You can do that instead:

from empyrial import empyrial, Engine

portfolio = Engine(
    start_date= "2015-01-01", #start date for the backtesting
    portfolio= ["TCS.NS", "INFY.NS", "HDFC.NS", "KOTAKBANK.NS","TITAN.NS","NESTLEIND.NS"], #assets in your portfolio
    benchmark = ['^NSEI'],
    optimizer = "EF"
)

empyrial(portfolio)

Tell me if it worked!

lawzeus commented 3 years ago

Thanks bhai .

On Fri, 5 Nov 2021 at 14:02, Santosh @.***> wrote:

Hello I think it is a problem of typo. You missed a comma after defining the benchmark.

Also NSEI doesn't exist in yfinance, it is ^NSEI.

You can do that instead:

from empyrial import empyrial, Engine portfolio = Engine( start_date= "2015-01-01", #start date for the backtesting portfolio= ["TCS.NS", "INFY.NS", "HDFC.NS", "KOTAKBANK.NS","TITAN.NS","NESTLEIND.NS"], #assets in your portfolio benchmark = ['^NSEI'], optimizer = "EF" ) empyrial(portfolio)

Tell me if it worked!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ssantoshp/Empyrial/issues/51#issuecomment-961711167, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5JGBVZOH62F3RDPOGTZX3UKOJALANCNFSM5HNC4DDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

Warm Regards,

Amit

M-9873001966

lawzeus commented 3 years ago

Thanks for taking time out ... here is another problem that i am facing with the "get_report (portfolio)" command

[image: Screenshot 2021-11-12 at 13.07.24.png]

On Sun, Nov 7, 2021 at 8:41 PM Santosh @.***> wrote:

Closed #51 https://github.com/ssantoshp/Empyrial/issues/51.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ssantoshp/Empyrial/issues/51#event-5579185340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5JGBUX66Z3LROFKY25RC3UK2JK5ANCNFSM5HNC4DDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

Warm Regards,

Amit

M-9873001966