your compute_weights function calls the pipeline factor class constructor. The variable niftyreturn is an instance of the class marketreturn, NOT a number. You need to add this factor to a pipeline - preferably not in compute_weights but in a set up function that returns a new pipeline with this factor added (and use attach_pipeline in initize to attach this returned pipeline to the strategy). And then call the pipeline_output in the compute_weights to trigger the actual computation. See the pipeline template on Blueshift for details, or in the help section.
Also the underlying logic may not be suitable for pipeline. You use a single indicator (nifty return) to compute a single value (weight). Best to use the data.history function to fetch the data and compute it explicitly. Pipeline will do lots of extra computation in this case that you do not seem to use.