public override bool Initialize(List <IProcessorInput> inputs, string parameters, ILogger logger) { this.logger = logger; ParametersParser parser = CreateParser(parameters); call = parser.GetInt("Call"); put = parser.GetInt("Put"); if (call < 0 || call >= inputs.Count) { return(false); } if (put < 0 || put >= inputs.Count) { return(false); } strike = parser.GetDouble("Strike"); type = parser.GetInt("Type"); inp_name = parser.GetString("input_name"); //inp_name_2 = parser.GetString("input_name_2"); /* if(inp_name_2 == inp_name) * { * inp_name_2 += "_n"; * }*/ this.inputs = inputs; SyntheticFutureInput.AddKey(inp_name); //SyntheticFutureInput.AddKey(inp_name_2); return(true); }
public override double Process(DateTime time) { //if(inputs[call].) double syntheticFuture = 0.0; double syntheticFuture_ask = strike + inputs[call].Ask - inputs[put].Ask; double syntheticFuture_bid = strike + inputs[call].Bid - inputs[put].Bid; //double syntheticFuture_ask_reverse = strike + inputs[call].Ask - inputs[put].Bid; //double syntheticFuture_bid_reverse = strike + inputs[call].Bid - inputs[put].Ask; SyntheticFutureInput.AddValue(inp_name, syntheticFuture_ask, syntheticFuture_bid); //SyntheticFutureInput.AddValue(inp_name_2, syntheticFuture_ask_reverse, syntheticFuture_bid_reverse); switch (type) { case 0: syntheticFuture = syntheticFuture_ask; break; default: syntheticFuture = syntheticFuture_bid; break; } return(syntheticFuture); }