Using custom data

You can take pricing data from any source you want, but you would have to format it this way before passing it to the Engine:

custom_data:

Date	        AAPL            BABA	
2018-01-02	40.776520	183.649994
2018-01-03	40.769413	184.000000
2018-01-04	40.958797	185.710007
2018-01-05	41.425125	190.699997
2018-01-08	41.271259	190.330002
...	...	...
2023-08-07	178.608810	96.559998
2023-08-08	179.557526	94.220001
2023-08-09	177.949707	94.849998
2023-08-10	177.729996	99.209999
2023-08-11	177.789993	95.720001

And then, you can pass it like this:

portfolio = Engine(
      start_date = "2018-01-01",
      benchmark = ["SPY"], #SPY is set by default
      portfolio = ["AAPL", "BABA"],
      data = custom_data,
      weights = [0.75, 0.25]
)

empyrial(portfolio)

Last updated