MCPcopy Create free account
hub / github.com/CryptoSignal/Crypto-Signal / to_json

Method to_json

app/outputs.py:178–201  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected