user_cache ========== .. py:module:: user_cache Classes ------- .. autoapisummary:: user_cache.UserCache Module Contents --------------- .. py:class:: UserCache(/, **data) Bases: :py:obj:`pydantic.BaseModel` User Cache / Config for accessing and storing user-specific data. The cache contains any secrets, as well as the paths t secrets. The user may specify the JSON file to use for the cache via the environment variable `RR_TRADING_USER_CACHE_PATH`. If this variable is not set, the default path is `~/.rr_trading/user_cache.json`. .. py:attribute:: polygon_access_token_path :type: pathlib.Path :value: None .. py:attribute:: alpaca_api_key_live :type: pydantic.SecretStr :value: None .. py:attribute:: alpaca_api_secret_live :type: pydantic.SecretStr :value: None .. py:attribute:: alpaca_api_key :type: pydantic.SecretStr :value: None .. py:attribute:: alpaca_api_secret :type: pydantic.SecretStr :value: None .. py:attribute:: r2_access_key_id :type: pydantic.SecretStr :value: None .. py:attribute:: r2_secret_access_key :type: pydantic.SecretStr :value: None .. py:attribute:: r2_endpoint_url :type: str :value: None .. py:attribute:: out_dir :type: pathlib.Path :value: None .. py:attribute:: backtest_dir :type: pathlib.Path :value: None .. py:method:: user_cache_path() :classmethod: .. py:method:: dump_secret(v) .. py:method:: __setattr__(name, value) Override the __setattr__ method to save the cache whenever a new attribute is set. .. py:method:: __getattribute__(name) .. py:property:: polygon_access_token :type: Optional[str] Get the Polygon.io access token from the specified path. .. py:method:: load() :classmethod: Load the user cache from a JSON file. If the file does not exist, create it with default values. .. py:method:: save() Save the user cache to a JSON file. .. py:method:: delete() Delete the user cache file.