TFSettings
TFSettings
provides global settings management for TFire. It allows users to configure and persist various settings across sessions. It includes the following settings:
projectdir
: The directory of the TFire folderdatadir
: The directory for storing data (usually a "TSData" subdirectory within the TFire folder)default_internet_service
: The default service for fetching internet dataapi_keys
: A dictionary mapping internet data sources to their respective API keystheme
: The color theme for TFire. Options are ":light" and ":dark"plot_price_as
: The default price type for plotting. Options are ":line" and ":candlestick"
Saving and Loading Settings
TFSettings can be loaded and saved using the following functions:
TFSettings_save()
: Saves the current TFSettings to a JSON file in the project directoryTFSettings_load()
: Loads TFSettings from the JSON file in the project directory
The settings are automatically loaded when TFire is launched but needs to be manually saved before exiting to persist.
Getting And Setting Settings
To get and set various settings in TFSettings:
- Access settings directly:
TFSettings.projectdir
,TFSettings.datadir
, etc. - Set settings:
TFSettings.projectdir = new_value
- Get API key:
get_api_key(InternetDataSource)
- Set API key:
TFSettings.api_keys[InternetDataSource] = "new_api_key"
- Set default internet service:
TFSettings.default_internet_service = NewService
Remember to call TFSettings_save()
after modifying settings to persist changes.