Greeks.Formatters.ResultsFormatter¶
Classes
Dict(...[, two]) |
Methods |
ResultKey(id) |
General container class to identify a computation result. |
ResultKeys |
Static class regrouping the different market state keys used for greeks computation. |
ResultsFormatter |
Class to convert a pricing result into a string. |
-
class
Greeks.Formatters.ResultsFormatter.ResultsFormatter[source]¶ Class to convert a pricing result into a string.
Methods
format(...)Convert a pricing result into a readable string. -
format(result_dic: typing.Dict[Common.ResultKey.ResultKey, float]) → str[source]¶ Convert a pricing result into a readable string.
Parameters: result_dic : Dict[
ResultKey, float])The result of a pricing expressed as a mapping of result keys to numerical values.
Returns: result_str : str`
The string describing the pricing result.
Examples
>>> from Common.ResultKey import ResultKey >>> from Common.ResultKeys import ResultKeys >>> from Greeks.Formatters.ResultsFormatter import ResultsFormatter >>> result_dic = dict() >>> result_dic[ResultKeys.price] = 2.38 >>> result_dic[ResultKeys.volga] = 0.34 >>> result_dic[ResultKeys.underlying_level] = 54.3 >>> formatter = ResultsFormatter() >>> formatter.format(result_dic) 'F: 54.3\nPV: 2.38\nVolga: 0.34\n'
-