FileManager

The FileManager feature simplifies the use of local files with relative paths, ensuring compatibility across different environments (server and client).

Usage

Implement the FileManager in Your Class

In your class, declare the file_path using the FileManager.get_path method. This method allows you to specify a relative file path, which will be appropriately adjusted for the running environment.

from finter.utils import FileManager
from finter import BaseAlpha
import pandas as pd

class Alpha(BaseAlpha):  
    # Declare the file path using FileManager
    file_path = FileManager.get_path('hi.csv')

    def get(self, start, end):        
        import pandas as pd
        print(self.file_path)
        df = pd.read_csv(self.file_path, index_col=0)
        print(df)

        return pd.DataFrame([1, 2, 3])

Warning

  • Class Variable Declaration: Ensure the file_path is declared as a class variable, not within the __init__ method.

  • Experimental Feature: This feature is currently in the research phase and can be used for validation purposes. However, it does not guarantee production-level reliability.

By following these simple steps, you can efficiently manage local files with FileManager.

Last updated