Back

MultiPeriodData to numbers

Hey, I've been trying to an average of a MultiPeriodData table to use in my alpha and I dont believe Im converting the numbers off a panda data frame correctly. Is there an example of getting a value out of a multi period data table?

 

 Thanks ~ Thomas

f1 = pd.DataFrame.from_records(
[
{
'symbol': str(security.Symbol),
'f1': str(security.FinancialStatements.BalanceSheet.Inventory.ThreeMonths)
} for security in securities
]).set_index('symbol')




#TypeError : Could not convert 0.033000000.0115013591.01250500000.04618000.00.012165000.02375124.00.083925000.0127034673.02494268.02252000.05167000.0138000.00.01383429.0260000.0634000.0801000.020253000.010272000.07817000.0353000.0204285427.069000000.010187000.00.00.02570555.023808000.0401131000.00.026000000.01473000.0235218000.026691000.0170900000.010163000.082803000.0119585000.00.03000000.04388000.0681000.00.0398000000.0267766000.029014000.021302000.00.0131285000.00.02020000.03215000.04783000.00.064562000.00.0300000.00.03166000.0327000.01134000.00.00.00.00.00.00.00.00.00.018693000.00.00.00.014859.00.01658000.....

 

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Thomas,

As the attached backtest shows, I was not able to reproduce the error with just the code provided above. Can you share the full algorithm that causes the issue?

Best,
Derek Melchin

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Sorry about that Derek, heres the full algorithm.

0

Im assuming I have to write the pandas data frame in a different way 

0


Hi Thomas,

This algorithm takes several minutes to backtest just one day with the full universe. As time is a constraint, I ran the algorithm with the full universe for a single day and I ran it for the entire duration with the universe size restricted. In both cases, the error mentioned above did not occur. Is there a specific day in the backtest this error typically occurs?

Best,
Derek Melchin

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed