Creates the JSON to output to the CLI Args: market_pair (str): Market pair that this message relates to. results (dict): The result of the completed analysis to output. Returns: str: Completed JSON message
(self, results, market_pair)
| 176 | |
| 177 | |
| 178 | def to_json(self, results, market_pair): |
| 179 | """Creates the JSON to output to the CLI |
| 180 | |
| 181 | Args: |
| 182 | market_pair (str): Market pair that this message relates to. |
| 183 | results (dict): The result of the completed analysis to output. |
| 184 | |
| 185 | Returns: |
| 186 | str: Completed JSON message |
| 187 | """ |
| 188 | |
| 189 | logger.warn('WARNING: JSON output is deprecated and will be removed in a future version') |
| 190 | |
| 191 | for indicator_type in results: |
| 192 | for indicator in results[indicator_type]: |
| 193 | for index, analysis in enumerate(results[indicator_type][indicator]): |
| 194 | results[indicator_type][indicator][index]['result'] = analysis['result'].to_dict( |
| 195 | orient='records' |
| 196 | )[-1] |
| 197 | |
| 198 | formatted_results = { 'pair': market_pair, 'results': results } |
| 199 | output = json.dumps(formatted_results) |
| 200 | output += '\n' |
| 201 | return output |
nothing calls this directly
no outgoing calls
no test coverage detected