Client Reference



Public Decorators

@session
Manages the network connection to the Yahoo Finance API servers.
Needs to be active only when the client methods are being called.
Used internally by the YFrake server process.
Raises

RuntimeError – if a configuration is already active.



Public Methods

classmethod get(endpoint, **kwargs)
Schedules a request to be made to the Yahoo Finance servers.
Returns immediately with the pending response object.
Parameters
  • endpoint (str) – The name of the endpoint from which to request data.

  • kwargs (unpacked dict) – Variable keyword arguments, which depend on the endpoint requirements. Values can be either str, int or bool.

Raises
  • RuntimeError – if the session decorator is not in use.

  • NameError – if an invalid endpoint name has been provided.

  • KeyError – if an invalid query parameter has been provided.

  • TypeError – if the datatype of a query parameter is invalid.

Returns

Response object

Return type

ClientResponse

classmethod batch_get(queries)
Helper method which schedules multiple queries at once.
Returns immediately with the pending results object.
Parameters

queries (list) – Collection of query dicts.

Raises
  • RuntimeError – if the session decorator is not in use.

  • NameError – if an invalid endpoint name has been provided.

  • KeyError – if an invalid query parameter has been provided.

  • TypeError – if the datatype of a query parameter is invalid.

Returns

List-like collection object

Return type

AsyncResults or ThreadResults

classmethod get_all(symbol)
Helper method which schedules a request to all symbol-specific
endpoints for a given symbol at once. A single call results in
32 simultaneous requests to the Yahoo Finance API servers.
Size of the returned data can vary from 1 to 1.5 megabytes.
Returns immediately with the pending results object.
Parameters

symbol (str) – Security identifier.

Raises
  • RuntimeError – if the session decorator is not in use.

  • NameError – if an invalid endpoint name has been provided.

  • KeyError – if an invalid query parameter has been provided.

  • TypeError – if the datatype of a query parameter is invalid.

Returns

List-like collection object

Return type

AsyncResults or ThreadResults