otp.Source.to_otq#

Source.to_otq(file_name=None, file_suffix=None, query_name=None, symbols=None, start=None, end=None, timezone=None, raw=None, add_passthrough=True)#

Save data source to .otq file and return path to the saved file.

Parameters
  • file_name (str) – Absolute or relative path to the saved file. If None, create temporary file and name it randomly.

  • file_suffix (str) – Suffix to add to the saved file name (including extension). Can be specified if file_name is None to distinguish between different temporary files. Default: “.to_otq.otq”

  • query_name (str) – Name of the main query in the created file. If None, take name from this Source object. If that name is empty, set name to “query”.

  • symbols (str, list, DataFrame, Source) – symbols to save query with

  • start (datetime) – start time to save query with

  • end (datetime) – end time to save query with

  • timezone (str) – timezone to save query with

  • raw

    Deprecated since version 1.4.17.

  • add_passthrough (bool) – will add onetick.query.Passthrough event processor at the end of resulting graph

Returns

result – Relative (if file_name is relative) or absolute path to the created query in the format file_name::query_name

Return type

str